Reputation: 527
I've SOAP endpoint and SOAP envelope payload request, I would like to call SOAP endpoint from my Spring boot app.
My concern is how can I invoke SOAP endpoint with this below payload request, I'm new to SOAP service - I tried searching the best approach in google but most of them are confusing. What I'm confused about is how I can send below SOAP payload request while invoking SOAP service, do I need to convert a java object? I don't want any coding just I need the right approach of writing a soap client using spring boot
SOAP Endpoint: http://localhost:8080/services/helloService
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:oas="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"
xmlns:sys="http://adsfdf/sadfasdf/sdfdas" xmlns:urn="urn:com.dsafasdfdsfsaf"
xmlns:v1="http://sdfasdfdasf">
<soapenv:Header>
<v1:ServiceRequestInfo>
<v1:RequestID>8383</v1:RequestID>
</v1:ServiceRequestInfo>
</soapenv:Header>
<soapenv:Body>
</soapenv:Body>
</soapenv:Envelope>
Upvotes: 2
Views: 11914
Reputation: 196
First of all you have to choose whether you will be calling the services using axis or cxf.
Create a Dynamic Web Project. Create a web service client and generate client files using the WSDL and cxf or axis library. https://help.eclipse.org/mars/index.jsp?topic=%2Forg.eclipse.jst.ws.cxf.doc.user%2Ftasks%2Fcreate_client.html
You can use those files to make call to the service.
Upvotes: 1
Reputation: 183
First of all, you need a schema (WSDL file) which describes the message model. You put it into the source code (or online) and use a plugin which generates Java classes out of a schema. It can be for example maven-jaxb2-plugin
Once your classes are generated, you should use a WS client. It can be for example WebServiceGatewaySupport from package spring-ws-core.
For more details I recommend this tutorial: https://spring.io/guides/gs/consuming-web-service/
Upvotes: 1