Issue with Dynamic Fields

English! place to talk about development, programming and coding
Post Reply
rekhas
Znuny newbie
Posts: 2
Joined: 06 Jul 2013, 08:09
Znuny Version: 3.2.8

Issue with Dynamic Fields

Post by rekhas »

I have downloaded and OTRS HelpDesk 3.2.8. I have also created a new dynamic field by name "Service". I am able to see this field in View Ticket Small Screen. I have also added field to TicketCreate. I am unable to set the value for this from SOAP client. Here is the code snippet:

SOAPBody body = env.getBody();
SOAPBodyElement dispatch = body.addBodyElement(new QName("/Core", "Dispatch"));
dispatch.addChildElement("Username").addTextNode(szUserName).setAttribute("xsi:type", "xsd:string");
dispatch.addChildElement("Password").addTextNode(szPassword).setAttribute("xsi:type", "xsd:string");
//code to set other standard ticket attributes
...............
.....................
dispatch.addChildElement("Param10_Name").addTextNode("Service").setAttribute("xsi:type", "xsd:string");
dispatch.addChildElement("Param10_Value").addTextNode("Mail").setAttribute("xsi:type", "xsd:int");
............................
.......................

I can see the standard attributes of ticket being set but "SERVCIE" column is empty.

Not seeing any errors either in httpd log nor otrs log. What could be the problem?
jojo
Znuny guru
Posts: 15020
Joined: 26 Jan 2007, 14:50
Znuny Version: Git Master
Contact:

Re: Issue with Dynamic Fields

Post by jojo »

OTRS already has a field called service. Please have also a look on the wsdl of the soap interface, to see how to set a dynamaic field value
"Production": OTRS™ 8, OTRS™ 7, STORM powered by OTRS
"Testing": ((OTRS Community Edition)) and git Master

Never change Defaults.pm! :: Blog
Professional Services:: http://www.otrs.com :: enjoy@otrs.com
rekhas
Znuny newbie
Posts: 2
Joined: 06 Jul 2013, 08:09
Znuny Version: 3.2.8

Re: Issue with Dynamic Fields

Post by rekhas »

@jojo: I couldn't find the wsdl of the soap interface.

I removed "Service" and added a new dynamic field named "HostName" which is intended to hold IP Address. I am able to see this field in View Ticket Small Screen. I have also added field to TicketCreate. Still I am unable to set the value for this from SOAP client. Here is the code snippet:

SOAPBody body = env.getBody();
SOAPBodyElement dispatch = body.addBodyElement(new QName("/Core", "Dispatch"));
dispatch.addChildElement("Username").addTextNode(szUserName).setAttribute("xsi:type", "xsd:string");
dispatch.addChildElement("Password").addTextNode(szPassword).setAttribute("xsi:type", "xsd:string");
//code to set other standard ticket attributes
.......................
dispatch.addChildElement("Param9_Name").addTextNode("DynamicField").setAttribute("xsi:type", "xsd:string");
SOAPElement paramEle = dispatch.addChildElement("Param9_Value");
paramEle.addChildElement("Param10_Name").addTextNode("Name").setAttribute("xsi:type", "xsd:string");
paramEle.addChildElement("Param10_Value").addTextNode("HostName").setAttribute("xsi:type", "xsd:string");
paramEle.addChildElement("Param11_Name").addTextNode("Value").setAttribute("xsi:type", "xsd:string");
paramEle.addChildElement("Param11_Value").addTextNode("192.168.1.2").setAttribute("xsi:type", "xsd:string");
........................
I wrote a dummy SOAP receiver which gets the msg as follows:
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:enc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:env="http://schemas.xmlsoap.org/soap/envelop/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Header/>
<SOAP-ENV:Body>
<Dispatch xmlns="/Core">
<Username xsi:type="xsd:string">test</Username>
<Password xsi:type="xsd:string">test</Password>
<Object xsi:type="xsd:string">TicketObject</Object>
<Method xsi:type="xsd:string">TicketCreate</Method>
<Param1_Name xsi:type="xsd:string">Title</Param1_Name>
<Param1_Value xsi:type="xsd:int">CPU Load Test</Param1_Value>
<Param2_Name xsi:type="xsd:string">Queue</Param2_Name>
<Param2_Value xsi:type="xsd:int">Raw</Param2_Value>
<Param3_Name xsi:type="xsd:string">Lock</Param3_Name>
<Param3_Value xsi:type="xsd:int">unlock</Param3_Value>
<Param4_Name xsi:type="xsd:string">CustomerID</Param4_Name>
<Param4_Value xsi:type="xsd:int">CUST01</Param4_Value>
<Param5_Name xsi:type="xsd:string">OwnerID</Param5_Name>
<Param5_Value xsi:type="xsd:int">2</Param5_Value>
<Param6_Name xsi:type="xsd:string">UserID</Param6_Name>
<Param6_Value xsi:type="xsd:int">1</Param6_Value>
<Param7_Name xsi:type="xsd:string">State</Param7_Name>
<Param7_Value xsi:type="xsd:int">new</Param7_Value>
<Param8_Name xsi:type="xsd:string">Priority</Param8_Name>
<Param8_Value xsi:type="xsd:int">3 normal</Param8_Value>
<Param9_Name xsi:type="xsd:string">DynamicField</Param9_Name>
<Param9_Value>
<Param10_Name xsi:type="xsd:string">Name</Param10_Name>
<Param10_Value xsi:type="xsd:string">HostName</Param10_Value>
<Param11_Name xsi:type="xsd:string">Value</Param11_Name>
<Param11_Value xsi:type="xsd:string">192.168.1.2</Param11_Value>
</Param9_Value>
</Dispatch>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>


