Hi, I'm trying to do a Xlet application for J2ME and I need to access
to a web service using kSOAP2.

For now I have my local web service, and I'm trying to make a simple
request and response with kSOAP2.

I send this request:

request: <v:Envelope xmlns:i="http://www.w3.org/2001/XMLSchema-
instance" xmlns:d="http://www.w3.org/2001/XMLSchema"; xmlns:c="http://
schemas.xmlsoap.org/soap/encoding/" xmlns:v="http://
schemas.xmlsoap.org/soap/envelope/"><v:Header /
><v:Body><n0:c2fConvertion id="o0" c:root="1" xmlns:n0="http://
example.ws/xsd"><cValue i:type="d:string">23.1</cValue></
n0:c2fConvertion></v:Body></v:Envelope>

and I have this response:

response: <?xml version='1.0' encoding='UTF-8'?><soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/
envelope/"><soapenv:Body><ns:c2fConvertionResponse xmlns:ns="http://
example.ws/xsd"><ns:return>risposta: 23.1</ns:return></
ns:c2fConvertionResponse></soapenv:Body></soapenv:Envelope>

So, this looks like it's working.

But the problem is when I try to parse the response, I have this
error:

org.xmlpull.v1.XmlPullParserException: unexpected type
(position:END_DOCUMENT n...@1:0 in
java.io.inputstreamrea...@24f45584)
        at org.kxml2.io.KXmlParser.exception(Unknown Source)
        at org.kxml2.io.KXmlParser.nextTag(Unknown Source)
        at org.ksoap2.SoapEnvelope.parse(Unknown Source)
        at org.ksoap2.transport.Transport.parseResponse(Unknown Source)
        at org.ksoap2.transport.HttpTransport.call(Unknown Source)
        at TestXlet.startXlet(Unknown Source)
        at com.sun.xlet.XletManager.handleRequest(Unknown Source)
        at com.sun.xlet.XletStateQueue.dispatchRequests(Unknown Source)
        at com.sun.xlet.XletStateQueue$1.run(Unknown Source)
        at java.lang.Thread.run(Unknown Source)
        at java.lang.Thread.startup(Unknown Source)


Did someone fixed this problem? How can I solve it?

Please help me

Thanks a lot

ps: Here there are my parameters and my wsdl file

String namespace = "http://example.ws/xsd";;
String url = "http://10.1.1.2:8080/axis2.war/services/
TemperatureConverter/";
String method = "c2fConvertion";

// Create the Soap Call
SoapObject client = new SoapObject(namespace,method);
HttpTransport transport = new HttpTransport(url);

transport.debug=true;

// Add the values
client.addProperty("cValue","23.1");

// Creating the Soap Envelope
SoapSerializationEnvelope envelope = new
SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.bodyOut = client;
envelope.dotNet=true;

// Call the WebService
transport.call(method, envelope);

// Show the Result
System.out.println(envelope.getResponse());

#####################################################################################

WSDL

