Loading ...
Sorry, an error occurred while loading the content.

When does an element get turned into an object?

Expand Messages
  • whmoseley
    I m using JIRA::Client which uses SOAP::Lite to fetch an issue from a JIRA server. My code was fetching the owner of the ticket as $ticket- {assignee}, and
    Message 1 of 1 , Feb 8, 2012
    • 0 Attachment
      I'm using JIRA::Client which uses SOAP::Lite to fetch an "issue" from a JIRA server.

      My code was fetching the owner of the ticket as $ticket->{assignee}, and this was a scalar.

      Last Friday the code started to fail because $ticket->{assignee} was now returning a "String" object.

      It appears that the WSDL changed (along with the SOAP response). When I ran the code on the public JIRA server I received a scalar again.

      The XML markup seems to have changed from this (on the public JIRA server):

      <assignee xsi:type="xsd:string">andreyev</assignee>

      Which deserializes like this (simple scalar):

      $ perl -MData::Dumper -MSOAP::Lite -le 'local $/; print Data::Dumper::Dumper( SOAP::Deserializer->deserialize( <> )->result->{assignee} )' jira_test.xml
      $VAR1 = 'andreyev';


      To this structure:

      <assignee xsi:type="ns2:String" xmlns:ns2="http://lang.java"><bytes xsi:type="xsd:base64Binary">YmlsbEBpcGFyYWRpZ21sksisvbQ==</bytes><empty xsi:type="xsd:boolean">false</empty></assignee>


      Which deserializes like this:

      perl -MData::Dumper -MSOAP::Lite -le 'local $/; print Data::Dumper::Dumper( SOAP::Deserializer->deserialize( <> )->result->{assignee} )' issue.xml
      $VAR1 = bless( {
      'bytes' => 'bill@...',
      'empty' => 0
      }, 'String' );

      I rarely use SOAP, so this may be a dumb question:

      Could JIRA::Client have somehow seen this change and handled it automatically? Or is this just a non-compatible API change?

      And what methods end on available on this "String" class?

      Does SOAP::LIte just turn any complex element into an object? I mean w/o the WDSL how does SOAP::Lite know what this object should look like -- just by the structure of the XML?

      Here's the public WSDL, if curious:

      https://jira.atlassian.com/rpc/soap/jirasoapservice-v2?wsdl
    Your message has been successfully submitted and would be delivered to recipients shortly.