tried an alternative:
SOAPElement paramEle = dispatch.addChildElement("DynamicField");
paramEle.addChildElement("Param10_Name").addTextNode("Name").setAttribute("xsi:type", "xsd:string");
paramEle.addChildElement("Param10_Value").addTextNode("HostName").setAttribute("xsi:type", "xsd:string");
paramEle.addChildElement("Param11_Name").addTextNode("Value").setAttribute("xsi:type", "xsd:string");
paramEle.addChildElement("Param11_Value").addTextNode("192.168.1.2").setAttribute("xsi:type", "xsd:string");

results in the msg:
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:enc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:env="http://schemas.xmlsoap.org/soap/envelop/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Header/>
<SOAP-ENV:Body>
<Dispatch xmlns="/Core">
<Username xsi:type="xsd:string">test</Username>
<Password xsi:type="xsd:string">test</Password>
<Object xsi:type="xsd:string">TicketObject</Object>
<Method xsi:type="xsd:string">TicketCreate</Method>
<Param1_Name xsi:type="xsd:string">Title</Param1_Name>
<Param1_Value xsi:type="xsd:int">CPU Load Test</Param1_Value>
<Param2_Name xsi:type="xsd:string">Queue</Param2_Name>
<Param2_Value xsi:type="xsd:int">Raw</Param2_Value>
<Param3_Name xsi:type="xsd:string">Lock</Param3_Name>
<Param3_Value xsi:type="xsd:int">unlock</Param3_Value>
<Param4_Name xsi:type="xsd:string">CustomerID</Param4_Name>
<Param4_Value xsi:type="xsd:int">CUST01</Param4_Value>
<Param5_Name xsi:type="xsd:string">OwnerID</Param5_Name>
<Param5_Value xsi:type="xsd:int">2</Param5_Value>
<Param6_Name xsi:type="xsd:string">UserID</Param6_Name>
<Param6_Value xsi:type="xsd:int">1</Param6_Value>
<Param7_Name xsi:type="xsd:string">State</Param7_Name>
<Param7_Value xsi:type="xsd:int">new</Param7_Value>
<Param8_Name xsi:type="xsd:string">Priority</Param8_Name>
<Param8_Value xsi:type="xsd:int">3 normal</Param8_Value>
<DynamicField>
<Param10_Name xsi:type="xsd:string">Name</Param10_Name>
<Param10_Value xsi:type="xsd:string">HostName</Param10_Value>
<Param11_Name xsi:type="xsd:string">Value</Param11_Name>
<Param11_Value xsi:type="xsd:string">192.168.1.2</Param11_Value>
</DynamicField>
</Dispatch>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>


None of these are working. Does anyone know the syntax that rpc.pl expects. Do help.
jojo
Znuny guru
Posts: 15020
Joined: 26 Jan 2007, 14:50
Znuny Version: Git Master
Contact:

Re: Issue with Dynamic Fields

Post by jojo »

rpc.pl is outdated and just used for direct API based SOAP encapsulated access.

The generic interface is used for "normal" SOAP based communication. Please have a look in admin and devel manual and also on blog.otrs.org
"Production": OTRS™ 8, OTRS™ 7, STORM powered by OTRS
"Testing": ((OTRS Community Edition)) and git Master

Never change Defaults.pm! :: Blog
Professional Services:: http://www.otrs.com :: enjoy@otrs.com
Post Reply