views:

28

answers:

1

Hi.

I have some web services and I am creating a web client using ws-import.

When creating the client I have this line:

MyServiceService service = new MyServiceService();

It works fine as it is.

I have the same web service running on another server and I was wondering if I could access them using the same client. Is it possible to change the wsdl url of the client? Ctrl-Space in Eclipse gives me 2 parameters which I can enter into MyServiceService which are URL arg0 and Qname arg1. Is this what I'm looking for? And if this is the case what should I put in Qname since I didn't find any Javadoc associated and didn't find it on google neither

Thanks and regards, Krt_Malta

A: 

Yes, you can do this. As you suspected, you need to use the constructor with this signature that is generated on your service class. As you can see, it takes two arguments: a QName, and an Url.

The QName is a little bit tricky to determine. You have to look at the generated source code for the no-arg constructor of your service class (and the @Service attribute on the class). If you do this, you should be able to figure what QName the no-arg constructor uses. Just construct a QName with those same values, and use that.

The Url is easy: just use the wsdl url you want to access.

Sean Reilly
P.S. If you're still having trouble figuring out what QName to use, post the generated service stub source code, and I'll be able to show you what QName you need to use.
Sean Reilly
Brilliant! The QName is like this private final static QName MYSERVICESERVICE_QNAME = new QName("http://MyService/", "MyServiceService");Thanks a bunch! :)
Krt_Malta