简体   繁体   中英

Sending data through SOAP client with WSDL included

I got a new project to make, but since I am new to SOAP I would need some help to start. I need to send some data, which downloads to a file, through a SOAP request, and get back response from Server. I don't know what exactly to do with file -> and how to send a request through soap with that data?

Also, the data must be sent through SOAP in XML format - I have a guide, but since I never worked with SOAP I need additional help.

I thought that I use JAXB Marshaller to marshal data to XML format, but I don't know how to send this further to server?

All help would be appreciated - if you have some examples even better.

You can use:

Command : wsimport command to parse CompA WSDL file.

Ex:- wsimport -keep -verbose http://compA.com/ws/server?wsdl

Using this, you can communicate with the service.

You'll need to formulate your request in SOAP format, which typically looks somewhat like this:

POST http://some.url:1337/someService_WS
Accept-Encoding: stuff
Content-Type: text/xml;charset=UTF-8
SOAPAction: "some:urn:here:1/someService/someOperation"
Content-Length: 300 (whatever content lenght you have withing the envelope)
Host: someservername.com:1337
Connection: Keep-Alive
User-Agent: Apache-HttpClient/4.5.1 (Java/2.0) (use your own stuff ;))

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="some:urn:here:1">
   <soapenv:Header/>
   <soapenv:Body>
      <SomeOperation xmlns="some:urn:here:1">
         <someElement>someValue123</someElement>
      </SomeOperation>
   </soapenv:Body>
</soapenv:Envelope>

All SOAP really is is this format for sending and receiving SOAP information, its a standard/protocol. After you have your message formulated in SOAP, you need to put your message either on a que somewhere to be picked up by a service, or send it to the url of a webservice in order for it to be processed. You can use all kinds of tools in order to make this easier. I personlly use SOAPUI/ReadyAPI which has a free version and some nice tutorials to get started.

https://www.soapui.org/downloads/soapui.html

I hope this helps you! Cheers,

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM