失效链接处理 |
AXIS2 教程 PDF 下载
本站整理下载:
提取码:wdvl
相关截图:
主要内容:
Tomcat部署
1.jar文件准备
1)org.apache.axis2.eclipse.codegen.plugin_1.6.4
2)org.apache.axis2.eclipse.service.plugin_1.6.4
3)axis
4)axis-ant
5)c3p0-0.9.5.1
6)c3p0-oracle-thin-extras-0.9.5.1
7)commons-discovery-0.2
8)commons-logging-1.2
9)jaxrpc
10)log4j-1.2.15
11)mchange-commons-java-0.2.10
12)ojdbc6
13)saaj
14)wsdl4j-1.5.1
客户端调用jar包
axiom-api-1.2.20.jar
axis2-adb-1.7.4.jar
axis2-kernel-1.7.4.jar
commons-codec-1.3.jar
commons-httpclient-3.1.jar
commons-logging-1.1.1.jar
wsdl4j-1.6.2.jar
xmlschema-core-2.2.1.jar
axiom-impl-1.2.20.jar
neethi-3.0.3.jar
axis2-1.7.4\lib\axis2-transport-local-1.7.4.jar
axis2-transport-http-1.7.4.jar
httpcore-4.4.4.jar
woden-core-1.0M10.jar
2.将1) 2)文件放到eclipse相应目录,如下图
3.在eclipse新建普通项目工程,导入其他jar包,编写相应的程序
4.导出aar文件
5.将axis2.war放到如下目录,然后运行一次,生成axis2文件夹
6.将aar文件放到如下位置
7.Wsdl http://10.14.253.40:8080/axis2/services/PTSWebservice?wsdl
8.调用
// ʹ��RPC��ʽ����WebService
RPCServiceClient serviceClient = new RPCServiceClient();
Options options = serviceClient.getOptions();
// // ָ������WebService��URL
EndpointReference targetEPR = new EndpointReference("http://10.14.251.241:8080/axis2/services/PTSWebservice?wsdl");
options.setTo(targetEPR);
//
// // ָ��Ҫ���õ�sayHi������WSDL�ļ��������ռ�
QName opAddEntry = new QName("http://impl.service.audit.autosite.rockwell.com", "getWeightByMachineNo");
// // ָ��sayHi�����IJ���ֵ
Object[] opAddEntryArgs = getObjectArr();
// // ָ��sayHi��������ֵ���������͵�Class����
Class[] classes = new Class[] { String.class };
// // ����sayHi����������÷����ķ���ֵ
System.out.println(serviceClient.invokeBlocking(opAddEntry, opAddEntryArgs, classes)[0]);
调用2
ServiceClient sc = new ServiceClient();
Options opts = new Options();
String url = "http://10.14.251.241:8080/axis2/services/PTSWebservice";
EndpointReference end = new EndpointReference(url);
opts.setTo(end);
opts.setAction("getMaterialNo");
sc.setOptions(opts);
OMFactory fac = OMAbstractFactory.getOMFactory();
OMNamespace omNs = fac.createOMNamespace("http://impl.service.audit.autosite.rockwell.com", "");
OMElement method = fac.createOMElement("getMaterialNo",omNs);
OMElement value = fac.createOMElement("machineNO",omNs);
OMElement value1 = fac.createOMElement("shift",omNs);
value.setText("BB01");
value1.setText("中");
method.addChild(value);
method.addChild(value1);
OMElement res = sc.sendReceive(method);
res.getFirstElement().getText();
Iterator it = res.getChildElements();
while(it.hasNext())
{
OMElement ome= (OMElement)it.next();
System.out.println(ome.getText());
}
附一:C3P0配置
|