Generating stubs for SOAP calls using IntelliJ IDEA

13 / Jul / 2010 by Sachin 4 comments

Since working with SOAP calls in XML is very tiresome, we have libraries like axis and wsdl2java to generate stubs to make web-service client calls. I generated the stubs using IntelliJ IDEA to make SOAP calls in grails using the steps below.

1. Adding Framework Support

If the IntelliJ project does not already have the framework support, then add it by right clicking on the “ProjectName” project and selecting the “Add Framework Support”. Go to Web services client in left pane and select Apache Axis in the right pane. Also, specify the path where you want necessary files to be downloaded. It will prompt you to download files. Just click “Yes”.

2. Generate Java code from WSDL

Right click the project’s src/java directory, and select “Webservices >> Generate Java code from WSDL”. Now point to the URL and ensure that the “output path” points to “src/java” .

Using the generated stub, we should now be able to invoke web service calls by importing in the necessary classes where ever we want to use them.

No more haggling with XML.. cheers…!!!

~~With Regards~~

~~Sachin Anand~~

Tag -

axis axis2 SOAP

comments (4)

  1. Sachin

    Right, So Client makes a normal HTTP call to server, and of course it will need to send some data. Data now needs to be in the form of XML, its structured governed strictly by the WSDL file.

    Now surely we don’t want to work with XML directly, if we have option to work directly with objects and delegate the responsibility of generating XML to someone else and this is where the stubs I mentioned come into picture.

    I am not very well aware of RMI but in my knowledge, in RMI also at least one of either stub or skelton is on the client side.??.. isn’t it that way.?

    Please don’t confuse it with java’s “RMI”. May be in that you may have the condition that both client and server need to be in homogeneous technologies. but that clearly is not the case here in SOAP calls. Also don’t confuse the stubs with “RMI” stubs. The stub here simply means a function call which will delegate the responsibility of generating XML to someone else.

  2. Prashath

    Let me rephrase my question –

    I understand stubs and skeletons are used only in RMI process. Does client need stubs in web services? I guess, client will make a normal http call to server, server internally will use stubs and skeletons for invoking the endpoint.

  3. Sachin Anand

    No. Why should that happen..? Classes are generated from WSDL. Even if the client and server are on heterogeneous technologies that should not effect. WSDL defines in what format (what objects it exactly wants) the server expects a function call.

    May be you would like to search for java RMI (Remote method invokation). To the best of my knowledge that is the underlying technology in SOAP calls.

  4. Prashath

    Have a question – Isn’t it stubs useful only when both Webservice consumer and producer are both built on same technology? Ex: java

    What if client and server are built on heterogenous technologies?


Leave a Reply

Your email address will not be published. Required fields are marked *