package sample.pojo.rpcclient;
?
import javax.xml.namespace.QName;
import org.apache.axis2.AxisFault;
import org.apache.axis2.addressing.EndpointReference;
import org.apache.axis2.client.Options;
import org.apache.axis2.rpc.client.RPCServiceClient;
import sample.pojo.data.Weather;
?
public class WeatherRPCClient {
?????? public static void main(String[] args1) throws AxisFault {
????????????? RPCServiceClient serviceClient = new RPCServiceClient();
????????????? Options options = serviceClient.getOptions();
????????????? EndpointReference targetEPR = new EndpointReference(
??????????????????????????? "http://localhost:8080/axis2/services/WeatherService");
????????????? options.setTo(targetEPR);
?
????????????? // Setting the weather
????????????? QName opSetWeather = new QName("http://service.pojo.sample/xsd",
??????????????????????????? "setWeather");
????????????? Weather w = new Weather();
????????????? w.setTemperature((float) 39.3);
????????????? w.setForecast("Cloudy with showers");
????????????? w.setRain(true);
????????????? w.setHowMuchRain((float) 4.5);
?
????????????? Object[] opSetWeatherArgs = new Object[] { w };
????????????? serviceClient.invokeRobust(opSetWeather, opSetWeatherArgs);
????????????? serviceClient.invokeRobust(opSetWeather, opSetWeatherArgs);
?
????????????? // Getting the weather
????????????? QName opGetWeather = new QName("http://service.pojo.sample/xsd",
??????????????????????????? "getWeather");
?
????????????? Object[] opGetWeatherArgs = new Object[] {};
????????????? Class[] returnTypes = new Class[] { Weather.class };
????????????? Object[] response = serviceClient.invokeBlocking(opGetWeather,
??????????????????????????? opGetWeatherArgs, returnTypes);
?
????????????? Weather result = (Weather) response[0];
????????????? if (result == null) {
???????????????????? System.out.println("Weather didn't initialize!");
???????????????????? return;
????????????? }
?
????????????? // Displaying the result
????????????? System.out.println("Temperature?????????????? : "
??????????????????????????? + result.getTemperature());
????????????? System.out.println("Forecast????????????????? : "
??????????????????????????? + result.getForecast());
????????????? System.out.println("Rain????????????????????? : " + result.getRain());
????????????? System.out.println("How much rain (in inches) : "
??????????????????????????? + result.getHowMuchRain());
?
?????? }
}
|
相关推荐
axis2 wsdl2java的使用说明和简单程序.docx
介绍AXIS2中OMElement和Java对象之间的转换
D:\Software\axis2-1.6.2\bin>wsdl2java.bat -uri http://10.33.30.216:9099/facs/services/ResourceSynchroWebService?wsdl -o E:\wsdloutput -p com.util wsdl2java.bat -uri ...
Axis2完美教程java 绝对好东西 值得学习
使用Java+Axis2调用Web Services 网络接口,代码中列举4个例子可以查看,有详细注释提供参考。
Axis2教程和java调用webservice的各种方法总结
axis2解决 org.apache.axis2.util.JavaUtils.callStackToString问题
Axis2完美教程 包括下载部署axis2,java客户端,c#客户端调用 从入门到精通
<Call Stack = DEBUG_FRAME = org.apache.axis2.util.JavaUtils.callStackToString(JavaUtils.java:564) DEBUG_FRAME = org.apache.axis2.description.ParameterIncludeImpl.debugParameterAdd(ParameterIncludeImpl...
eclipse java axis2 http://axis.apache.org/axis2/java/core/download.cgi
axis2客户端生成java代码的jar包以及依赖jar包。生成java代码后需要引用的jar包
axis1_4 发布webservice 传递对象或返回对象(一)_benet6_新浪博客.mht
本案例实现使用Axis2生成.arr包发布WebService服务,并使用Axis2生成客户端代码方式调用WebService
AXIS2中自带了一个通过POJO发布为WebService 的例子。这种方式发布的WebService并不需要我们生成WSDL,而直接从Bean生成WebService(自底向上模式)。典型的问题就是,如果我们直接用AXIS2中的源代码通过ant生成arr...
axis2,java 中启动axis2服务
Axis2完美教程用java和c#,供初学者使用 doc文档,
axis2_1.5.3.war 解压后的axis2直接放tomcat 下已包含geronimo-stax-api_1.0_spec-1.0.1.jar和backport-util-concurrent-3.1.jar Axis2_Codegen_Wizard_1.3.0.zip和 解压后的文件Axis2_Service_Archiver_1.3.0.zip ...
基于axis2的java与php通信源码及说明文档,里面包括完整的源码和详细的说明文档,里面有java的服务端,java的客户端,和php的客户端。 由于上传不能超过20M,AxisTest里面的包需要朋友自己去下载,网上找axis2-1.5.1...
axis2-1.4.1-bin、 axis2-eclipse-codegen-wizard、axis2-eclipse-service-archiver-wizard