Reputation: 209
Have anybody any examples how to realize simple SOAP service having only .wsdl file? I have .wsdl file and I should send a request to the server and get some reply. The solutions which I've found do not use wsdl files (for example Working Soap client example). My wsdl file is quite big so I can't use it like a string in a console so I need some simple example that I will be able to modify :) I'm using java 8 with maven. Thanks!
Upvotes: 0
Views: 852
Reputation: 740
In my company, we are dealing a lot with SOAP requests to SAP.
We are using cxf-codegen-plugin for Maven. It generates from wsdl files SOAP structure as java classes (requests/responses/datatypes), which then can be used as a way of generating the request / response.
Example setup of it in the pom.xml could look like this:
<build>
<plugins>
<plugin>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-codegen-plugin</artifactId>
<executions>
<execution>
<id>generate-sources</id>
<phase>generate-sources</phase>
<goals>
<goal>wsdl2java</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
Wsdl files should be placed under src/main/resources/wsdl/ directory.
In the generated classes one of the class will be the destination service, which usually can be found in the node in the WSDL file (in most cases, it is at the bottom of the file). Once the client is correctly instantiated, you should be able to send via it all POJO requests and retrieve the responses.
Upvotes: 1
Reputation: 139
You need at least the objects and some configuration of your SOAP Framework. I.e. with Apache Axis 2 you have to create your classes and your service class with a configuration of the object mapping.
If you use Spring Framework, have a look at the Getting Started Project -> https://spring.io/guides/gs/producing-web-service/
Upvotes: 0