cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
2090
Views
3
Helpful
5
Replies

Invalid schema definition for GetRemoteDestinationReq in AXL 11.5

Jonathan Els
Level 5
Level 5

Hi,

AXL's GetRemoteDestinationReq is incorrectly applying a choice in axlapi:RLineAssociation within  axlapi:RRemoteDestination

<xsd:complexType name="GetRemoteDestinationReq">
  <xsd:sequence>
  <xsd:choice>
  <xsd:element maxOccurs="1" minOccurs="1" name="destination" nillable="false" type="xsd:string"/>
  <xsd:element name="uuid" type="axlapi:XUUID"/>
  </xsd:choice>
  <xsd:element minOccurs="0" name="returnedTags" type="axlapi:RRemoteDestination"/>
  </xsd:sequence>
  <xsd:attribute name="sequence" type="xsd:unsignedLong" use="optional"/>
</xsd:complexType>
<xsd:complexType name="GetRemoteDestinationRes">
  <xsd:complexContent>
  <xsd:extension base="axlapi:APIResponse">
  <xsd:sequence>
  <xsd:element name="return">
  <xsd:complexType>
  <xsd:sequence>
  <xsd:element name="remoteDestination" type="axlapi:RRemoteDestination"/>
  </xsd:sequence>
  </xsd:complexType>
  </xsd:element>
  </xsd:sequence>
  </xsd:extension>
  </xsd:complexContent>
</xsd:complexType>

This means that the returned statement has inherent dependencies as it will contain choice elements, and is going to fail on SOAP schema validators.  In this case, this happens on the line association:

<xsd:complexType name="RRemoteDestination">
  <xsd:sequence minOccurs="0">
  <xsd:element maxOccurs="1" minOccurs="0" name="name" type="xsd:string"/>
  <xsd:element maxOccurs="1" minOccurs="0" name="destination" type="xsd:string"/>
  <xsd:element maxOccurs="1" minOccurs="0" name="answerTooSoonTimer" type="axlapi:XInteger"/>
  <xsd:element maxOccurs="1" minOccurs="0" name="answerTooLateTimer" type="axlapi:XInteger"/>
  <xsd:element maxOccurs="1" minOccurs="0" name="delayBeforeRingingCell" type="axlapi:XInteger"/>
  <xsd:element maxOccurs="1" minOccurs="0" name="ownerUserId" type="axlapi:XFkType">
  <xsd:annotation>
  <xsd:documentation>From 10.5, to get proper value of this tag in get handler's response it is required to have value of todaccess, in case if user does not give any value in todaccesss tag, axl will insert a random row so that get handler response can return proper value of Owner User id</xsd:documentation>
  </xsd:annotation>
  </xsd:element>
  <xsd:element maxOccurs="1" minOccurs="0" name="remoteDestinationProfileName" type="axlapi:XFkType">
  <xsd:annotation>
  <xsd:documentation>If you are giving value to dualModeDeviceName then you can't give value to remoteDestinationProfileName,viceversa</xsd:documentation>
  </xsd:annotation>
  </xsd:element>
  <xsd:element maxOccurs="1" minOccurs="0" name="ctiRemoteDeviceName" type="axlapi:XFkType">
  <xsd:annotation>
  <xsd:documentation>ctiRemoteDeviceName tag will be used to associate either CTI Remote Device or a Spark Remote Device with a Remote Destination</xsd:documentation>
  </xsd:annotation>
  </xsd:element>
  <xsd:element maxOccurs="1" minOccurs="0" name="dualModeDeviceName" type="axlapi:XFkType"/>
  <xsd:element maxOccurs="1" minOccurs="0" name="isMobilePhone" type="axlapi:boolean"/>
  <xsd:element maxOccurs="1" minOccurs="0" name="enableMobileConnect" type="axlapi:boolean"/>
  <xsd:element maxOccurs="1" minOccurs="0" name="lineAssociations">
  <xsd:annotation>
  <xsd:documentation>The line association for this remote destination. The line to be associated must already be added to the remote destination profile. All directory numbers specified must already exist in the database.</xsd:documentation>
  </xsd:annotation>
  <xsd:complexType>
  <xsd:sequence minOccurs="0">
  <xsd:element maxOccurs="unbounded" minOccurs="0" name="lineAssociation" type="axlapi:RLineAssociation"/>
  </xsd:sequence>
  </xsd:complexType>

Here's the problematic choice:

