python-zeep icon indicating copy to clipboard operation
python-zeep copied to clipboard

'Schema' object has no attribute 'render'

Open emad-ir opened this issue 5 years ago • 2 comments

Like most people I am new to SOAP. Im currently trying to make update request to a SOAP server, and according to our client there is no one to change or maintain this server.

You can assume that the connection to the SOAP server works fine and I can make requests to GET data but have not managed to get any UPDATE call working.

  1. Im using Zeep version 3.4.0
  2. The relevant WSDL for the update call
<s:element name="UpdateLocalJobCardHistory">
    <s:complexType>
        <s:sequence>
            <s:element minOccurs="0" maxOccurs="1" name="key" type="s:string"/>
            <s:element minOccurs="0" maxOccurs="1" name="technicianID" type="s:string"/>
            <s:element minOccurs="0" maxOccurs="1" name="jobcardHistory">
                <s:complexType>
                    <s:sequence>
                        <s:element ref="s:schema"/>
                        <s:any/>
                    </s:sequence>
                </s:complexType>
            </s:element>
            <s:element minOccurs="0" maxOccurs="1" name="message" type="s:string"/>
        </s:sequence>
    </s:complexType>
</s:element>
....
<s:complexType name="ArrayOfJobCardsEnt">
    <s:sequence>
        <s:element minOccurs="0" maxOccurs="unbounded" name="JobCardsEnt" nillable="true">
            <s:complexType>
                <s:sequence>
                    <s:element ref="s:schema"/>
                    <s:any/>
                </s:sequence>
            </s:complexType>
        </s:element>
    </s:sequence>
</s:complexType>
  1. Here is what I have tried, and the respective responses I've got

Here are some print values that might be necessary job_card_type = self.client.get_type('ns0:ArrayOfJobCardsEnt') print(job_card_type) print value is: ArrayOfJobCardsEnt({http://tempuri.org/}ArrayOfJobCardsEnt(JobCardsEnt: {schema: , _value_1: ANY}[]))

Try 1

from zeep import AnyObject

job_card_type = client.get_type('ns0:ArrayOfJobCardsEnt')
obj = AnyObject(job_card_type, {
      'id':"some_id",
      'jobcardid': "some_id",
      'jobcardnumber': "some_number",
      'TypeID': "some_type_id",
      'newstatus': "new_status",
      'comment': "Testing",
      'statuschange': True,
      'systemdescription': "new_status",
      'datetimestamp': "2019-12-20T10:12:45Z"
})

response_body = self.client.service.UpdateLocalJobCardHistory(
    key= "some_valid_key",
    technicianID= "some_valid_tech_id",
    jobcardHistory=obj,
    message=""
 )

Response for this try is : 'Schema' object has no attribute 'render'

Try 2

job_card_type = client.get_type('ns0:ArrayOfJobCardsEnt')
obj = job_card_type({
      'id':"some_id",
      'jobcardid': "some_id",
      'jobcardnumber': "some_number",
      'TypeID': "some_type_id",
      'newstatus': "new_status",
      'comment': "Testing",
      'statuschange': True,
      'systemdescription': "new_status",
      'datetimestamp': "2019-12-20T10:12:45Z"
})
response_body = self.client.service.UpdateLocalJobCardHistory(
    key= "some_valid_key",
    technicianID= "some_valid_tech_id",
    jobcardHistory=obj,
    message=""
 )

Response for this try is : 'Schema' object has no attribute 'render'

Try 3 When I try to print the create_message like so

node = self.client.create_message(
   client.service, 
    'UpdateLocalJobCardHistory', 
    key= "some_valid_key",
    technicianID="some_valid_tech_id",
    jobcardHistory=obj,
    message=""
)

Response for this try is also : 'Schema' object has no attribute 'render'

I would appreciate if anyone could help me with this request because I've been stuck on this for a while now :(

emad-ir avatar Dec 17 '19 12:12 emad-ir

@mvantellingen will you please just have a look at this

emad-ir avatar Jan 17 '20 13:01 emad-ir

Is there any update on this issue? I am facing the same problem :(

mouslim97 avatar Jul 06 '23 14:07 mouslim97