我是一个肥皂网络服务提供的,它有一个带有soapaction =“”的wsdl
<wsdl:binding name="SimpleSearchRequestSoapBinding" type="impl:SimpleSearchRequest">
<wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="getSearchResults"><wsdlsoap:operation **soapAction=""**/>
<wsdl:input name="getSearchResultsRequest">
<wsdlsoap:body use="literal"/></wsdl:input>
<wsdl:output name="getSearchResultsResponse">
<wsdlsoap:body use="literal"/></wsdl:output>
</wsdl:operation>
点击这样的网络服务:
SoapObject request = new SoapObject(OKMConstants.NAMESPACE, OKMConstants.OPERATION_NAME);
request.addProperty("searchParam","faq");
SoapSerializationEnvelope soapEnvelope = new SoapSerializationEnvelope(SoapEnvelope.VER12);
soapEnvelope.setOutputSoapObject(request);
HttpTransportSE httpTransport = new HttpTransportSE(OKMConstants.url);
httpTransport.call("", soapEnvelope);
// Object response = soapEnvelope.getResponse();
SoapObject result = (SoapObject)soapEnvelope.bodyIn;
但它的抛出异常:
org.xmlpull.v1.XmlPullParserException: Expected a quoted string (position:DOCDECL @1:62 in java.io.InputStreamReader@410b9d60)
答案 0 :(得分:1)
你应该传递soapAction null
(它将被ksoap2设置为空字符串)或传递带引号的空字符串:
httpTransport.call("\"\"", soapEnvelope);
答案 1 :(得分:0)
httpTransport.call(SOAPACTION,的SoapEnvelope);
认为在这一行可能是问题,请尝试在call方法中使用soapAction。