<xsd:complexType name="RLineAssociation">
  <xsd:sequence minOccurs="0">
  <xsd:choice minOccurs="0">
  <xsd:element maxOccurs="1" minOccurs="0" name="uuid" type="axlapi:XUUID"/>
  <xsd:sequence minOccurs="0">
  <xsd:element maxOccurs="1" minOccurs="0" name="pattern" type="xsd:string">
  <xsd:annotation>
  <xsd:documentation>The directory number to be associated. This directory number must be already associated to remote destination profile. </xsd:documentation>
  </xsd:annotation>
  </xsd:element>
  <xsd:element maxOccurs="1" minOccurs="0" name="routePartitionName" type="axlapi:XFkType"/>
  </xsd:sequence>
  </xsd:choice>
  <xsd:element maxOccurs="1" minOccurs="0" name="index" type="axlapi:XInteger"/>
  </xsd:sequence>
</xsd:complexType>

This is a bug, as the response violates its own schema and sends back uuid, pattern and routePartitionName when the Remote Destination has a line association set.

I am using python-zeep, and am unable to get a response, as the AXL response is failing its own wsdl validation:

Traceback (most recent call last):

  File "C:/Users/jonathan.els/develop/pvt-repos/UCToolkit/examples/working.py", line 304, in <module>

    main()

  File "C:/Users/jonathan.els/develop/pvt-repos/UCToolkit/examples/working.py", line 76, in main

    print(axl.remote_destination.get(destination=1234123432))

  File "C:\Users\jonathan.els\develop\pvt-repos\UCToolkit\uctoolkit\api\base.py", line 183, in get

    return self._serialize_axl_object("get", **flatten_signature_args(self.get, locals()))

  File "C:\Users\jonathan.els\develop\pvt-repos\UCToolkit\uctoolkit\api\base.py", line 139, in _serialize_axl_object

    axl_resp = self._axl_methodcaller(action, **kwargs)

  File "C:\Users\jonathan.els\develop\pvt-repos\UCToolkit\uctoolkit\api\base.py", line 127, in _axl_methodcaller

    return axl_method(self.connector.service)

  File "C:\Users\jonathan.els\Envs\uctoolkit\lib\site-packages\zeep\client.py", line 45, in __call__

    self._op_name, args, kwargs)

  File "C:\Users\jonathan.els\Envs\uctoolkit\lib\site-packages\zeep\wsdl\bindings\soap.py", line 121, in send

    return self.process_reply(client, operation_obj, response)

  File "C:\Users\jonathan.els\Envs\uctoolkit\lib\site-packages\zeep\wsdl\bindings\soap.py", line 188, in process_reply

    result = operation.process_reply(doc)

  File "C:\Users\jonathan.els\Envs\uctoolkit\lib\site-packages\zeep\wsdl\bindings\soap.py", line 369, in process_reply

    return self.output.deserialize(envelope)

  File "C:\Users\jonathan.els\Envs\uctoolkit\lib\site-packages\zeep\wsdl\messages\soap.py", line 90, in deserialize

    body_result = self._deserialize_body(body)

  File "C:\Users\jonathan.els\Envs\uctoolkit\lib\site-packages\zeep\wsdl\messages\soap.py", line 411, in _deserialize_body

    result = self.body.parse(xmlelement, self.wsdl.types)

  File "C:\Users\jonathan.els\Envs\uctoolkit\lib\site-packages\zeep\xsd\elements\element.py", line 114, in parse

    schema_type=self.type)

  File "C:\Users\jonathan.els\Envs\uctoolkit\lib\site-packages\zeep\xsd\types\complex.py", line 169, in parse_xmlelement

    elements, schema, name, context=context)

  File "C:\Users\jonathan.els\Envs\uctoolkit\lib\site-packages\zeep\xsd\elements\indicators.py", line 600, in parse_xmlelements

    xmlelements, schema, name, context=context)

  File "C:\Users\jonathan.els\Envs\uctoolkit\lib\site-packages\zeep\xsd\elements\element.py", line 160, in parse_xmlelements

    xmlelement, schema, allow_none=True, context=context)

  File "C:\Users\jonathan.els\Envs\uctoolkit\lib\site-packages\zeep\xsd\elements\element.py", line 114, in parse

    schema_type=self.type)

  File "C:\Users\jonathan.els\Envs\uctoolkit\lib\site-packages\zeep\xsd\types\complex.py", line 169, in parse_xmlelement

    elements, schema, name, context=context)

  File "C:\Users\jonathan.els\Envs\uctoolkit\lib\site-packages\zeep\xsd\elements\indicators.py", line 600, in parse_xmlelements

    xmlelements, schema, name, context=context)

  File "C:\Users\jonathan.els\Envs\uctoolkit\lib\site-packages\zeep\xsd\elements\element.py", line 160, in parse_xmlelements

    xmlelement, schema, allow_none=True, context=context)

  File "C:\Users\jonathan.els\Envs\uctoolkit\lib\site-packages\zeep\xsd\elements\element.py", line 114, in parse

    schema_type=self.type)

  File "C:\Users\jonathan.els\Envs\uctoolkit\lib\site-packages\zeep\xsd\types\complex.py", line 169, in parse_xmlelement

    elements, schema, name, context=context)

  File "C:\Users\jonathan.els\Envs\uctoolkit\lib\site-packages\zeep\xsd\elements\indicators.py", line 600, in parse_xmlelements

    xmlelements, schema, name, context=context)

  File "C:\Users\jonathan.els\Envs\uctoolkit\lib\site-packages\zeep\xsd\elements\element.py", line 160, in parse_xmlelements

    xmlelement, schema, allow_none=True, context=context)

  File "C:\Users\jonathan.els\Envs\uctoolkit\lib\site-packages\zeep\xsd\elements\element.py", line 114, in parse

    schema_type=self.type)

  File "C:\Users\jonathan.els\Envs\uctoolkit\lib\site-packages\zeep\xsd\types\complex.py", line 169, in parse_xmlelement

    elements, schema, name, context=context)

  File "C:\Users\jonathan.els\Envs\uctoolkit\lib\site-packages\zeep\xsd\elements\indicators.py", line 600, in parse_xmlelements

    xmlelements, schema, name, context=context)

  File "C:\Users\jonathan.els\Envs\uctoolkit\lib\site-packages\zeep\xsd\elements\element.py", line 160, in parse_xmlelements

    xmlelement, schema, allow_none=True, context=context)

  File "C:\Users\jonathan.els\Envs\uctoolkit\lib\site-packages\zeep\xsd\elements\element.py", line 114, in parse

    schema_type=self.type)

  File "C:\Users\jonathan.els\Envs\uctoolkit\lib\site-packages\zeep\xsd\types\complex.py", line 193, in parse_xmlelement

    value = self._value_class(**init_kwargs)

  File "C:\Users\jonathan.els\Envs\uctoolkit\lib\site-packages\zeep\xsd\valueobjects.py", line 90, in __init__

    items = _process_signature(self._xsd_type, args, kwargs)

  File "C:\Users\jonathan.els\Envs\uctoolkit\lib\site-packages\zeep\xsd\valueobjects.py", line 231, in _process_signature

    xsd_type.signature(standalone=False)))

