這是我的WSDL文件視圖。如何在android中通過soap請求
<s:element name="ManageUser">
<s:complexType>
<s:sequence>
<s:element minOccurs="1" maxOccurs="1" name="Scenario" type="tns:ManageUserScenario"/>
<s:element minOccurs="0" maxOccurs="1" name="Language" type="s:string"/>
<s:element minOccurs="0" maxOccurs="1" name="Userguid" type="s:string"/>
<s:element minOccurs="0" maxOccurs="1" name="Username" type="s:string"/>
<s:element minOccurs="0" maxOccurs="1" name="Email" type="s:string"/>
<s:element minOccurs="0" maxOccurs="1" name="Password" type="s:string"/>
<s:element minOccurs="0" maxOccurs="1" name="Firstname" type="s:string"/>
<s:element minOccurs="0" maxOccurs="1" name="Lastname" type="s:string"/>
<s:element minOccurs="0" maxOccurs="1" name="Address" type="s:string"/>
<s:element minOccurs="0" maxOccurs="1" name="District" type="s:string"/>
<s:element minOccurs="0" maxOccurs="1" name="Province" type="s:string"/>
<s:element minOccurs="0" maxOccurs="1" name="Country" type="s:string"/>
<s:element minOccurs="0" maxOccurs="1" name="Postcode" type="s:string"/>
<s:element minOccurs="0" maxOccurs="1" name="Phone" type="s:string"/>
<s:element minOccurs="1" maxOccurs="1" name="Newsletter" type="tns:SubscribeNewsletter"/>
</s:sequence>
</s:complexType>
</s:element>
<s:simpleType name="ManageUserScenario">
<s:restriction base="s:string">
<s:enumeration value="Create"/>
<s:enumeration value="Update"/>
</s:restriction>
</s:simpleType>
<s:simpleType name="SubscribeNewsletter">
<s:restriction base="s:string">
<s:enumeration value="X"/>
<s:enumeration value="N"/>
</s:restriction>
</s:simpleType>
我該如何設置請求。這是我的代碼,我沒有得到任何迴應,但警告。請告訴我我錯在哪裏。我的代碼:
try {
SoapObject request = new SoapObject(NAMESPACE, METHOD);
request.addProperty("Scenario", "Create");
request.addProperty("Language", "en");
request.addProperty("Username", "abc");
request.addProperty("Email", "[email protected]");
request.addProperty("Password", "abc");
request.addProperty("Firstname", "kumar");
request.addProperty("Lastname", "aryan");
request.addProperty("Userguid", "");
request.addProperty("Phone", "0000000000");
request.addProperty("Address", "");
request.addProperty("District", "");
request.addProperty("Province", "");
request.addProperty("Country", "India");
request.addProperty("Postcode", "");
request.addProperty("Newsletter", "X");
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(
SOAP_VERSION);
envelope.setOutputSoapObject(request);
envelope.dotNet = true;
HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);
Log.e("Try Block 1", envelope + " - " + request);
androidHttpTransport.call(SOAP_ACTION, envelope);
SoapObject result1 = (SoapObject) envelope.bodyIn;
而且我得到這個日誌:
W/System.err(32420): org.xmlpull.v1.XmlPullParserException: unexpected type (position:TEXT To register an [email protected]:166 in [email protected])
: at org.kxml2.io.KXmlParser.nextTag(KXmlParser.java:2045)
: at org.ksoap2.serialization.SoapSerializationEnvelope.readUnknown(SoapSerializationEnvelope.java:275)
: at org.ksoap2.serialization.SoapSerializationEnvelope.read(SoapSerializationEnvelope.java:389)
: at org.ksoap2.serialization.SoapSerializationEnvelope.readUnknown(SoapSerializationEnvelope.java:273)
: at org.ksoap2.serialization.SoapSerializationEnvelope.read(SoapSerializationEnvelope.java:389)
: at org.ksoap2.serialization.SoapSerializationEnvelope.readUnknown(SoapSerializationEnvelope.java:273)
: at org.ksoap2.serialization.SoapSerializationEnvelope.read(SoapSerializationEnvelope.java:389)
: at org.ksoap2.serialization.SoapSerializationEnvelope.readUnknown(SoapSerializationEnvelope.java:273)
: at org.ksoap2.serialization.SoapSerializationEnvelope.read(SoapSerializationEnvelope.java:389)
: at org.ksoap2.serialization.SoapSerializationEnvelope.readUnknown(SoapSerializationEnvelope.java:273)
: at org.ksoap2.serialization.SoapSerializationEnvelope.read(SoapSerializationEnvelope.java:389)
: at org.ksoap2.serialization.SoapSerializationEnvelope.parseBody(SoapSerializationEnvelope.java:151)
: at org.ksoap2.SoapEnvelope.parse(SoapEnvelope.java:140)
: at org.ksoap2.transport.Transport.parseResponse(Transport.java:118)
: at org.ksoap2.transport.HttpTransportSE.call(HttpTransportSE.java:253)
: at org.ksoap2.transport.HttpTransportSE.call(HttpTransportSE.java:116)
: at org.ksoap2.transport.HttpTransportSE.call(HttpTransportSE.java:111)
: at com.chilindo.SignUpActivity$AsyncTaskRunner.doInBackground(SignUpActivity.java:193)
任何幫助表示讚賞,謝謝。
http://stackoverflow.com/a/29444607/4447803儘量LIK這一點,在這個環節上我已經使用SOAP請求僅 – Mano
您可以查看[此鏈接](http://www.ibm.com /developerworks/library/x-soapcl/listing1.html) – Pankaj
感謝您的幫助。讓我檢查一下這些鏈接是否適用於我。 –