Help Neeed to write a Client Application from WSDL
Joined: Mar 21, 2006
I am new to Web Service Technology. I want to write a simple client application (without using any third part tool like axis or anything) that will make use of my Calculator.wsdl. I mean, the Client should be able to call mathod like add(2,5) and get a response as 7.
What do you mean by this? Do you just want to write a client that can access a WS that's described by the WSDL, or do you want to write a generic client that can access the WSDL, and then build and execute a WS call based on the contents of the WSDL? The latter would be quite an advanced project. For the former, it's probably easiest to write a SAAJ client, if you don't want to use tools that generate the code for you. But I'm curious: why don't you?
I want to write a client that can access my WS that's described by the WSDL,
Please let me know how can I achieve it?
Regards, Dinesh S
Joined: Aug 19, 2005
If you insists on learning things the hard way - then do them the hard way:
Learn about SOAP
Learn about how WSDL describes what SOAP messages should look like
Interpret the WSDL and handcraft the SOAP request message
Write a program to send the SOAP request over a URL connection
Parse/XPath/Regex match the SOAP response to extract the results
Of course you could simply "cheat" and follow a simple tutorial like Creating Web Services with Apache Axis - then apply what you have learned to do the same to your WSDL/web service and use the provided tools like Axis tcpmon to see the generated SOAP messages - and then use those in your "really simple client". [ April 21, 2006: Message edited by: Peer Reynders ]
It has good examples of how to write clients (which may even be in the first 40 free pages above). It also does a very good job of explaining the basics, conceptually and syntactically.
Joined: Mar 21, 2006
I was able to write a simple Client Program (Java Application with main() method) that read the sample Input SOAP Request, Created a URL Connection to the Service URI of the WSDL, send the SOAP message to the WSDL using the newly created connection and then got and parsed the response.
Now I want to move on to the next step..
Say Suppose I have a WSDL file with me called Calculator.wsdl and I want to create a clientjar-calculator.jar from it using the weblogic ant task called "clientgen". So now I need to make use of this client jar to write my client application that could get the port information and invoke the service like add(1,2) or subtract(1,2) on the exposed web services as described by the WSDL.