[spyne] Make SOAP webservice compatible with existing clients

Burak Arslan burak.arslan at arskom.com.tr
Wed May 6 09:55:33 UTC 2015


Hello Quentin,

Could you please provide the XML document that you want Spyne to parse?

Best regards,
Burak

On 05/06/15 12:49, Quentin wrote:
> Hello,
>
> I am creating a webservice that has to be compatible with existing clients.
> The clients already work with another implementation of the same service. The
> goal is to make my webservice as similar to the other implementation as
> possible, so that the clients do not have to be modified to use my version of
> the service.
>
> This is not the case at the moment. One of the client developers let me know 
> they call one of the webservice functions like this:
>
>     var response = wcf.getData(user.Username, user.Password);
>
> This works with the other implementation, but not with mine. However the 
> following does work with my implementation:
>
>     var responseResult = wcf.getData(new getData{password = user.Password, user = user.Username});
>     var response = responseResult.getDataResult;
>
> It seems both the input and the output variables are wrapped in an extra
> object.
>
> My code for this function looks like this:
>
>     class WebService(ServiceBase):
>         @rpc(String(min_occurs=0, max_occurs=1, nillable=False),
>              String(min_occurs=0, max_occurs=1, nillable=False),
>              _returns=Unicode)
>         def getData(self, login, password):
>             return u'data'
>
>     application = Application([WebService],
>                               "http://example.com/",
>                               in_protocol=Soap11(validator='lxml'),
>                               out_protocol=Soap11())
>
> Does anyone know how I could change my service so the client can call this
> function like in the first example above?
>
> At first I thought the problem was a difference between my service's WSDL and
> that of the existing ones, but Burak was so kind to point out that both forms
> are valid [1].
>
> I also wrote a small client using suds to test this behavior, but could not
> reproduce the problem. Using suds I can just call the function without wrapping 
> the parameter in an extra object:
>
>     from suds.client import Client
>     client = Client("http://webservice.example.com/?wsdl").service
>     data = client.getData(user, password)
>
>
> Regards,
> Quentin
>
> [1] http://stackoverflow.com/questions/29943275/wrap-function-parameters-complextype-in-an-element
> _______________________________________________
> Spyne community mailing list
> people at spyne.io
> http://lists.spyne.io/listinfo/people



More information about the people mailing list