TypeError: {http://www.cisco.com/AXL/API/11.5}RLineAssociation() got an unexpected keyword argument 'routePartitionName'. Signature: `({uuid: {http://www.cisco.com/AXL/API/11.5}XUUID} | {pattern: xsd:string, routePartitionName: {http://www.cisco.com/AXL/API/11.5}XFkType}), index: `

Please can this be looked at?  It is definitely a bug.

1 Accepted Solution

Accepted Solutions

Thanks Jonathan. I've opened an escalation with the development team. This looks like a bug. The workaround for now would be to manually modify the XSD file to make the choice a sequence instead. Will let you know what I find.

View solution in original post

5 Replies 5

Jonathan Els
Level 5
Level 5

The same problem exists for LLineAssocation:

  • ns0:LLineAssociation(({uuid: ns0:XUUID} | {pattern: xsd:string, routePartitionName: ns0:XFkType}), index: )

This is however never used anywhere in the 11.5 schema.

Here's a sample showing the error.

The pre-requisite is that you must have a line association set on the Remote Destination, or zeep's validation for the invalid schema doesn't kick in as the uuid, pattern and routePartitionName are not all returned.

# -*- coding: utf-8 -*-

from zeep import Client

from zeep.cache import SqliteCache

from zeep.transports import Transport

from zeep.exceptions import Fault

from zeep.plugins import HistoryPlugin

from requests import Session

from requests.auth import HTTPBasicAuth

from urllib3 import disable_warnings

from urllib3.exceptions import InsecureRequestWarning

from lxml import etree

disable_warnings(InsecureRequestWarning)

USERNAME = 'administrator'
PASSWORD = 'ciscopsdt'
FQDN = '10.10.20.1'
WSDL = 'file://C://Users//jonathan.els//develop//pvt-repos//UCToolkit//schema//current//AXLAPI.wsdl'
BINDING_NAME = "{http://www.cisco.com/AXLAPIService/}AXLAPIBinding"
ADDRESS = "https://{fqdn}:8443/axl/".format(fqdn=FQDN)

def main():

  session = Session()

  session.verify = False
   session.auth = HTTPBasicAuth(USERNAME, PASSWORD)

  transport = Transport(cache=SqliteCache(), session=session, timeout=60)

  history = HistoryPlugin()

  client = Client(wsdl=WSDL, transport=transport, plugins=[history])

  axl = client.create_service(BINDING_NAME, ADDRESS)

   try:

  axl.getRemoteDestination(destination="123456")

   except (Fault, TypeError) as error:

   try:

   print(error.message)

   except AttributeError:

   print(error)

   for hist in [history.last_sent, history.last_received]:

   print(etree.tostring(hist["envelope"], encoding="unicode", pretty_print=True))

if __name__ == '__main__':

  main()

Output is:

{http://www.cisco.com/AXL/API/11.5}RLineAssociation() got an unexpected keyword argument 'pattern'. Signature: `({uuid: {http://www.cisco.com/AXL/API/11.5}XUUID} | {pattern: xsd:string, routePartitionName: {http://www.cisco.com/AXL/API/11.5}XFkType}), index: `

<soap-env:Envelope xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/">

  <soap-env:Body>

    <ns0:getRemoteDestination xmlns:ns0="http://www.cisco.com/AXL/API/11.5">

      <destination>123456</destination>

    </ns0:getRemoteDestination>

  </soap-env:Body>

</soap-env:Envelope>

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">

  <soapenv:Body>

    <ns:getRemoteDestinationResponse xmlns:ns="http://www.cisco.com/AXL/API/11.5">

      <return>

        <remoteDestination uuid="{00D136DF-BBEB-B0F4-099F-A2477A4B9D80}">

          <name>oh dear it failed</name>

          <destination>123456</destination>

          <answerTooSoonTimer>1500</answerTooSoonTimer>

          <answerTooLateTimer>19000</answerTooLateTimer>

          <delayBeforeRingingCell>4000</delayBeforeRingingCell>

          <ownerUserId uuid="{33D81AA0-2BC2-0882-76B8-52F6F0F55E83}">jonathan.els</ownerUserId>

          <remoteDestinationProfileName uuid="{86B60A71-91B2-61ED-9BB4-F23ECB8CADF5}">RDPJONATHAN</remoteDestinationProfileName>

          <ctiRemoteDeviceName/>

          <dualModeDeviceName/>

          <isMobilePhone>true</isMobilePhone>

          <enableMobileConnect>true</enableMobileConnect>

          <lineAssociations>

            <lineAssociation>

              <uuid>{750498B8-7BC2-16EB-730B-1F407FEB62F6}</uuid>

              <pattern>4007</pattern>

              <routePartitionName uuid="{F4D3BE1B-DA17-BBCF-46F5-8881CD9047C8}">Phones_Pt</routePartitionName>

              <index>1</index>

            </lineAssociation>

          </lineAssociations>

          <timeZone>Etc/GMT</timeZone>

          <todAccessName uuid="{D8D98F42-588D-C5C4-124F-EA6A2459E2D5}">TOD-RD-00d136df-bbeb-b0f4-099f-a2477a4b9d80</todAccessName>

          <mobileSmartClientName/>

          <mobilityProfileName/>

          <singleNumberReachVoicemail>Use System Default</singleNumberReachVoicemail>

          <dialViaOfficeReverseVoicemail>Use System Default</dialViaOfficeReverseVoicemail>

          <ringSchedule/>

          <accessListName/>

        </remoteDestination>

      </return>

    </ns:getRemoteDestinationResponse>

  </soapenv:Body>

</soapenv:Envelope>

Sorry about the formatting.  Jive sucks.  It's just hopeless for sharing code.  It's supposed to be a nested try/except...

Thanks Jonathan. I've opened an escalation with the development team. This looks like a bug. The workaround for now would be to manually modify the XSD file to make the choice a sequence instead. Will let you know what I find.

Thanks Paul, much appreciated!

Paul Giralt
Cisco Employee
Cisco Employee

Bug ID is CSCvj13556

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: