Hi,

Just in case someone ever runs across the same problem: here's
a workaround!

the problem does seem to be on the SOAPpy  encoding side: as soon as I
convert the received
structType to a regular dictionary and pass that one back on the wire all
is well...

E.g.
newDict = { 'key' : receivedStruct['key'], ... }

Thanks, dims, for pointing me in the direction of the Arrays...

If any one has experience with SOAPpy and knows of a cleaner way
to do this or what the underlying problem is, please share :-D.

Thanks,
- Filip


> Hi Dims,
>
> You are right.
>
> This is the initial response from axis to python:
>
> HTTP/1.0 200 OK
>
> Content-Type: text/xml; charset=utf-8
>
> Content-Length: 1606
>
>
>
> <?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope
> xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/";
> xmlns:xsd="http://www.w3.org/1999/XMLSchema";
> xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance";>
>  <soapenv:Body>
>   <beginResponse
> soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/";>
>    <beginReturn xsi:type="ns1:ExternalNote" xmlns:ns1="ExternalNote">
>     <audience xsi:type="soapenc:string"
> xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/";></audience>
>     <author xsi:type="soapenc:string" xsi:null="true"
> xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"/>
>     <content xsi:type="soapenc:string"
> xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/";></content>
>     <createdOn xsi:type="soapenc:string"
> xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/";>1130988239460</createdOn>
>     <id xsi:type="soapenc:string"
> xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/";>5426fa617f00000200c28cb7a436fccf</id>
>     <node xsi:type="soapenc:string"
> xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/";>shw:TinkPrana</node>
>     <priority xsi:type="soapenc:string"
> xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/";>-</priority>
>     <thumbnailPath xsi:type="soapenc:string"
> xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/";></thumbnailPath>
>     <type xsi:type="soapenc:string"
> xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/";></type>
>     <typist xsi:type="soapenc:string" xsi:null="true"
> xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"/>
>    </beginReturn>
>   </beginResponse>
>  </soapenv:Body>
> </soapenv:Envelope>
>
> subsequently from python to axis we get:
>
> POST /axis/services/NoteManager HTTP/1.0
>
> Host: 127.0.0.1:1234
>
> User-agent: SOAPpy 0.11.6 (pywebsvcs.sf.net)
>
> Content-type: text/xml; charset="UTF-8"
>
> Content-length: 1593
>
> SOAPAction: "commit"
>
>
>
> <?xml version="1.0" encoding="UTF-8"?>
> <SOAP-ENV:Envelope
> SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/";
> xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/";
> xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance";
> xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/";
> xmlns:xsd="http://www.w3.org/1999/XMLSchema";>
> <SOAP-ENV:Body>
> <commit SOAP-ENC:root="1">
> <v1 href="#i1"/>
> <beginReturn href="#i2"/>
> </commit>
> <v1 xsi:type="xsd:string" id="i1" SOAP-ENC:root="0">shw:TinkPrana</v1>
> <xsd:beginReturn id="i2" SOAP-ENC:root="0">
> <audience href="#i3"/>
> <author xsi:null="1"/>
> <content href="#i4"/>
> <createdOn href="#i5"/>
> <id href="#i6"/>
> <node href="#i7"/>
> <priority href="#i8"/>
> <thumbnailPath href="#i4"/>
> <type href="#i4"/>
> <typist xsi:null="1"/>
> </xsd:beginReturn>
> <audience SOAP-ENC:arrayType="xsd:ur-type[10]" xsi:type="SOAP-ENC:Array"
> SOAP-ENC:root="0" id="i3">
> <item href="#i9"/>
> <item xsi:null="1"/>
> <item href="#i4"/>
> <item href="#i5"/>
> <item href="#i6"/>
> <item href="#i7"/>
> <item href="#i8"/>
> <item href="#i4"/>
> <item href="#i4"/>
> <item xsi:null="1"/>
> </audience>
> <content xsi:type="xsd:string" id="i4" SOAP-ENC:root="0"></content>
> <createdOn xsi:type="xsd:string" id="i5"
> SOAP-ENC:root="0">1130988239460</createdOn>
> <id xsi:type="xsd:string" id="i6"
> SOAP-ENC:root="0">5426fa617f00000200c28cb7a436fccf</id>
> <node xsi:type="xsd:string" id="i7" SOAP-ENC:root="0">shw:TinkPrana</node>
> <priority xsi:type="xsd:string" id="i8" SOAP-ENC:root="0">-</priority>
> <item xsi:type="xsd:string" id="i9" SOAP-ENC:root="0">test</item>
> </SOAP-ENV:Body>
> </SOAP-ENV:Envelope>
>
> So, indeed we are getting a array encoding. My suspicion
> is that this is because I'm sending the
>
>     <audience xsi:type="soapenc:string"
>
> iso
>
>     <audience xsi:type="xsd:string"
>
> Do you know if that's true + if there's a way to change it
> from soapenc to xsd:string ?
>
> Thanks,
> - Filip
>
>
>
>
>> Check the contents of the soap request it seems to be sending an array
> of strings which is why the array serializer is being invoked.
>> (problem with SOAPPy?). Try a sample client (generate one by running
> WSDL2Java) and compare the 2 requests.
>>
>> thanks,
>> dims
>>
>> On 11/2/05, [EMAIL PROTECTED] <[EMAIL PROTECTED]>
>> wrote:
>>> Hi,
>>>
>>> I found a couple more pointers that hopefully will trigger
>>> the solution in someone's mind:
>>>
>>> The client (I'm using Python and SOAPpy) gets the following
>>> exception:
>>>
>>> Server.userException: java.lang.IllegalArgumentException: argument type
> mismatch: <SOAPpy.Types.structType detail at 1081742604>:
> {'stackTrace': 'java.lang.IllegalArgumentException: argument type
> mismatch\n\tat sun.reflect.NativeMethodAccessorImpl.invoke0(Native
> Method)\n\tat
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)\n\tat
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)\n\tat
> java.lang.reflect.Method.invoke(Method.java:585)\n\tat
>>> org.apache.axis.utils.BeanPropertyDescriptor.set(BeanPropertyDescriptor.java:142)\n\tat
> org.apache.axis.encoding.ser.BeanPropertyTarget.set(BeanPropertyTarget.java:75)\n\tat
> org.apache.axis.encoding.DeserializerImpl.valueComplete(DeserializerImpl.java:249)\n\tat
> org.apache.axis.encoding.ser.ArrayDeserializer.valueComplete(ArrayDeserializer.java:583)\n\tat
> org.apache.axis.encoding.DeserializerImpl.endElement(DeserializerImpl.java:509)\n\tat
> org.apache.axis.encoding.DeserializationContext.endElement(DeserializationContext.java:1087)
>>>
>>>
>>> What I'm surprised about is to find here a reference to the
>>> ArrayDeserializer here -- I don't think this one should be
>>> used...
>>>
>>> Apart from that, I also find that the parameters are described
>>> with soapenc:string iso xsd:string in the wsdl file that's generated
> from axis automatically:
>>>
>>>    <complexType name="ExternalNote">
>>>     <sequence>
>>>      <element name="audience" nillable="true" type="soapenc:string"/>
> <element name="author" nillable="true" type="soapenc:string"/>
> <element name="content" nillable="true" type="soapenc:string"/>
> <element name="createdOn" nillable="true" type="soapenc:string"/>
> <element name="id" nillable="true" type="soapenc:string"/>
> <element name="node" nillable="true" type="soapenc:string"/>
> <element name="priority" nillable="true" type="soapenc:string"/>
> <element name="thumbnailPath" nillable="true"
>>> type="soapenc:string"/>
>>>      <element name="type" nillable="true" type="soapenc:string"/>
> <element name="typist" nillable="true" type="soapenc:string"/>
>>>     </sequence>
>>>    </complexType>
>>>
>>> Anybody any thoughts where I could look next ?
>>>
>>> Thanks!
>>> - Filip
>>>
>>>
>>>
>>>
>>> > Hi Axis'ers,
>>> >
>>> > I'm trying to embed Axis in an application and have my own
>>> > provider set up and attach services to it like so:
>>> >
>>> > ...
>>> >         m_provider = new SimpleProvider();
>>> >
>>> >         TypeMapping tm;
>>> >         try {
>>> >             tm =
>>> m_provider.getTypeMappingRegistry().createTypeMapping();
>>> >
>>> >             n = new QName("ExternalNote", "ExternalNote");
>>> >
>>> >             tm.register(ExternalNote.class, n,
>>> >                     new BeanSerializerFactory(ExternalNote.class, n),
> new BeanDeserializerFactory(ExternalNote.class,
>>> n));
>>> >
>>> >             m_provider.getTypeMappingRegistry().register(
>>> >                     "http://schemas.xmlsoap.org/soap/encoding/";, tm);
>>> >
>>> >         } catch (org.apache.axis.ConfigurationException e) {
>>> >             throw new ConfigurationException(e.getMessage(), e);
>>> >         }
>>> >
>>> >         Configuration[] serviceConfs = conf.getChildren("service");
>>> >
>>> >         for (int i = 0; i < serviceConfs.length; i++) {
>>> >             Configuration sConf = serviceConfs[i];
>>> >
>>> >             AvalonProvider p = new AvalonProvider(m_serviceManager);
>>> >
>>> >             SOAPService s = new SOAPService(p);
>>> >
>>> >             s.getServiceDescription().setName(sConf.getAttribute("id"));
> s.setOption("className", sConf.getAttribute("impl"));
> s.setOption("allowedMethods",
>>> > sConf.getAttribute("allowedMethods"));
>>> >
>>> >             ((SimpleProvider)
>>> > m_provider).deployService(sConf.getAttribute("id"), s);
>>> >         }
>>> > ...
>>> >
>>> > All this works great; but I'm running into the following
>>> > snag passing ExternalNote object back into Axis (the
>>> > serialization process works well); Axis says:
>>> >
>>> > Nov 2, 2005 4:17:59 PM
>>> org.apache.axis.encoding.ser.BeanPropertyTarget
>>> set
>>> > SEVERE: Could not convert
>>> > org.apache.axis.encoding.ser.ArrayDeserializer$ArrayListExtension to
>>> bean
>>> > field 'audience', type java.lang.String
>>> >
>>> > (audience is a simple String member of the ExternalNote class).
>>> >
>>> > Can anybody point me to where I'm going wrong? It seems
>>> > that I'm doing something incorrectly in the typemappingregistry but I
> can't find enough documentation about it to really
>>> > figure out how to do it correctly (most of the examples
>>> > assume starting from wsdl).
>>> >
>>> > I'd be very greateful for any hints!
>>> >
>>> > Thanks in advance,
>>> >
>>> > - Filip
>>> >
>>> >
>>> >
>>> >
>>>
>>>
>>
>>
>> --
>> Davanum Srinivas : http://wso2.com/blogs/
>>
>
>
>
>
>
>

Reply via email to