Giter VIP home page Giter VIP logo

Comments (7)

c-engelhardt-ecoservice avatar c-engelhardt-ecoservice commented on May 10, 2024

Hi,
I have the same issue with the anyType:

Traceback (most recent call last):
  File "soap_connection.py", line 161, in sync_soap_object
    zeep_response = zeep_client.service.GetExamName(ATO_ID=connection.ato_id, ATO_KEY=connection.ato_key)
  File "/usr/lib/python2.7/site-packages/zeep/client.py", line 24, in __call__
    self._proxy._client, self._op_name, args, kwargs)
  File "/usr/lib/python2.7/site-packages/zeep/wsdl/definitions.py", line 298, in send
    client, self.binding_options, operation, args, kwargs)
  File "/usr/lib/python2.7/site-packages/zeep/wsdl/soap.py", line 99, in send
    return self.process_reply(client, operation_obj, response)
  File "/usr/lib/python2.7/site-packages/zeep/wsdl/soap.py", line 134, in process_reply
    doc = operation.process_reply(doc)
  File "/usr/lib/python2.7/site-packages/zeep/wsdl/soap.py", line 265, in process_reply
    return self.output.deserialize(node)
  File "/usr/lib/python2.7/site-packages/zeep/wsdl/messages.py", line 205, in deserialize
    result.append(part.element.parse(elm, self.wsdl.schema))
  File "/usr/lib/python2.7/site-packages/zeep/xsd/elements.py", line 128, in parse
    return self.type.parse_xmlelement(value, schema)
  File "/usr/lib/python2.7/site-packages/zeep/xsd/types.py", line 255, in parse_xmlelement
    result = field.parse(element, schema)
  File "/usr/lib/python2.7/site-packages/zeep/xsd/elements.py", line 128, in parse
    return self.type.parse_xmlelement(value, schema)
  File "/usr/lib/python2.7/site-packages/zeep/xsd/types.py", line 242, in parse_xmlelement
    while field and field.qname != element.tag:
AttributeError: 'Any' object has no attribute 'qname'

from python-zeep.

dddtc2005 avatar dddtc2005 commented on May 10, 2024

Also, a related issue maybe.

I found that the choice_element has to be included, otherwise it fails.

for example if I use:

motype = 'EPSMultiSC@http://schemas.example.com/ma/HSS/'
moid = {'imsi': imsi}
moattr = {'CreateEPSMultiSC': {'imsi': imsi, 'msisdn': msisdn, 'epsProfileId': 'example_profile'}}
mesg = soapclient.service._binding.create_message('Create', motype, moid, moattr, _soapheader=sessionid)
logging.debug('EPSMultiSC Create request for IMSI %s: ', imsi)
logging.debug(etree.tostring(mesg, pretty_print=True))

Then I got the following errors:

Traceback (most recent call last):
  File "test1.py", line 100, in epsmultisc_create
    mesg = soapclient.service._binding.create_message('Create', motype, moid, moattr, _soapheader=sessionid)
  File "/usr/lib/python2.7/site-packages/zeep-0.9.0.dev0-py2.7.egg/zeep/wsdl/soap.py", line 56, in create_message
    serialized = operation.create(*args, **kwargs)
  File "/usr/lib/python2.7/site-packages/zeep-0.9.0.dev0-py2.7.egg/zeep/wsdl/definitions.py", line 245, in create
    return self.input.serialize(*args, **kwargs)
  File "/usr/lib/python2.7/site-packages/zeep-0.9.0.dev0-py2.7.egg/zeep/wsdl/messages.py", line 74, in serialize
    self.body.render(body, body_value)
  File "/usr/lib/python2.7/site-packages/zeep-0.9.0.dev0-py2.7.egg/zeep/xsd/elements.py", line 127, in render
    return self.type.render(node, value)
  File "/usr/lib/python2.7/site-packages/zeep-0.9.0.dev0-py2.7.egg/zeep/xsd/types.py", line 172, in render
    element.render(parent, sub_value)
  File "/usr/lib/python2.7/site-packages/zeep-0.9.0.dev0-py2.7.egg/zeep/xsd/elements.py", line 127, in render
    return self.type.render(node, value)
  File "/usr/lib/python2.7/site-packages/zeep-0.9.0.dev0-py2.7.egg/zeep/xsd/types.py", line 172, in render
    element.render(parent, sub_value)
  File "/usr/lib/python2.7/site-packages/zeep-0.9.0.dev0-py2.7.egg/zeep/xsd/elements.py", line 127, in render
    return self.type.render(node, value)
  File "/usr/lib/python2.7/site-packages/zeep-0.9.0.dev0-py2.7.egg/zeep/xsd/types.py", line 169, in render
    element.render(parent, name, value)
  File "/usr/lib/python2.7/site-packages/zeep-0.9.0.dev0-py2.7.egg/zeep/xsd/elements.py", line 221, in render
    choice_value = item.values.get(choice_element.name)
AttributeError: 'list' object has no attribute 'get'

But if I include all the choice_element into the request, then it can be passed correctly.

moattr = {'CreateEPSMultiSC': {'imsi': imsi, 'msisdn': msisdn, 'epsProfileId': 'HSS-EsmProfile_Default', 'epsExtendedAccessRestriction': '32', 'commonMsisdn': msisdn}}

