suds-py3 icon indicating copy to clipboard operation
suds-py3 copied to clipboard

importing `suds.Object` class in mx.literal results in `TypeNotFound` later

Open papaben opened this issue 4 years ago • 0 comments

Hi, Thank you for maintaining this very useful library! I'm encountering the following situation and have discovered a workaround. However, I believe that either I am just too ignorant of WSDL or that there may be an unwanted condition in the code. I'm simultaneously curious how it could be the case that this is an issue since it's been present since November 2015.

The situation

  1. I am working with a SOAP service publishing this WSDL.
  2. I am creating a Subscriber object (WSDL line 2064) using the suds.client.Client.factory.create() instance method.
  3. The factory returns a suds.sudsobjects.Object instance
  4. I then pass this object through to a Service method call
  5. Later on, when trying to build the bodycontent, the binding marshaller (a mx.literal.Literal in this case) attempts to "start" the object.
    1. The start method checks if the content value is a suds.Object instance.
    2. However, it is not. It is the suds.sudsobjects.Object from step 3.
    3. The result of this is that the GraphResolver is not appropriately configured with the known type for the Subscriber.
  6. Future attempts to resolve elements declared in the Subscriber (but not the base APIObject type) will fail with TypeNotFound.

The patch

To get around this, I added the following code to my initialization code. I'm unfamiliar with the code and I have no idea what other issues this could cause. I searched through the suds codebase and see very few references to Object, and this one in literal.py appears to be the only one to suds.Object.

from suds.sudsobject import Object as ActualObject
import suds.mx.literal
suds.mx.literal.Object = ActualObject

What Next?

If this is not an issue, but my own ignorance, then that's great! I'm sorry for taking up your time! If not, I hope this issue report was helpful.

papaben avatar Jun 04 '20 02:06 papaben