package com.cn.gs.controller;
import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
public class TextController {
public static void main(String[] args) {
try {
//调用接口
String endpoint = "http://localhost:8080/***";
Service _service = new Service();
Call call = (Call) _service.createCall();
call.setTargetEndpointAddress(endpoint);
call.setOperationName("WS_BU_OPENLOCK");// WSDL里面描述的接口名称
//call.setOperationName(new javax.xml.namespace.QName("http://localhost:8080/zndbx/webservice/znsjInterf/", "ZnsjInterfServiceImplService"));
//call.setOperation("ZnsjInterfServiceImplService");// WSDL里面描述的接口名称
call.addParameter("xml", org.apache.axis.encoding.XMLType.XSD_STRING, javax.xml.rpc.ParameterMode.IN);// 接口的参数
call.setReturnType(org.apache.axis.encoding.XMLType.XSD_STRING);// 设置返回类型
String temp = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><DBSET><R><C N=\"REQ_NO\">22</C><C N=\"Cre_datetime\">2019-03-04</C></R></DBSET>";
String result = (String) call.invoke(new Object[] { temp });
//给方法传递参数,并且调用方法
System.out.println("result is " + result);
} catch (Exception e) {
e.printStackTrace();
}
}
}