suds-community / suds

Suds is a lightweight SOAP python client for consuming Web Services. A community fork of the jurko fork.
https://suds.readthedocs.io/
GNU Lesser General Public License v3.0
173 stars 56 forks source link

What is "_WObject__resolved = False" and what is it's function in WSDL? #73

Closed 123firefem closed 2 years ago

123firefem commented 2 years ago

Hi

I am neither an IT-professional nor SOAP proficient, but have been using SUDS-jurko for some years to connect to a system.

We are trying to use newer versions of python, and still need to use suds. We were very happy to find this project, but struggle to interact via suds interpretation of WSDL due to the new entry _Wobject__resolved = False

For us, it means the suds.client.factory.create('GetByPathAndCode') does not return the values we expected.

I have tried to play around with the source a bit without getting any real progress and post it here in case it is an issue for others as well.

The wsdl is quite large, so for illustration I will post the difference between the two outputs I get from suds.client.wsdl and one operation:

python 3.10 and suds 1.0 Feedback from print(suds.client.wsdl):

 GetByPathAndCode = 
      (Operation){
         name = "GetByPathAndCode"
         tns[] = 
            "tns",
            "http://www.powel.com/TimeSeries/2013/01",
         input = 
            (Message){
               _WObject__resolved = True
               name = "TimeSeriesFullNameMessageContract"
               qname = "(TimeSeriesFullNameMessageContract, http://www.powel.com/TimeSeries/2013/01)"
               parts[] = 
                  (Part){
                     root = <wsdl:part name="parameters" element="tns:TimeSeriesFullNameMessageContract"/>
                     _WObject__resolved = False
                     name = "parameters"
                     qname[] = 
                        "parameters",
                        "http://www.powel.com/TimeSeries/2013/01",
                     element = "('TimeSeriesFullNameMessageContract', 'http://www.powel.com/TimeSeries/2013/01')"
                     type = "None"
                  },
            }
         output = 
            (Message){
               _WObject__resolved = True
               name = "TimeSeriesMessageContract"
               qname = "(TimeSeriesMessageContract, http://www.powel.com/TimeSeries/2013/01)"
               parts[] = 
                  (Part){
                     root = <wsdl:part name="parameters" element="tns:TimeSeriesMessageContract"/>
                     _WObject__resolved = False
                     name = "parameters"
                     qname[] = 
                        "parameters",
                        "http://www.powel.com/TimeSeries/2013/01",
                     element = "('TimeSeriesMessageContract', 'http://www.powel.com/TimeSeries/2013/01')"
                     type = "None"
                  },
            }
         faults[] = <empty>
      }

python 3.10 and suds 1.0 Feedback from client.factory.create('GetByPathAndCodesRequestDataContract'):

(GetByPathAndCodesRequestDataContract){
   Identities = None
 }

python 3.7 and suds-jurko 0.6: Feedback from print(suds.client.wsdl):

GetByPathAndCode = 
    (Operation){
       name = "GetByPathAndCode"
       tns[] = 
          "tns",
          "http://www.powel.com/TimeSeries/2013/01",
       input = 
          (Message){
             name = "TimeSeriesFullNameMessageContract"
             qname = "(TimeSeriesFullNameMessageContract, http://www.powel.com/TimeSeries/2013/01)"
             parts[] = 
                (Part){
                   root = <wsdl:part name="parameters" element="tns:TimeSeriesFullNameMessageContract"/>
                   name = "parameters"
                   qname[] = 
                      "parameters",
                      "http://www.powel.com/TimeSeries/2013/01",
                   element = "('TimeSeriesFullNameMessageContract', 'http://www.powel.com/TimeSeries/2013/01')"
                   type = "None"
                },
          }
       output = 
          (Message){
             name = "TimeSeriesMessageContract"
             qname = "(TimeSeriesMessageContract, http://www.powel.com/TimeSeries/2013/01)"
             parts[] = 
                (Part){
                   root = <wsdl:part name="parameters" element="tns:TimeSeriesMessageContract"/>
                   name = "parameters"
                   qname[] = 
                      "parameters",
                      "http://www.powel.com/TimeSeries/2013/01",
                   element = "('TimeSeriesMessageContract', 'http://www.powel.com/TimeSeries/2013/01')"
                   type = "None"
                },
          }
       faults[] = <empty>
    }

python 3.7 and suds-jurko 0.6: Feedback from client.factory.create('GetByPathAndCodesRequestDataContract')

(GetByPathAndCodesRequestDataContract){
   Identities = 
      (ArrayOfTimeSeriesFullNameDataContract){
         TimeSeriesFullNameDataContract[] = <empty>
      }
 }

Is there a way to make suds 1.0 behave in the same manner as suds-jurko in interpreting this wsdl or an approach to try to remove _WObject__resolved = False to see if that this is indeed the problem?

I can supply the full wsdl if it is of interest.

phillbaker commented 2 years ago

Hi - please review issue https://github.com/suds-community/suds/issues/67, which seems similar. I don't believe this is related to a new attribute appearing, but rather the handling of array objects.

Please see docs here: https://github.com/suds-community/suds#initializing-optional-arrays-with-lists

123firefem commented 2 years ago

Thank you for a very good reply.

It is indeed the same as issue #67. Reading this issue, we decided to do the resolving of complex sequence manually as this was assessed to be quite easy. It seems to be working well. It also makes the requests to the service a bit more verbatim, which is not a problem for us.