package test;
import java.io.File;
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 org.apache.axis2.transport.http.HTTPConstants;
import org.dom4j.Document;
import org.dom4j.DocumentException;
import org.dom4j.io.SAXReader;
import org.junit.Test;
public class Test {
@Test
public void test(){
String url ="http://127.0.0.1:7001/services/XXWebService?wsdl";
RPCServiceClient serviceClient;
try {
serviceClient=new RPCServiceClient();
Options options = serviceClient.getOptions();
EndpointReference targetEPR = new EndpointReference(url);
options.setTransportInProtocol("SOAP");
options.setAction("doService");
options.setTo(targetEPR);
options.setManageSession(true);
options.setProperty(HTTPConstants
java调用webservice接口示例程序
最新推荐文章于 2024-06-21 18:06:38 发布
本文详细介绍了如何使用Java进行WebService接口调用,通过实例代码解析调用过程,包括必要的库引入、接口地址配置及请求响应处理,帮助开发者掌握Java调用WebService的基本技巧。
摘要由CSDN通过智能技术生成