<wsdl:definitions targetNamespace="http://example.ws";>
<wsdl:documentation>TemperatureConverter</wsdl:documentation>
-
<wsdl:types>
-
<xs:schema attributeFormDefault="qualified"
elementFormDefault="qualified" targetNamespace="http://example.ws/
xsd">
-
<xs:element name="f2cConvertion">
-
<xs:complexType>
-
<xs:sequence>
<xs:element name="fValue" nillable="true" type="xs:double"/>
</xs:sequence>
</xs:complexType>
</xs:element>
-
<xs:element name="f2cConvertionResponse">
-
<xs:complexType>
-
<xs:sequence>
<xs:element name="return" nillable="true" type="xs:double"/>
</xs:sequence>
</xs:complexType>
</xs:element>
-
<xs:element name="c2fConvertion">
-
<xs:complexType>
-
<xs:sequence>
<xs:element name="cValue" nillable="true" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
-
<xs:element name="c2fConvertionResponse">
-
<xs:complexType>
-
<xs:sequence>
<xs:element name="return" nillable="true" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
</wsdl:types>
-
<wsdl:message name="c2fConvertionMessage">
<wsdl:part name="part1" element="ns0:c2fConvertion"/>
</wsdl:message>
-
<wsdl:message name="c2fConvertionResponse">
<wsdl:part name="part1" element="ns0:c2fConvertionResponse"/>
</wsdl:message>
-
<wsdl:message name="f2cConvertionMessage">
<wsdl:part name="part1" element="ns0:f2cConvertion"/>
</wsdl:message>
-
<wsdl:message name="f2cConvertionResponse">
<wsdl:part name="part1" element="ns0:f2cConvertionResponse"/>
</wsdl:message>
-
<wsdl:portType name="TemperatureConverterPortType">
-
<wsdl:operation name="c2fConvertion">
<wsdl:input message="axis2:c2fConvertionMessage"
wsaw:Action="urn:c2fConvertion"/>
<wsdl:output message="axis2:c2fConvertionResponse"/>
</wsdl:operation>
-
<wsdl:operation name="f2cConvertion">
<wsdl:input message="axis2:f2cConvertionMessage"
wsaw:Action="urn:f2cConvertion"/>
<wsdl:output message="axis2:f2cConvertionResponse"/>
</wsdl:operation>
</wsdl:portType>
-
<wsdl:binding name="TemperatureConverterSOAP11Binding"
type="axis2:TemperatureConverterPortType">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http";
style="document"/>
-
<wsdl:operation name="c2fConvertion">
<soap:operation soapAction="urn:c2fConvertion" style="document"/>
-
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
-
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
-
<wsdl:operation name="f2cConvertion">
<soap:operation soapAction="urn:f2cConvertion" style="document"/>
-
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
-
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
-
<wsdl:binding name="TemperatureConverterSOAP12Binding"
type="axis2:TemperatureConverterPortType">
<soap12:binding transport="http://schemas.xmlsoap.org/soap/http";
style="document"/>
-
<wsdl:operation name="c2fConvertion">
<soap12:operation soapAction="urn:c2fConvertion" style="document"/>
-
<wsdl:input>
<soap12:body use="literal"/>
</wsdl:input>
-
<wsdl:output>
<soap12:body use="literal"/>
</wsdl:output>
</wsdl:operation>
-
<wsdl:operation name="f2cConvertion">
<soap12:operation soapAction="urn:f2cConvertion" style="document"/>
-
<wsdl:input>
<soap12:body use="literal"/>
</wsdl:input>
-
<wsdl:output>
<soap12:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
-
<wsdl:binding name="TemperatureConverterHttpBinding"
type="axis2:TemperatureConverterPortType">
<http:binding verb="POST"/>
-
<wsdl:operation name="c2fConvertion">
<http:operation location="c2fConvertion"/>
-
<wsdl:input>
<mime:content type="text/xml"/>
</wsdl:input>
-
<wsdl:output>
<mime:content type="text/xml"/>
</wsdl:output>
</wsdl:operation>
-
<wsdl:operation name="f2cConvertion">
<http:operation location="f2cConvertion"/>
-
<wsdl:input>
<mime:content type="text/xml"/>
</wsdl:input>
-
<wsdl:output>
<mime:content type="text/xml"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
-
<wsdl:service name="TemperatureConverter">
-
<wsdl:port name="TemperatureConverterSOAP11port_http"
binding="axis2:TemperatureConverterSOAP11Binding">
<soap:address location="http://172.16.33.1:8080/axis2.war/services/
TemperatureConverter"/>
</wsdl:port>
-
<wsdl:port name="TemperatureConverterSOAP12port_http"
binding="axis2:TemperatureConverterSOAP12Binding">
<soap12:address location="http://172.16.33.1:8080/axis2.war/services/
TemperatureConverter"/>
</wsdl:port>
-
<wsdl:port name="TemperatureConverterHttpport"
binding="axis2:TemperatureConverterHttpBinding">
<http:address location="http://172.16.33.1:8080/axis2.war/services/
TemperatureConverter"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to