tags:

views:

126

answers:

0

I am new to TDI.

I have a TDI assembly line that calls a web service (ibmdi.InvokeSoapWS) which returns the result as a string in the work attribute 'xmlString'. I then have an AttributeMap that attempts to parse the xml and extract a value (the node it seeks is a few nodes deep).

var parser = system.getParser('ibmdi.SOAP');
var xmlString = work.getString('xmlString');
var entity = parser.parseRequest(xmlString);
task.dump(entity);

The trouble is, the parsed object does not contain an accurate representation of the XML. It contains only two attributes, the first is correctly the first node following the soap body (e.g., ns0:SomeNodeReply), the second being a node inside the first (e.g., ns0:DetailCount). And as far as I can determine, both attributes are just strings so I cannot recurse into the object graph.

Below is a sample soap reply:

<?xml version="1.0" encoding="utf-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"&gt;

  <SOAP-ENV:Body>
    <ns0:SomeNodeReply xmlns:ns0="http://xmlns.example.com/unique/default/namespace/1136581686664"&gt;

      <ns0:Status>
        <ns0:StatusCD>000</ns0:StatusCD>
        <ns0:StatusDesc />
      </ns0:Status>
      <ns0:DetailCount>1</ns0:DetailCount>
      <ns0:SomeDetail>
        <ns0:CodeA>Foo</ns0:CodeA>
        <ns0:CodeB>Bar</ns0:CodeB>
      </ns0:SomeDetail>
    </ns0:SomeNodeReply>
  </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

And below is a sample dump of the parsed string:

19:03:23  CTGDIS003I *** Start dumping Entry
19:03:23    Operation: generic 
19:03:23    Entry attributes:
19:03:23        SOAP_CALL (replace):    'ns0:SomeNodeReply'
19:03:23        ns0:DetailCount(replace):   '1'
19:03:23  CTGDIS004I *** Finished dumping Entry

All I really need to do is be able to parse out a value that may or may not be there, depending on the value of another node (e.g., DetailCount == 1, get CodeA otherwise return empty string). I am open to changing anything about how this works if I can extract the data into the work Entry.