javaproject 用axis2发布
来源:互联网 发布:数据分析 兼职 编辑:程序博客网 时间:2024/06/07 06:18
<serviceGroup>
<service name="HelloWorldService">
<description>Hello World Service</description>
<parameter name="ServiceClass" locked="false">example.HelloWorldService</parameter>
<operation name="hello" mep="http://www.w3.org/2004/08/wsdl/in-out">
<messageReceiver class="org.apache.axis2.rpc.receivers.RPCMessageReceiver" />
</operation>
<operation name="helloNoParam">
<messageReceiver class="org.apache.axis2.rpc.receivers.RPCMessageReceiver" />
</operation>
</service>
</serviceGroup>
然后启动你的tomcat:http://localhost:8080/NIService/services/NIServiceImp?wsdl
如果显示正常的话说明ok了;
三:rpc客户端(调用webservice)
package com.xc.axis2.client;
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;
public class Client {
public static void main(String[] args) throws Exception {
// ObjectFactory factory = new ObjectFactory();
// SimpleMethod method=factory.createSimpleMethod();
// System.out.println("client");
RPCServiceClient serviceClient;
serviceClient = new RPCServiceClient();
Options options = serviceClient.getOptions();
// 这一步指定了该办事的供给地址
EndpointReference targetEPR = new EndpointReference("http://localhost:8080/NIService/services/NIServiceImp?wsdl");
// 将option绑定到该办事地址
options.setTo(targetEPR);
// 添加具体要调用的办法,这个可以从该办事的wsdl文件中得知
// 第一个参数是该办事的targetNamespace,第二个为你所要调用
// 的operation名称
QName namespace = new QName("http://ni.activate.service.cattsoft.com", "doNIService");//axis2为办事端项目名 simpleMethod为办法名
// 设置返回值类型
// Class[] returnTypes = new Class[] {String.class};
// 设置调用的参数
Object[] param = new Object[] {参数值}>"
};//输入参数
// 调用办事,获得返回值
Object[] b = serviceClient.invokeBlocking(namespace, param,new Class[]{String.class});
System.out.println(b[0]);
}
}
- javaproject 用axis2发布
- javaProject打包和服务发布解决方案
- javaProject打包和服务发布解决方案
- eclipse用axis2发布webserver
- 用AXIS2发布WebService的方法
- 用AXIS2发布WebService和客户端调用
- 用AXIS2发布WebService的方法
- 用AXIS2发布WebService的方法
- 用AXIS2发布WebService的方法
- 用AXIS2发布WebService的方法
- 用AXIS2发布法WebService的方法
- 用AXIS2发布WebService的方法
- 用AXIS2发布WebService的方法
- 用AXIS2发布WebService的方法
- 用AXIS2发布WebService的方法
- 用AXIS2发布WebService的方法
- AXIS2:如何发布webservice
- AXIS2发布WebService
- win7使用vbox虚拟机问题求指导
- Multitouch Part 1: Getting Started with Multitouch in Windows 7
- c++list 类
- 题目1018:统计同成绩学生人数
- 淘宝开源平台(taobao
- javaproject 用axis2发布
- 责任链模式
- 在邮件正文完美展示你的简历(一)
- git使用小结
- 工厂模式
- String的indexof()方法的实现
- TCP IP 学习笔记四:ARP 和RARP
- 从程序员到项目经理(17):你不是一个人在战斗
- C#中的MessageBox消息对话框