On 03/15/2013 12:36 PM, Charlie Benton wrote:
I have the following web service defined using Spyne.

class CapsWebService(ServiceBase):
     @rpc(String, Integer, _returns=Iterable(String))
     def SayHello(ctx, name, times):
         for i in xrange(times):
             yield 'Hello, %s' % name

The corresponding WSDL generated for the web services inputs is:

<wsdl:types>
<xs:schematargetNamespace="solutions.sfcs"elementFormDefault="qualified">
<xs:complexTypename="SayHello">
<xs:sequence>
<xs:elementname="name"type="xs:string"minOccurs="0"nillable="true"/>
<xs:elementname="times"type="xs:integer"minOccurs="0"nillable="true"/>
</xs:sequence>
</xs:complexType>

Why are these inputs being wrapped in a complexType? This forces me to
consume the web service in .NET using the following statement:

SayHelloResponse response = client.SayHello(new SayHello() { name =
"Dave", times = "5" });

As opposed to:

SayHelloResponse response = client.SayHello("Dave", "5");

Is there a way to stop Spyne from wrapping the inputs? Am I doing
something wrong in either python or .NE that's forcing me to use the
longer more cludgey .NET statement to consume the web service?

I could be off-base here, but I think this is expected when using `Document`-style SOAP messages as opposed to `RPC`-style... IMO, RPC is annoying because it makes you take argument order into account.

I normally do something like:

sig = api.signature('SayHello')
sig.SayHelloRequest.name = 'Dave'
sig.SayHelloRequest.times = 5
response = sig()

...the above is the exact code i'd write using a small/custom wrapper around the Python SUDS library (technically, i could have passed name/times as keyword args to `signature`, but the above is more explicit).

--

C Anthony

-----------------------------------------
CONFIDENTIALITY: The information contained in this communication may be 
confidential and is intended only for the use of the intended recipient(s). If 
the reader of this message is not the intended recipient(s), you are hereby 
notified that
any dissemination, distribution, or copying of this communication, or any of 
its contents, is strictly prohibited. If you have received this communication 
in error, please return it to the sender immediately and delete any copy of it 
from your computer system.
_______________________________________________
Soap mailing list
[email protected]
http://mail.python.org/mailman/listinfo/soap

Reply via email to