I have SOAP server running. I need to write a SOAP client for the server. Can you please suggest plugin in eclipse or give me the URL related to this?
can you please provide me it you have any sample SOAP Client code?
My SOAP client should use complex objects as parmeter/arguments for the SOAP function which is exposed in the SOAP server.
Assuming Java:
1.- Execute:
wsimport -keep -p myClient url_to_wsdl
Where myClient will be a folder with the generated client's artifacts. url_to_wsdl the url to your WSDL.
2.- Create a client class with a method with the following code:
YourServiceClass service = new YourServiceClass();
YourEndpointClass port = service.getPort();
YourRequestClass request = new YourRequestClass();
YourMessageClass message = new YourMessageClass(); //In case you have it
message.setParam1(param1); //depending on your message
message.setParam2(param2);
request.setMessage(message);
YourResponseClass response = port.ServiceOperation(request); //This call locks execution
System.out.println(response.getMessage().getResponse());
YourServiceClass is the generated artifact the extends javax.xml.ws.Service.
YourEndpointClass can be seen in YourServiceClass in an operation that calls super.getPort();
YourRequestClass and YourResponseClass will depend on how is managed the Request and Response message.
YourMessageClass would be a wrapper class for your message (depending on WSDL).
All Your* classes must have been generated by wsimport
and imported to your client class.
With the flag -keep
in wsimport
you'll be able to see the .java
files and determine which classes you require to complete this code.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With