I want to build a web services client that takes wsdl link as the input and generates java classes. I know we can do this directly using Netbeans IDE where we provide the wsdl location during project setup. But I want the wsdl location to be provided when the client starts running. How do I do this?
A:
Is the location that will be provided just used to specify the SOAP endpoint (for a web service whose WSDL was known at development time), or will it be a completely arbitrary WSDL?
In the first case, the web service client that was created by Netbeans has methods that accept an alternate SOAP endpoint URL. You can call those to use the client with a server whose location is not hard-coded in the client.
If however, the WSDL describes a completely unrelated service, how are you going to write Java code against it? You cannot use any interfaces derived from the WSDL (because they are not known at development time). You could only have a very generic SOAP client, where the user almost directly types in the XML that will be sent.
Thilo
2010-04-05 03:51:00
Thanks for the reply. Yes, I am speaking of the first case. Can you please elaborate on how do I do it in Netbeans?
Bill
2010-04-05 03:59:32
You create the client just as you do now, and when you call the client from your application's Java code, there should be a constructor or a setter on the client class that allows you to specify the endpoint url (You have to figure out the endpoint URL from the WSDL URL somehow).
Thilo
2010-04-05 04:41:06