问题描述
org.apache.axis2.AxisFault:Transportouthasnotbeensetatorg.apache.axis2.engine.AxisEngine.send(AxisEngine.java:435)atorg.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:401)atorg.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:228)atorg.apache.axis2.client.OperationClient.execute(OperationClient.java:163)atorg.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:548)atorg.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:528)atorg.apache.axis2.rpc.client.RPCServiceClient.invokeBlocking(RPCServiceClient.java:102)atcom.bsoft.bsphis.qkqy.TestQKQY.axis2RPCInvoke(TestQKQY.java:40)atcom.bsoft.bsphis.qkqy.TestQKQY.main(TestQKQY.java:94)java.lang.NullPointerExceptionatcom.bsoft.bsphis.qkqy.TestQKQY.axis2RPCInvoke(TestQKQY.java:47)atcom.bsoft.bsphis.qkqy.TestQKQY.main(TestQKQY.java:94)总是会报这个错各位大神求解importjavax.xml.namespace.QName;importorg.apache.axis2.AxisFault;importorg.apache.axis2.addressing.EndpointReference;importorg.apache.axis2.client.Options;importorg.apache.axis2.rpc.client.RPCServiceClient;publicclassTestQKQY{privatestaticRPCServiceClientserviceClient;/***RPC调用AXIS2webservice*@paramendpoint服务地址如:http://192.168.0.1:2597/aixs2/services/jqservice?wsdl*@paramlocalPart方法名如<xs:elementname="Receive">*@paramopArgs方法参数如Object[]opArgs=newObject[]{param};*@paramnamespaceURI命名空间如:targetNamespace="http://server.test.com.cn">*@paramopReturnType返回类型如字符串:Class[]opReturnType=newClass[]{String[].class};*/publicstaticStringaxis2RPCInvoke(Stringendpoint,StringlocalPart,Object[]opArgs,StringnamespaceURI,Class[]opReturnType){Object[]ret=null;try{serviceClient=newRPCServiceClient();Optionsoptions=serviceClient.getOptions();EndpointReferencetargetEPR=newEndpointReference(endpoint);options.setTo(targetEPR);QNameopQName=newQName(namespaceURI,localPart);ret=serviceClient.invokeBlocking(opQName,opArgs,opReturnType);System.out.println(((String[])ret[0])[0]);}catch(AxisFaulte){e.printStackTrace();}return((String[])ret[0])[0];}publicstaticvoidmain(String[]args){Stringss=axis2RPCInvoke("192.26.28.127:10088/BonsTech.svc?wsdl","SaveRegisterInfo",newObject[]{xml},"http://schemas.microsoft.com/2003/10/Serialization/",newClass[]{String[].class});System.out.println(ss);}}
解决方案
解决方案二:
192.26.28.127:10088加http://,地址不正确就会出这个错.