Using WSDL2Java
the "WeatherService" WSDL to Client side code is generated successfully.
In which java file and methods should be used for the main class be written to access the and execute the process ?
WeatherServiceCallbackHandler.java
WeatherServiceStub.java
I presume ther should be some standard signature code steps to follow and access t开发者_运维问答he methods avaliable in the WSDL.
In neither. You shouldn't touch the generated code at all. You class should make calls to the generated code in order to interact with the web-service.
Normally you would instantiate a service locator and use it to get a stub implementation. You could then use the stub directly.
So in short, your main method should be inside a separate class altogether.
See code below for how to use the stub implementation generated by wsdl2java:
package com.axis.weather;
import static com.axis.weather.WeatherServiceStub.*;
public class Main {
public static void main(String[] args) {
Weather w = new Weather();
w.setHowMuchRain(2.2f);
SetWeather wrapper = new SetWeather();
wrapper.setArgs0(w);
try {
WeatherServiceStub stub = new WeatherServiceStub(); // will use http://localhost:8080/axis2/services/WeatherService.WeatherServiceHttpSoap12Endpoint/
stub.setWeather(wrapper);
} catch (java.rmi.RemoteException re) {
re.printStackTrace();
}
}
}
Regards
Yusuf
精彩评论