2

I'm trying to use Spyne to provide web services from Python. I have everything working for a test function called SayHello(name, times). However, I'm wondering why Spyne wraps the name and times arguments in a complexType called SayHello? This makes consuming the web service in .NET much more cludgey (i.e. instead of appClient.SayHello("Dave", 5) I have to do SayHello args = new SayHello(); args.name = "Dave"; args.times = "5"; appClient.SayHello(args); which is very inelegant).

Is there a way to force Spyne not to wrap arguments in a complexType?

Here's the relevant portion of the current wsdl that Spyne generates:

<xs:schema targetNamespace="solutions.sfcs" elementFormDefault="qualified">
  <xs:complexType name="SayHello">
    <xs:sequence>
      <xs:element name="name" type="xs:string" minOccurs="0" nillable="true"/>
      <xs:element name="times" type="xs:integer" minOccurs="0" nillable="true"/>
    </xs:sequence>
  </xs:complexType>
Charlie
  • 151
  • 1
  • 1
  • 5

1 Answers1

2

You can pass _body_style='bare' to the @rpc decorator to prevent that wrapping. But you'll most likely get:

Exception: body_style='bare' can handle at most one function argument.

If you can fix this in a way that doesn't break other tests, I can merge your patch.

Burak Arslan
  • 7,671
  • 2
  • 15
  • 24
  • if YOU can fix this in a way that doesn't break other tests I'll give you this 50 pt bounty :) – Colleen Jun 28 '13 at 22:40
  • On a related note, I wonder if it has anything to do with the documentation being opposite the implementation? Comments on the `rpc` method in `decorators.py` say `soap_body_style=rpc`->`body_style = bare`, but the implementation is actually `soap_body_style=rpc`->`body_style = wrapped` – Colleen Jul 01 '13 at 16:46
  • unfortunately, just changing that doesn't seem to fix the issue. – Colleen Jul 19 '13 at 17:38