OTRS web services and dynamic fields

English! place to talk about development, programming and coding
Post Reply
StCyr
Znuny newbie
Posts: 13
Joined: 25 Feb 2014, 16:32
Znuny Version: 4.something

OTRS web services and dynamic fields

Post by StCyr »

Hi all,

I would like to raise my concerns about how dynamic fields are currently implemented in OTRS web services.

I think returning dynamic fields value in the form "'DynamicField_XXX' => 'value'" is broken and won't ever be depictable with a valid wsdl file.

Though, I'm not a WSDL expert. So, hopefully, I'm wrong.

Here's an example to explain you why I think is broken:

1- on Ubuntu, install the python-zsi package
2- Get the GenericTicketConnectorSOAP.wsdl from the github repository
3- run the following command: wsdl2py --complexType GenericTicketConnectorSOAP.wsdl
4- adapt the generated GenericTicketConnectorSOAP_client.py file to match your OTRS web service endpoint
5- launch a python shell
6- type the following
from GenericTicketConnectorSOAP_client import *
loc = GenericTicketConnectorLocator()
port = loc.getGenericTicketConnector_Port()
req = TicketGetRequest()
req.UserLogin = 'some_agent'
req.Password = 'agent_password'
req.DynamicFields = 1
req.ticketID = [some_ticketID]
resp = port.TicketGet(req)
7- Now, look in OTRS' webservice debugger how it returns dynamic fields value:
'DynamicField_Category' => '200',
'DynamicField_EventTicketEndTime' => '2015-12-01 16:59:00',
'DynamicField_EventTicketStartTime' => '2015-12-01 08:59:00',
'DynamicField_ProcessManagementActivityID' => undef,
'DynamicField_ProcessManagementProcessID' => undef,
'DynamicField_TicketFreeKey1' => undef,
'DynamicField_TicketFreeKey2' => undef,
'DynamicField_TicketFreeKey3' => undef,
'DynamicField_TicketFreeKey4' => undef,
'DynamicField_TicketFreeText1' => undef,
'DynamicField_TicketFreeText2' => undef,
'DynamicField_TicketFreeText3' => undef,
'DynamicField_TicketFreeText4' => undef,
8- Back in your python shell, try to get the value of some dynamic fields:
>>> print resp.Ticket[0].DynamicField_EventTicketStartTime
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'OTRS_TicketGetResponse_Ticket_Holder' object has no attribute 'DynamicField_EventTicketStartTime'
>>>
9- Confirm all other ticket attributes can be retrieved this way:
>>> print resp.Ticket[0].Lock
lock
>>> print resp.Ticket[0].Queue
Internal Support
>>> print resp.Ticket[0].Owner
cyrille
>>>
10- Confirm how the SOAP client has knowledge about dynamic fields:
>>> print resp.Ticket[0].DynamicField
[]

As I said, I'm not a WSDL expert. So, there might be some way to describe this kind of behaviour in WSDL.

What do you think?

Cyrille
Post Reply