[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Ksoap: Cannot send complex type as method parameter


Cannot send complex type as method parameter

Hi!

I'm using a kSOAP 1.2 client and i'm having trouble executing a method 
that takes an object
of complex type as parameter:

method:
public void addSquareDetail(SquareDetail sd){//stuff}

-SquareDetail is a java bean class that implements KvmSerializable
- a mapping was added to classmap
-legacy namespace is not an issue (i AM able to execute the following 
methods successfully

over kSOAP):
-getting one SquareDetail object
-getting a vector of squareDetail objects

Here's how i'm trying to call the 'send' method:
    ClassMap classMap = new ClassMap();           
        classMap.addMapping("urn:SquareWebService/types", 
"SquareDetail", (new SquareDetail()).getClass());
   
            System.out.println("add one SquareDetail");
            request = new SoapObject(serviceURN, "addSquareDetail");
            sd = new SquareDetail();
            request.addProperty("SquareDetail_1", sd);           
            tx = new HttpTransport(this.endPointURL, "addSquareDetail");
            tx.debug = true;
            tx.setClassMap(classMap);
            tx.call(request); //exception here

(above:)

    private String endPointURL = 
"http://localhost:8080/SquareWebService/SquareWebService";;
    protected static final String serviceURN = "urn:SquareWebService/wsdl";

Error(from server, Sun ONE App Server7):
SoapFault - faultcode: 'env:Server' faultstring: 'Internal Server Error 
(deserialization
error: unexpected XML reader state. expected: END but found: START: 
someInt)' faultactor:
'null' detail: null
 


Here are request/response dumps:
-request---------
<SOAP-ENV:Envelope xmlns:n0="urn:SquareWebService/types"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xmlns:xsd="http://www.w3.org/2001/XMLSchema";
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/";
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/";>
 <SOAP-ENV:Body 
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/";>
  <addSquareDetail xmlns="urn:SquareWebService/wsdl" id="o0" 
SOAP-ENC:root="1">
   <SquareDetail_1 xmlns="" xsi:type="n0:SquareDetail">
    <someFloat xsi:type="SOAP-ENC:float">1.5</someFloat>
    <someInt xsi:type="xsd:int">-1</someInt>
    <someString xsi:type="xsd:string">someString from 
SquareDetail</someString>
    <propertyCount xsi:type="xsd:int">4</propertyCount>
   </SquareDetail_1>
  </addSquareDetail>
 </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

--response--------------
<?xml version="1.0" encoding="UTF-8"?>
<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/";
xmlns:xsd="http://www.w3.org/2001/XMLSchema";
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xmlns:enc="http://schemas.xmlsoap.org/soap/encoding/"; 
xmlns:ns0="urn:SquareWebService/types"
xmlns:ns1="http://java.sun.com/jax-rpc-ri/internal";
env:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/";><env:Body><env:Fault><faultcod
e>env:Server</faultcode><faultstring>Internal Server Error 
(deserialization error:
unexpected XML reader state. expected: END but found: START:
someInt)</faultstring></env:Fault></env:Body></env:Envelope>


So, apparently, the request message is not understood by the server. 
what exactly is it

missing, and how can i add/correct that? (my guess in SquareDetail_1 
xmlns="" should be

"urn:SquareWebService/types", although it's just a guess AND i don't 
know how to make kSOAP

get it in there)

I'm not sure what kind of SOAP parser my app server utilizes, but i'm 
guessing it's an

apache product (how can i tell?). I also have a WSDL file available, 
should anyone be

willing to look at it, please let me know

thanks
-nikita
-nikita