8

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.

fyr
  • 20,227
  • 7
  • 37
  • 53
Hemant Metalia
  • 29,730
  • 18
  • 72
  • 91
  • You should be a little more specific about what you are trying to do. Which Language ? What have you tried so far ? – fyr Oct 12 '11 at 05:59
  • hi thanx for your quick reply i want to create it in java one of the solution may be import org.apache.axis.client i dont know it is suitable or not but some kind of this may help me to create it – Hemant Metalia Oct 12 '11 at 06:06

6 Answers6

5

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.

Christian Vielma
  • 15,263
  • 12
  • 53
  • 60
4

Your question is very vague, so use Apache CXF and follow this tutorial:

  1. This is the most recent (2011) writeup: Creating a SOAP client with either Apache CXF or GlassFish Metro
  2. How to create a WSDL-first SOAP client in Java with CXF and Maven and
  3. This demo illustrates Apache CXF's support for SOAP headers

Other wise, you can also use Apache AXIS2.

Daniil Shevelev
  • 11,739
  • 12
  • 50
  • 73
zengr
  • 38,346
  • 37
  • 130
  • 192
  • On the [Apache CXF FAQ](http://cxf.apache.org/faq.html#FAQ-CanCXFrunwithJDK1.7%3F) it says "TBD" in regards to Java 7 support. – Eyal Oct 09 '12 at 16:25
3

here's a detailed tutorial on how you can create one : SOAP Client in Java

rb512
  • 6,880
  • 3
  • 36
  • 55
1

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.

Saurabh
  • 7,894
  • 2
  • 23
  • 31
0

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

0

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

fyr
  • 20,227
  • 7
  • 37
  • 53