And in the xsd it defines the two choice_element as:

<xs:element name="CreateEPSMultiSC">
        <xs:complexType>
            <xs:sequence>
                <xs:element name="imsi" type="imsiType"/>
                <xs:element minOccurs="0" name="msisdn" type="msisdnType"/>
                <xs:element minOccurs="0" name="associationId" type="associationIdType"/>
                <xs:element name="epsProfileId" type="epsProfileIdType"/>
                <xs:element minOccurs="0" name="epsOdb" type="epsOdbType"/>
                <xs:element minOccurs="0" name="epsRoamingAllowed" type="epsRoamingAllowedType"/>
                <xs:element minOccurs="0" name="epsIndividualApnOperatorIdentifierReplacement" type="epsIndividualApnOperatorIdentifierReplacementType"/>
                <xs:element minOccurs="0" name="epsIndividualDefaultContextId" type="epsIndividualDefaultContextIdType"/>
                <xs:element maxOccurs="unbounded" minOccurs="0" name="epsIndividualContextId" type="epsIndividualContextIdType"/>
                <xs:element minOccurs="0" name="epsIndividualSubscribedChargingCharacteristic" type="epsIndividualSubscribedChargingCharacteristicType"/>
                <xs:element minOccurs="0" name="epsIndividualAmbrMaximalUplinkIpFlow" type="epsIndividualAmbrMaximalUplinkIpFlowType"/>
                <xs:element minOccurs="0" name="epsIndividualAmbrMaximalDownlinkIpFlow" type="epsIndividualAmbrMaximalDownlinkIpFlowType"/>
                <xs:element minOccurs="0" name="epsIndividualRatFrequencyPriorityId" type="epsIndividualRatFrequencyPriorityIdType"/>
                <xs:element maxOccurs="unbounded" minOccurs="0" name="epsIndividualMappingContextId" type="epsIndividualMappingContextIdType"/>
                <xs:element minOccurs="0" name="epsRoamingRestriction" type="epsRoamingRestrictionType"/>

                <xs:choice minOccurs="0">
                    <xs:element name="epsAccessRestriction" type="epsAccessRestrictionType"/>
                    <xs:element name="epsExtendedAccessRestriction" type="epsExtendedAccessRestrictionType"/>
                </xs:choice>
                <xs:element maxOccurs="unbounded" minOccurs="0" name="epsUserIpV4Address" type="epsUserIpV4AddressType"/>
                <xs:element maxOccurs="unbounded" minOccurs="0" name="epsUserIpV6Address" type="epsUserIpV6AddressType"/>
                <xs:element minOccurs="0" name="epsTenantId" type="epsTenantIdType"/>
                <xs:element minOccurs="0" name="epsSessionTransferNumber" type="epsSessionTransferNumberType"/>
                <xs:element minOccurs="0" name="epsMultimediaPriorityService" type="epsMultimediaPriorityServiceType"/>
                <xs:element minOccurs="0" name="epsZoneCodeSetId" type="epsZoneCodeSetIdType"/>
                <xs:choice minOccurs="0">
                    <xs:element name="epsCommonMsisdn" nillable="true" type="epsCommonMsisdnType"/>
                    <xs:element name="commonMsisdn" nillable="true" type="epsCommonMsisdnType"/>
                </xs:choice>
            </xs:sequence>
            <xs:attribute name="imsi" type="imsiType" use="required">
                <xs:annotation>
                    <xs:appinfo>
                        <jaxb:property name="imsiAttr"/>
                    </xs:appinfo>
                </xs:annotation>
            </xs:attribute>
        </xs:complexType>
        <xs:key name="key_imsi">
            <xs:selector xpath="./x:imsi"/>
            <xs:field xpath="."/>
        </xs:key>
        <xs:keyref name="keyref_imsi" refer="key_imsi">
            <xs:selector xpath="."/>
            <xs:field xpath="@imsi"/>
        </xs:keyref>
    </xs:element>

The xsd and wsdl already attached above

from python-zeep.

mvantellingen avatar mvantellingen commented on May 10, 2024

Thanks, I didn't give the parsing of any and choice elements as much attention as the serializing of the values to xml. I'll dive into this asap.

from python-zeep.

mvantellingen avatar mvantellingen commented on May 10, 2024

hi @dddtc2005, can you give the master branch a try? I've just refactored the logic to parse choice elements.

@c-engelhardt-ecoservice can you open a new issue for this and include an example?

from python-zeep.

mvantellingen avatar mvantellingen commented on May 10, 2024

@dddtc2005 If the second issue is not solved with this, can you then open a separate issue for this? Bit hard for me to keep track of the issues if various different problems are lumped together in one issue

Thanks!

from python-zeep.

dddtc2005 avatar dddtc2005 commented on May 10, 2024

Thanks! Verified the first issue and it's now working. The second one I've opened a new issue, please take a look here: #74

Thanks for the great work :)

from python-zeep.

c-engelhardt-ecoservice avatar c-engelhardt-ecoservice commented on May 10, 2024

Sure! You can find it here: #75

from python-zeep.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.