问题描述
axis,axis2调用c#Serverwasunabletoprocessrequest.--->Objectreferencenotsettoaninstanceofanobject.axis,axis2调用java开发的接口都可以通过。调用C#(RecvRemoteData.asmx?wsdl)的则都报这个问题wdl片段:-<s:elementname="GetYWXDInfo">-<s:complexType>-<s:sequence><s:elementminOccurs="0"maxOccurs="1"name="Info"type="s:string"/></s:sequence></s:complexType></s:element>传入的message:<?xmlversion="1.0"encoding="UTF-8"?><Request><paramname="SERIAL_NUMBER">1412001203</param><paramname="outCaseID">0254</param><paramname="S_SHOULIDW">40</param><paramname="D_CHULISJ">2014-12-1211:20:25</param><paramname="S_CHULIR">王五</param><paramname="S_CHULILB">处理类别</param><paramname="S_CHULINR">处理内容</param><paramname="S_CHULIJG">处理结果</param><paramname="S_CHULIBZ">处理备注</param><paramname="S_CHULIDLY">r012</param><paramname="I_FileCount">0</param><paramname="S_FileName"></param><paramname="S_JIAOYANM">校验码</param></Request>axis:publicStringyewuxd(Stringmethod,Stringmessage){Stringurl="http://10.101.77.203:9000/12319RecvRemoteData.asmx";Stringnamespace="http://tempuri.org/";Stringsoapurl=namespace+method;Stringresult=“”;try{Serviceservice=newService();Callcall=(Call)service.createCall();call.setTargetEndpointAddress(url);call.setOperationName(newQName(namespace,method));call.addParameter("Info",org.apache.axis.encoding.XMLType.XSD_STRING,javax.xml.rpc.ParameterMode.IN);call.setReturnType(org.apache.axis.encoding.XMLType.XSD_STRING);call.setSOAPActionURI(soapurl);Objectob=call.invoke(newObject[]{message});result=(String)ob;System.out.println("return"+result);}catch(RemoteExceptione){e.printStackTrace();}catch(ServiceExceptione){e.printStackTrace();}returnresult;}axis异常:AxisFaultfaultCode:{http://schemas.xmlsoap.org/soap/envelope/}ServerfaultSubcode:faultString:Serverwasunabletoprocessrequest.--->Objectreferencenotsettoaninstanceofanobject.faultActor:faultNode:faultDetail:{http://xml.apache.org/axis/}stackTrace:Serverwasunabletoprocessrequest.--->Objectreferencenotsettoaninstanceofanobject.atorg.apache.axis.message.SOAPFaultBuilder.createFault(SOAPFaultBuilder.java:222)atorg.apache.axis.message.SOAPFaultBuilder.endElement(SOAPFaultBuilder.java:129)atorg.apache.axis.encoding.DeserializationContext.endElement(DeserializationContext.java:1087)atcom.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(AbstractSAXParser.java:601)atcom.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanEndElement(XMLDocumentFragmentScannerImpl.java:1782)atcom.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2938)atcom.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:648)atcom.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:140)atcom.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:511)atcom.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:808)atcom.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737)atcom.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:119)atcom.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1205)atcom.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:522)atjavax.xml.parsers.SAXParser.parse(SAXParser.java:395)atorg.apache.axis.encoding.DeserializationContext.parse(DeserializationContext.java:227)atorg.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:696)atorg.apache.axis.Message.getSOAPEnvelope(Message.java:435)atorg.apache.axis.handlers.soap.MustUnderstandChecker.invoke(MustUnderstandChecker.java:62)atorg.apache.axis.client.AxisClient.invoke(AxisClient.java:206)atorg.apache.axis.client.Call.invokeEngine(Call.java:2784)atorg.apache.axis.client.Call.invoke(Call.java:2767)atorg.apache.axis.client.Call.invoke(Call.java:2443)atorg.apache.axis.client.Call.invoke(Call.java:2366)atorg.apache.axis.client.Call.invoke(Call.java:1812)atcom.gwideal.services.Webservice.yewuxd(Webservice.java:56)atcom.gwideal.services.WebserviceImpl.ywxd(WebserviceImpl.java:8)atcom.gwideal.services.Webservice.main(Webservice.java:25){http://xml.apache.org/axis/}hostname:lzjoaServerwasunabletoprocessrequest.--->Objectreferencenotsettoaninstanceofanobject.atorg.apache.axis.message.SOAPFaultBuilder.createFault(SOAPFaultBuilder.java:222)atorg.apache.axis.message.SOAPFaultBuilder.endElement(SOAPFaultBuilder.java:129)atorg.apache.axis.encoding.DeserializationContext.endElement(DeserializationContext.java:1087)atcom.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(AbstractSAXParser.java:601)atcom.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanEndElement(XMLDocumentFragmentScannerImpl.java:1782)atcom.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2938)atcom.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:648)atcom.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:140)atcom.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:511)atcom.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:808)atcom.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737)atcom.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:119)atcom.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1205)atcom.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:522)atjavax.xml.parsers.SAXParser.parse(SAXParser.java:395)atorg.apache.axis.encoding.DeserializationContext.parse(DeserializationContext.java:227)atorg.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:696)atorg.apache.axis.Message.getSOAPEnvelope(Message.java:435)atorg.apache.axis.handlers.soap.MustUnderstandChecker.invoke(MustUnderstandChecker.java:62)atorg.apache.axis.client.AxisClient.invoke(AxisClient.java:206)atorg.apache.axis.client.Call.invokeEngine(Call.java:2784)atorg.apache.axis.client.Call.invoke(Call.java:2767)atorg.apache.axis.client.Call.invoke(Call.java:2443)atorg.apache.axis.client.Call.invoke(Call.java:2366)atorg.apache.axis.client.Call.invoke(Call.java:1812)atcom.gwideal.services.Webservice.yewuxd(Webservice.java:56)atcom.gwideal.services.WebserviceImpl.ywxd(WebserviceImpl.java:8)atcom.gwideal.services.Webservice.main(Webservice.java:25)Exceptioninthread"main"java.lang.NullPointerExceptionatcom.gwideal.services.ReturnResult.writeXML(ReturnResult.java:96)atcom.gwideal.services.ReturnResult.getResult(ReturnResult.java:27)atcom.gwideal.services.Webservice.main(Webservice.java:25)axis2:publicStringyewuxd(Stringmethod,Stringmessage){Stringurl="http://10.101.77.203:9000/12319RecvRemoteData.asmx";Stringnamespace="http://tempuri.org/";Stringsoapurl=namespace+method;Stringreturnmessage="";try{RPCServiceClientserviceClient=newRPCServiceClient();Optionsoptions=newOptions();options=serviceClient.getOptions();options.setProperty(HTTPConstants.CHUNKED,false);EndpointReferencetargetEPR=newEndpointReference(url);options.setTo(targetEPR);options.setAction(soapurl);Object[]opAddEntryArgs=newObject[]{message};Class[]classes=newClass[]{String.class};QNameopAddEntry=newQName(namespace,method);returnmessage=(String)serviceClient.invokeBlocking(opAddEntry,opAddEntryArgs,classes)[0];}catch(AxisFaulte){//TODOAuto-generatedcatchblocke.printStackTrace();}returnreturnmessage;}axis2异常:org.apache.axis2.AxisFault:Serverwasunabletoprocessrequest.--->Objectreferencenotsettoaninstanceofanobject.atorg.apache.axis2.util.Utils.getInboundFaultFromMessageContext(Utils.java:531)atorg.apache.axis2.description.OutInAxisOperationClient.handleResponse(OutInAxisOperation.java:375)atorg.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:421)atorg.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:229)atorg.apache.axis2.client.OperationClient.execute(OperationClient.java:165)atorg.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:555)atorg.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:531)atorg.apache.axis2.rpc.client.RPCServiceClient.invokeBlocking(RPCServiceClient.java:102)atcom.gwideal.services.Webservice.yewuxd(Webservice.java:55)atcom.gwideal.services.WebserviceImpl.ywxd(WebserviceImpl.java:8)atcom.gwideal.services.Webservice.main(Webservice.java:20)[FatalError]20141217160312562.xml:1:1:Prematureendoffile.org.xml.sax.SAXParseException:Prematureendoffile.atcom.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:249)atcom.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:284)atjavax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:208)atcom.gwideal.services.ReturnResult.jx_ResponseXML(ReturnResult.java:45)atcom.gwideal.services.ReturnResult.getResult(ReturnResult.java:27)atcom.gwideal.services.Webservice.main(Webservice.java:20)
解决方案
解决方案二:
我都写这么详细了,有人知道么??