This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
The process of invoking the webservice, that has been described in WSDL is as following.
1) Execute wsimport on the WSDL for the generation of artifacts, this would generate and JAXB Bindings, stubs etc.
2) In your client application, get a reference of Service.
3) Invoke getXXX on service object to obtain the reference to port.
4) Invoke the method on the port, which acts as a stub.
The other way of invoking service, is by using Dispatch, should you want to handle the XML messages directly and this works in both PAYLOAD and SOAPMessage mode.
If you look into metro, there is a detailed explanation of each steps.
Now I am trying to call the method using Java standalone class.
My question is in order to consume the webservice do I need to have a client configuration file which will have the reference to the wsdl url along with the stub code?
Please provide your valuable feedback
What configuration file are you referring to, if you are using JAX-WS as I suggested, no configuration file is needed. What are the artifacts that were generated when you did wsimport.
Out of those, you will find a class that extends Service class. This is a reference to your service, now you will invoke one of the getXXX methods to get an reference of port. Once you get port, you can invoke the method.
Joined: Nov 27, 2007
You are correct.On executing wsimport command the artifacts got generated(Java classes were generated out of which there is a class which extends Service Class)
I got the ports using the below code:
I now have the URL from the port
How can I invoke the business method now using the above port.Kindly advice.
Please can you post some sample code which can help me implement the above?
1. I used > wsimport -keep -verbose http://....?wsdl 2. It generate java classes, interface & service Implementation class which extends service
3. I created the web service client class in which I acess the getXXXport() in serviceImplementation class to call the remote method
4. I also created interfaceImplementation class(Is this right??? In this class I implemented the interface(which is auto generated))
Problem is that I couldn't see some particular schema type java class which is present in wsdl
without that schema type class I wont be able to build the response
Please guide me if I'm wrong in these steps & also point out why I couldn't see schema type java file when I use wsimport