1
SOAPベースサービスのネストされたXMLタグのデータを渡したいと思います。しかし、それは私のXMLファイルをエラーしています。コードは以下の通り...SOAPベースサービスのネストされたXMLタグのデータを渡す方法
SOAPAction: "http://mobile.expenseanywhere.com/verifyLogin"
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<verifyLogin xmlns="http://mobile.expenseanywhere.com/">
<AuthToken>
<CorporateId>string</CorporateId>
<Username>string</Username>
<Password>string</Password>
</AuthToken>
</verifyLogin>
</soap:Body>
</soap:Envelope>
そして、私のコードがあるさ:
try {
SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
PropertyInfo pi = new PropertyInfo();
pi.setName("AuthToken");
pi.setValue(new SoapObject(NAMESPACE,METHOD_NAME)
.addProperty("CorporateId","MayDemo2011")
.addProperty("Username","wildnet")
.addProperty("Password","Iphone123")
);
request.addProperty(pi);
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.dotNet = true;
envelope.bodyOut = request;
envelope.encodingStyle = SoapSerializationEnvelope.XSI;
envelope.setOutputSoapObject(request);
androidHttpTransport.call(SOAP_ACTION, envelope);
Object result = envelope.getResponse();
}
と誤差がある
07-20 18:55:45.613: WARN/System.err(1164): SoapFault - faultcode: 'soap:Client' faultstring: 'Server was unable to read request. ---> There is an error in XML document (1, 346). ---> The specified type was not recognized: name='verifyLogin', namespace='http://mobile.expenseanywhere.com/', at <AuthToken xmlns='http://mobile.expenseanywhere.com/'>.' faultactor: 'null' detail: [email protected]
07-20 18:55:45.623: WARN/System.err(1164): at org.ksoap2.serialization.SoapSerializationEnvelope.parseBody(SoapSerializationEnvelope.java:112)
07-20 18:55:45.632: WARN/System.err(1164): at org.ksoap2.SoapEnvelope.parse(SoapEnvelope.java:137)
07-20 18:55:45.642: WARN/System.err(1164): at org.ksoap2.transport.Transport.parseResponse(Transport.java:63)
07-20 18:55:45.642: WARN/System.err(1164): at org.ksoap2.transport.HttpTransportSE.call(HttpTransportSE.java:100)
07-20 18:55:45.642: WARN/System.err(1164): at soap.sdjfh.dj.verification$1.onClick(verification.java:59)