0
我打電話跟我的Android應用程序中的Web服務的Android整個SOAP響應,並沒有錯誤,但我卡上的下一個點:解析與ksoap2-的Android
這裏是我的迴應:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<ns4:conResponse returnStatus="SRV_STATUS_SUCCESS" xmlns:ns5="https://myserver.fr/Server/GameOps/" xmlns:ns4="https://myserver.fr/Server/MainOps/" xmlns:ns3="https://myserver.fr/Server/CoreServices/" xmlns:ns2="https://myserver.fr/Server/Models/"/>
</soap:Body>
</soap:Envelope>
和驗證碼
SoapObject result = (SoapObject) envelope.bodyIn;
int count = result.getPropertyCount();
int count2 = result.getAttributeCount();
返回計數= 0和COUNT2 = 0
我需要得到returnStatu s屬性,我該怎麼做?
編輯1 我準備我的要求是這樣的:
String NAMESPACE = "https://myserver.fr/Server/MainOps/";
String METHODNAME = "conRequest";
String URL = "myserver.com/myproject/MainOpsSOAP";
String SOAPACTION = NAMESPACE + "connect";
SoapObject main = new SoapObject(NAMESPACE, METHODNAME);
main.addProperty("id", "id1");
main.addProperty("name", "name1");
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.setOutputSoapObject(main);
HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);
androidHttpTransport.call(SOAPACTION, envelope);
return envelope;
編輯2 我想修改我的複雜類型,在這裏我注意到
當我的反應看高清像這樣:
<xsd:complexType name="WSResponse">
<xsd:attribute name="returnStatus" type="coreservices:ReturnStatusEnum" use="required" />
</xsd:complexType>
我envelope.bodyIn不包含任何屬性或屬性,
但是當我通過這個修改這樣的定義:
<xsd:complexType name="WSResponse">
<xsd:sequence>
<xsd:element name="returnStatus" type="coreservices:ReturnStatusEnum" />
</xsd:sequence>
</xsd:complexType>
我envelope.bodyIn包含 「returnStatus」 財產
但在我的情況下,我的「結果」沒有屬性,所以SoapObject的resultCollection =結果。的getProperty( 「getMethodCollectionResult」);將不會返回。 –
很奇怪,你沒有財產...你可以讓wsdl網址? – general03
https://www.wsdl-analyzer.com/service/service/697031380?version=1 –