简体   繁体   中英

How to utilize web service client generated from WSDL?

I'm trying to write a simple web service client to interact with my simple web service which only returns a user id that's passed in. So I created a web service client in eclipse and generated a few files for me; wsCall, wsCallBindingStub, wsCallProxy, wsCallService, wsCallServiceLocator. The stub is the conly class I found that has my web service methods in it, because my ws is simple at this stage?

So I want to invoke the call, what do I need to make the call?

I've seen all the examples online have the try-catch for a remote exception or Axis fault, then the classes are instantiated (including a response class, to deserialize?) and make the ws call via the stub class. Is that all I need to call for my case?

wsCallBindingStub stub = new wsCallBindingStub();
String retString = stub.sayHi(1); // 1: my user id
return retString;

Thank you!

Ahh I figured it out, I was getting an error because my wsdl uses the hostname and I needed to specify the ip.. as for the code needed it was pretty much identicle;

wsCall ws = new wsCallServiceLocator().getWsCallPort();
result = ws.sayHi(x);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM