Note that there are some explanatory texts on larger screens.

plurals
  1. POProblems creating an issue in JIRA with Custom Fields with Soap Lite and perl
    text
    copied!<p>I'm banging my head against the soap api with the following code. My goal is to create a ticket with custom fields. If you comment out the custom field part this code works fine. Any idea of what's going on?</p> <p>Code</p> <pre><code>my $soap = SOAP::Lite-&gt;service($wsdl); my $token = $soap-&gt;login($_jira_user,$_jira_pass); my $customFields = [ {'customFieldId' =&gt; $_cf_map{'severity'},'values' =&gt; [SOAP::Data-&gt;type('string', $severity)]}, {'customFieldId' =&gt; $_cf_map{'outage_start'}, 'values' =&gt; [SOAP::Data-&gt;type('string', $start)]}, {'customFieldId' =&gt; $_cf_map{'no_auto_close'}, 'values' =&gt; [SOAP::Data-&gt;type('string', $no_auto_close == 1 ? 'Yes': 'No')]}, {'customFieldId' =&gt; $_cf_map{'nco_serials'}, 'values' =&gt; [SOAP::Data-&gt;type('string', $serial_string)]}, {'customFieldId' =&gt; $_cf_map{'services'}, 'values' =&gt; \@services}, ]; my $remoteIssueHash = { 'project' =&gt; SOAP::Data-&gt;type('string' =&gt; $_projectkey), 'type' =&gt; SOAP::Data-&gt;type('string' =&gt; $_issuetype), 'summary' =&gt; SOAP::Data-&gt;type('string' =&gt; $summary), 'reporter' =&gt; SOAP::Data-&gt;type('string' =&gt; $user), 'assignee' =&gt; SOAP::Data-&gt;type('string' =&gt; $user), 'customFieldValues' =&gt; $customFields, }; my $remote_issue = $soap-&gt;call('createIssue', $token, $remoteIssueHash); print Dumper [$remote_issue-&gt;faultcode(), $remote_issue-&gt;faultstring(), $soap-&gt;transport()-&gt;status(), $remote_issue-&gt;result(), $remote_issue ] exit(); </code></pre> <p>Output</p> <pre><code>$VAR1 = [ 'soapenv:Server.userException', 'org.xml.sax.SAXException: No deserializer for {http://www.w3.org/2001/XMLSchema}anyType', '500 Internal Server Error', #big soap object ] </code></pre> <p>XML SENT</p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;soap:Envelope xmlns:tns2="http://exception.rpc.jira.atlassian.com" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:namesp1="http://soap.rpc.jira.atlassian.com" xmlns:apachesoap="http://xml.apache.org/xml-soap" soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tns1="http://beans.soap.rpc.jira.atlassian.com" xmlns:impl="http://jira.nyc.hcmny.com:8080/rpc/soap/jirasoapservice-v2" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt; &lt;soap:Body&gt; &lt;namesp1:createIssue&gt; &lt;c-gensym6 xsi:type="xsd:string"&gt;Y6DQd1k2BL&lt;/c-gensym6&gt; &lt;c-gensym8&gt; &lt;assignee xsi:type="xsd:string"&gt;fgulotta&lt;/assignee&gt; &lt;customFieldValues soapenc:arrayType="xsd:anyType[5]" xsi:type="soapenc:Array"&gt; &lt;item&gt; &lt;customFieldId xsi:type="xsd:string"&gt;customfield_10094&lt;/customFieldId&gt; &lt;values soapenc:arrayType="xsd:string[1]" xsi:type="soapenc:Array"&gt; &lt;item xsi:type="xsd:string"&gt;4&lt;/item&gt; &lt;/values&gt; &lt;key xsi:type="xsd:string" /&gt; &lt;/item&gt; &lt;item&gt; &lt;customFieldId xsi:type="xsd:string"&gt;customfield_10084&lt;/customFieldId&gt; &lt;values soapenc:arrayType="xsd:string[1]" xsi:type="soapenc:Array"&gt; &lt;item xsi:type="xsd:string"&gt;29/Jul/11 05:46 PM&lt;/item&gt; &lt;/values&gt; &lt;key xsi:type="xsd:string" /&gt; &lt;/item&gt; &lt;item&gt; &lt;customFieldId xsi:type="xsd:string"&gt;customfield_10100&lt;/customFieldId&gt; &lt;values soapenc:arrayType="xsd:string[1]" xsi:type="soapenc:Array"&gt; &lt;item xsi:type="xsd:string"&gt;Yes&lt;/item&gt; &lt;/values&gt; &lt;key xsi:type="xsd:string" /&gt; &lt;/item&gt; &lt;item&gt; &lt;customFieldId xsi:type="xsd:string"&gt;customfield_10093&lt;/customFieldId&gt; &lt;values soapenc:arrayType="xsd:string[1]" xsi:type="soapenc:Array"&gt; &lt;item xsi:type="xsd:string" /&gt; &lt;/values&gt; &lt;key xsi:type="xsd:string" /&gt; &lt;/item&gt; &lt;item&gt; &lt;customFieldId xsi:type="xsd:string"&gt;customfield_10080&lt;/customFieldId&gt; &lt;values soapenc:arrayType="xsd:string[1]" xsi:type="soapenc:Array"&gt; &lt;item xsi:type="xsd:string"&gt;intranet&lt;/item&gt; &lt;/values&gt; &lt;key xsi:type="xsd:string" /&gt; &lt;/item&gt; &lt;/customFieldValues&gt; &lt;summary xsi:type="xsd:string"&gt;This is a test ticket.&lt;/summary&gt; &lt;project xsi:type="xsd:string"&gt;MON&lt;/project&gt; &lt;type xsi:type="xsd:string"&gt;31&lt;/type&gt; &lt;reporter xsi:type="xsd:string"&gt;fgulotta&lt;/reporter&gt; &lt;/c-gensym8&gt; &lt;/namesp1:createIssue&gt; &lt;/soap:Body&gt; &lt;/soap:Envelope&gt; </code></pre> <p>XML RECIEVED</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"&gt; &lt;soapenv:Body&gt; &lt;soapenv:Fault&gt; &lt;faultcode&gt;soapenv:Server.userException&lt;/faultcode&gt; &lt;faultstring&gt;org.xml.sax.SAXException: No deserializer for {http://www.w3.org/2001/XMLSchema}anyType&lt;/faultstring&gt; &lt;detail&gt; &lt;faultData xsi:type="ns1:SAXException" xmlns:ns1="http://sax.xml.org"&gt; &lt;exception xsi:type="ns2:Exception" xsi:nil="true" xmlns:ns2="http://lang.java"/&gt; &lt;message xsi:type="xsd:string"&gt;No deserializer for {http://www.w3.org/2001/XMLSchema}anyType&lt;/message&gt; &lt;/faultData&gt; &lt;ns3:hostname xmlns:ns3="http://xml.apache.org/axis/"&gt;deputy.811t.hcmny.com&lt;/ns3:hostname&gt; &lt;/detail&gt; &lt;/soapenv:Fault&gt; &lt;/soapenv:Body&gt; &lt;/soapenv:Envelope&gt; </code></pre> <p><strong>Updated</strong> Fixed field names and put values in string arrays but still have issues.</p> <p><strong>2nd update</strong> I found some java code that works against the soap service and ran my tests against that. Then I used wireshark to sniff the xml. Ignoring the multirefs its a very similar structure, but I'm not quite sure how to model it with Soap::Lite.</p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"&gt; &lt;soapenv:Body&gt; &lt;ns1:createIssue soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns1="http://soap.rpc.jira.atlassian.com"&gt; &lt;in0 xsi:type="xsd:string"&gt;B2P69v5NrS&lt;/in0&gt; &lt;in1 href="#id0"/&gt; &lt;/ns1:createIssue&gt; &lt;multiRef id="id0" soapenc:root="0" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="ns2:RemoteIssue" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns2="http://beans.soap.rpc.jira.atlassian.com"&gt; &lt;id xsi:type="xsd:string" xsi:nil="true"/&gt; &lt;affectsVersions xsi:type="ns2:RemoteVersion" xsi:nil="true"/&gt; &lt;assignee xsi:type="xsd:string"&gt;fgulotta&lt;/assignee&gt; &lt;attachmentNames xsi:type="xsd:string" xsi:nil="true"/&gt; &lt;components xsi:type="ns2:RemoteComponent" xsi:nil="true"/&gt; &lt;created xsi:type="xsd:dateTime" xsi:nil="true"/&gt; &lt;customFieldValues soapenc:arrayType="ns2:RemoteCustomFieldValue[3]" xsi:type="soapenc:Array"&gt; &lt;customFieldValues href="#id1"/&gt; &lt;customFieldValues href="#id2"/&gt; &lt;customFieldValues href="#id3"/&gt; &lt;/customFieldValues&gt; &lt;description xsi:type="xsd:string" xsi:nil="true"/&gt; &lt;duedate xsi:type="xsd:dateTime" xsi:nil="true"/&gt; &lt;environment xsi:type="xsd:string" xsi:nil="true"/&gt; &lt;fixVersions xsi:type="ns2:RemoteVersion" xsi:nil="true"/&gt; &lt;key xsi:type="xsd:string" xsi:nil="true"/&gt; &lt;priority xsi:type="xsd:string" xsi:nil="true"/&gt; &lt;project xsi:type="xsd:string"&gt;MON&lt;/project&gt; &lt;reporter xsi:type="xsd:string"&gt;fgulotta&lt;/reporter&gt; &lt;resolution xsi:type="xsd:string" xsi:nil="true"/&gt; &lt;status xsi:type="xsd:string" xsi:nil="true"/&gt; &lt;summary xsi:type="xsd:string"&gt;This is a test ticket.&lt;/summary&gt; &lt;type xsi:type="xsd:string"&gt;31&lt;/type&gt; &lt;updated xsi:type="xsd:dateTime" xsi:nil="true"/&gt; &lt;votes xsi:type="xsd:long" xsi:nil="true"/&gt; &lt;/multiRef&gt; &lt;multiRef id="id2" soapenc:root="0" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="ns3:RemoteCustomFieldValue" xmlns:ns3="http://beans.soap.rpc.jira.atlassian.com" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"&gt; &lt;customfieldId xsi:type="xsd:string"&gt;customfield_10094&lt;/customfieldId&gt; &lt;key xsi:type="xsd:string" xsi:nil="true"/&gt; &lt;values soapenc:arrayType="xsd:string[1]" xsi:type="soapenc:Array"&gt; &lt;values xsi:type="xsd:string"&gt;4&lt;/values&gt; &lt;/values&gt; &lt;/multiRef&gt; &lt;multiRef id="id1" soapenc:root="0" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="ns4:RemoteCustomFieldValue" xmlns:ns4="http://beans.soap.rpc.jira.atlassian.com" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"&gt; &lt;customfieldId xsi:type="xsd:string"&gt;customfield_10084&lt;/customfieldId&gt; &lt;key xsi:type="xsd:string" xsi:nil="true"/&gt; &lt;values soapenc:arrayType="xsd:string[1]" xsi:type="soapenc:Array"&gt; &lt;values xsi:type="xsd:string"&gt;27/Jul/11 02:21 PM&lt;/values&gt; &lt;/values&gt; &lt;/multiRef&gt; &lt;multiRef id="id3" soapenc:root="0" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="ns5:RemoteCustomFieldValue" xmlns:ns5="http://beans.soap.rpc.jira.atlassian.com" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"&gt; &lt;customfieldId xsi:type="xsd:string"&gt;customfield_10100&lt;/customfieldId&gt; &lt;key xsi:type="xsd:string" xsi:nil="true"/&gt; &lt;values soapenc:arrayType="xsd:string[1]" xsi:type="soapenc:Array"&gt; &lt;values xsi:type="xsd:string"&gt;Yes&lt;/values&gt; &lt;/values&gt; &lt;/multiRef&gt; &lt;/soapenv:Body&gt; &lt;/soapenv:Envelope&gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload