Reputation: 30678
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.
Upvotes: 8
Views: 27017
Reputation: 175
You can have a look at this --> https://github.com/devashish234073/SOAP_GUI_PHP/blob/master/README.md This is a simple SOAP client in php.
Using same logic as the php one [home.php], I have also added the java version
Upvotes: 0
Reputation: 38899
Your question is very vague, so use Apache CXF and follow this tutorial:
Other wise, you can also use Apache AXIS2.
Upvotes: 4
Reputation: 16025
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.
Upvotes: 5
Reputation: 7964
Update your eclipse to newest version (I have seen it working with Eclipse Europa 3.3.2 also though :) ). Go to new project wizard and under Web Service select Web Service Client, click next and then give wsdl file location of your web service. Eclipse will automatically generate web service stubs for you.
Upvotes: 1
Reputation: 20869
Thats pretty much a little bit broad question. From my point of view i would suggest using Apache CXF: http://cxf.apache.org/
There are pretty good samples and you define a WSDL and generate the server as well as the client code. There are also maven plugins which do this JOB automatically for you. Embedding an existent web-service described by an WSDL is also possible.
But however this is more a matter of requirements and taste.
Alternatives may be found e.g. here: http://java-source.net/open-source/web-services-tools
Upvotes: 0
Reputation: 6958
here's a detailed tutorial on how you can create one : SOAP Client in Java
Upvotes: 3