I am using KSoap for Android, and I'm having the following problem: When I call the web service, I get the following error message:
SoapFault - faultcode: 'axis2ns5:Client.input.missingOrUnexpectedParameter'
faultstring:
'Unexpected subelement site, site is expected(
callId: 34527, Client.input.missingOrUnexpectedParameter/1.2.2)'
faultactor: 'null' detail: org.kxml2.kdom.Node@7e5db5ae
This is my request code:
SoapObject request = new SoapObject("http://example.com/namespace", "MyService");
request.addProperty("site", "example.org");
request.addProperty("user", "123");
request.addProperty("password", "456");
List<HeaderProperty> headerProperties = new LinkedList<HeaderProperty>();
headerProperties.add(new HeaderProperty("Authorization", "Basic " + org.kobjects.base64.Base64.encode("user:pass".getBytes())));
HttpsTransportSE con = new HttpsTransportSE("example.com", 443, "/myWebService/", 10000);
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.setOutputSoapObject(request);
envelope.dotNet = true;
con.call("login", envelope, headerProperties);
System.out.println(envelope.bodyIn);
Never mind the values I put in the site parameter and the URI.
This is my WSDL (at least the parts concerned for the login):
<wsdl:definitions name="MyService" targetNamespace="http://example.com/namespace" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="http://example.com/namespace" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
<wsdl:types>
<xsd:schema targetNamespace="http://example.com/namespace">
<xsd:element name="loginRequest">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="site" type="xsd:string"/>
<xsd:element name="user" type="xsd:string"/>
<xsd:element name="password" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="loginResponse">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="successful" type="xsd:boolean"/>
<xsd:element minOccurs="0" name="sessionToken" type="xsd:string"/>
<xsd:element minOccurs="0" name="firstTimeUser" type="xsd:boolean"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
</wsdl:types>
<!-- Snip -->
<wsdl:message name="loginRequest">
<wsdl:part name="parameters" element="tns:loginRequest">
</wsdl:part>
</wsdl:message>
<wsdl:message name="loginResponse">
<wsdl:part name="parameters" element="tns:loginResponse">
</wsdl:part>
</wsdl:message>
<!-- Snip -->
<wsdl:operation name="login">
<wsdl:input message="tns:loginRequest">
</wsdl:input>
<wsdl:output message="tns:loginResponse">
</wsdl:output>
</wsdl:operation>
<wsdl:binding name="MyServiceSOAP" type="tns:MyService">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="login">
<soap:operation soapAction="http://example.com/namespace/login"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
</wsdl:definitions>
I didn't write the WSDL, and if there are some errors in it, that just comes from my copying (and removing the parts that don't have to with this question).
So, why am I getting the above error?