0

I'm using spyne 2.11 with Django 1.4 and I'm trying to emulate an Apache Axis 1.4 Web Service.

My WS client is suds, and I'm receiving WS requests with bare body, i.e., argument is not wrapped in a in-message and the "SOAPAction" http header.

Although I specify explicitly _operation_name un srpc decorator, and _body_style='bare', Spyne does not recognize the operation. It still tries to get the operation name from the first child of element.

How can I instruct spine to:

  1. take into account SOAPHeader as operation_name
  2. consider the first child of SOAP-Env:Body as function / operation argument?
erny
  • 1,296
  • 1
  • 13
  • 28

1 Answers1

0

I found the following solution for this:

class MySoap11(Soap11):

  def decompose_incoming_envelope(self, ctx, message=XmlDocument.REQUEST):
      res = super(MySoap11, self).decompose_incoming_envelope(ctx, message)
      method = ctx.transport.req['HTTP_SOAPACTION']
      method = method.replace('"', '')
      ctx.method_request_string = method
      return res

Then use "MySoap11" when instantiating the application, e.g.:

application = Application(..., in_protocol=MySoap11(validator='soft'), ...)

But I still have to use _body_style='bare' in sprc decorator, e.g.:

@srpc(
    SomeComplexModel,       # noqa
    _returns=ResponseComplexModel,
    _body_style='bare',
)
def myMethod(param):
    ....

This seems to work with spyne 2.12.11 and 2.11.0.

erny
  • 1,296
  • 1
  • 13
  • 28