Reputation: 621
I'm developing my first Spring Boot
application containing both Soap and rest webservice
. I've to pass Request in url as a parameter. I'm able to pass request in URL for Rest service. Is it possible to send request in URL for SOAP
webservice
?
Upvotes: 0
Views: 2692
Reputation: 2532
Ok I am not sure what are your intentions but about SOAP.
--------------- ----------------
| | someMethodInvoke | |
| Your API | -------------------->| WEB Service |
| |<-------------------- | |
--------------- someResult ----------------
Now attending a communication with a WS you need firstly to have the schema of that API or the .WSDL
from which you can generate Objects with which you will make the calls you need.
I am personally am using JAXB
for generating .java
classes from schema.
After for the call it self org.springframework.ws.client.core.WebServiceTemplate
is the thing that gets the job done. You can use marshalSendAndReceive
.
For example:
public class SomeService extends WebServiceGatewaySupport {
ObjectFactory oFactory = new ObjectFactory();
public ExpectedResultObject someMethodInvoke(RequestObjectGeneratedFromSchema request){
JAXBElement<ExpectedResultObject> response = (JAXBElement<ExpectedResultObject>) getWebServiceTemplate()
.marshalSendAndReceive("http://yourURL.com", oFactory.createreRequestObjectGeneratedFromSchemaInputMessage(request));
return response.getValue();
}
}
Firstly extend the WebServiceGatewaySupport
so you can invoke the getWebServiceTemplate()
which return just exactly what you need : org.springframework.ws.client.core.WebServiceTemplate
. Here is an example how you can use the WebServiceTemplate
Of course there are a lot of factors like security, connectivity and so on which maybe should be set. But that depends on the WS. But basicly that is all :
Hope I gave you some directions.
Upvotes: 2