We created an XmlAttribute parameter called attribute_of for providing
primitive type support.
For example when you want to recieve a mesaage like this

<ns0:some_callResponse xmlns:ns0="tns">
  <ns0:some_callResult>
    <ns0:b c="bar">foo</ns0:b>
  </ns0:some_callResult>
</ns0:some_callResponse>

A model service pair like that will do the trick
(This example is taken from the test case of this feature )

class a(ComplexModel):
    b = Unicode
    c = XmlAttribute(Unicode, ns="spam", attribute_of="b")

class SomeService(ServiceBase):
    @srpc(_returns=a)
    def some_call():
        return a(b="foo",c="bar")

For source code of this feature you can see
https://github.com/arskom/spyne/pull/161


2012/11/20 KulaPard <[email protected]>

> Hello
> Can you please help me?
>
> I need to realise this part of web-service:
> ----------------------------------------
> <xs:element name="Params" minOccurs="0">
>     <xs:complexType>
>         <xs:sequence>
>             <xs:element maxOccurs="unbounded" minOccurs="0" name="Param">
>                 <xs:complexType>
>                     <xs:simpleContent>
>                         <xs:extension base="xs:string">
>                             <xs:attribute name="name" type="xs:string"/>
>                         </xs:extension>
>                     </xs:simpleContent>
>                 </xs:complexType>
>             </xs:element>
>         </xs:sequence>
>     </xs:complexType>
> </xs:element>
> ----------------------------------------
> to recieve message like this:
> ----------------------------------------
> <ns1:Params>
>     <ns1:Param ns1:name="firstname">Blabla</ns1:Param>
>     <ns1:Param ns1:name="lastname">Blabovich</ns1:Param>
>     <ns1:Param ns1:name="age">20</ns1:Param>
> </ns1:Params>
> ----------------------------------------
> I tried to use Spyne with XmlAttribute, but it do not support primitive
> types yet.
> Any ideas how to realise this functionality? Maybe you can advise me other
> libraries?
> Maybe some hacks or tricks with Spyne?
>
> Sorry for bad english :)
> Taras
>
> _______________________________________________
> Soap mailing list
> [email protected]
> http://mail.python.org/mailman/listinfo/soap
>
>
_______________________________________________
Soap mailing list
[email protected]
http://mail.python.org/mailman/listinfo/soap

Reply via email to