Webhooks - syntax for parsing XML return

Anonymous
Not applicable

Webhooks - syntax for parsing XML return

We are developing a Marketo webhook to FedEx to get delivery status.  We would like to save a value from the response payload in a custom Marketo field.  We have successfully developed webhooks to our own API  and save information in custom Marketo fields.  Our API returns JSON and the FedEx API returns XML.  We have gotten our FedEx webhook to work and return a success (200) with a response payload, however we cannot get anything to save to the custom Marketo field.  I believe it is a syntax problem. 
 
I looked at this discussion (https://community.marketo.com/MarketoDiscussionDetail?id=90650000000PdyPAAS) and this article (https://community.marketo.com/MarketoArticle?id=kA050000000L8wiCAC) to get ideas for the correct syntax.  
 
Here is some of what I have tried:
 
SOAP-ENV:Body[0].TrackReply[0].TrackDetails.StatusDescription[0]
SOAP-ENV:Body[0].TrackReply[0].TrackDetails[0].StatusDescription
SOAP-ENV:Body[0].TrackReply[0].TrackDetails[0].StatusDescription[0]
SOAP-ENV:Envelope
SOAP-ENV:Envelope.@xmlns:SOAP-ENV
SOAP-ENV:Envelope.SOAP-ENV:Body.TrackReply
SOAP-ENV:Envelope.SOAP-ENV:Body.TrackReply.@xmlns
SOAP-ENV:Envelope.SOAP-ENV:Body.TrackReply.HighestSeverity
SOAP-ENV:Envelope.SOAP-ENV:Body.TrackReply.HighestSeverity
SOAP-ENV:Envelope.SOAP-ENV:Body.TrackReply.HighestSeverity.toString()
SOAP-ENV:Envelope.SOAP-ENV:Body.TrackReply.HighestSeverity.toXMLString()
SOAP-ENV:Envelope.SOAP-ENV:Body.TrackReply.HighestSeverity[0]
sOAP-ENV:Envelope.sOAP-ENV:Body.trackReply.trackDetails.statusDescription
SOAP-ENV:Envelope.SOAP-ENV:Body.TrackReply.TrackDetails.StatusDescription
SOAP-ENV:Envelope.SOAP-ENV:Body.TrackReply.TrackDetails[0].StatusDescription
SOAP-ENV:Envelope.SOAP-ENV:Body.TrackReply.TrackDetails[0].StatusDescription[0]
SOAP-ENV:Envelope.SOAP-ENV:Body.TrackReply.xmlns
SOAP-ENV:Envelope.SOAP-ENV:Body.TrackReply[0].HighestSeverity
SOAP-ENV:Envelope.SOAP-ENV:Body.TrackReply[0].HighestSeverity[0]
SOAP-ENV:Envelope.SOAP-ENV:Body.TrackReply[0].TrackDetails[0].StatusDescription
SOAP-ENV:Envelope.SOAP-ENV:Body.TrackReply[0].TrackDetails[0].StatusDescription[0]
SOAP-ENV:Envelope.SOAP-ENV:Body[0].TrackReply.HighestSeverity
SOAP-ENV:Envelope.SOAP-ENV:Body[0].TrackReply.HighestSeverity[0]
SOAP-ENV:Envelope.SOAP-ENV:Body[0].TrackReply[0].HighestSeverity
SOAP-ENV:Envelope.SOAP-ENV:Body[0].TrackReply[0].HighestSeverity[0]
SOAP-ENV:Envelope.SOAP-ENV:Body[0].TrackReply[0].TrackDetails[0].StatusDescription
SOAP-ENV:Envelope.SOAP-ENV:Body[0].TrackReply[0].TrackDetails[0].StatusDescription[0]
SOAP-ENV:Envelope.xmlns:SOAP-ENV
SOAP-ENV:Envelope[0].SOAP-ENV:Body.TrackReply.HighestSeverity
SOAP-ENV:Envelope[0].SOAP-ENV:Body.TrackReply.HighestSeverity[0]
SOAP-ENV:Envelope[0].SOAP-ENV:Body.TrackReply[0].HighestSeverity
SOAP-ENV:Envelope[0].SOAP-ENV:Body.TrackReply[0].HighestSeverity[0]
SOAP-ENV:Envelope[0].SOAP-ENV:Body[0].TrackReply.HighestSeverity
SOAP-ENV:Envelope[0].SOAP-ENV:Body[0].TrackReply.HighestSeverity[0]
SOAP-ENV:Envelope[0].SOAP-ENV:Body[0].TrackReply[0].HighestSeverity
SOAP-ENV:Envelope[0].SOAP-ENV:Body[0].TrackReply[0].HighestSeverity[0]
SOAP-ENV:Envelope[0].SOAP-ENV:Body[0].TrackReply[0].TrackDetails[0].StatusDescription
SOAP-ENV:Envelope[0].SOAP-ENV:Body[0].TrackReply[0].TrackDetails[0].StatusDescription[0]
StatusDescription
TrackReply.TrackDetails[0].StatusDescription
 
 
Below is my XML response.  I would like get the string in StatusDescription.
Thank you.
 
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
  <SOAP-ENV:Header/>
  <SOAP-ENV:Body>
    <TrackReply xmlns="http://fedex.com/ws/track/v6">
      <HighestSeverity>SUCCESS</HighestSeverity>
      <Notifications>
        <Severity>SUCCESS</Severity>
        <Source>trck</Source>
        <Code>0</Code>
        <Message>Request was successfully processed.</Message>
        <LocalizedMessage>Request was successfully processed.</LocalizedMessage>
      </Notifications>
      <Version>
        <ServiceId>trck</ServiceId>
        <Major>6</Major>
        <Intermediate>0</Intermediate>
        <Minor>0</Minor>
      </Version>
      <DuplicateWaybill>false</DuplicateWaybill>
      <MoreData>false</MoreData>
      <TrackDetails>
        <Notification>
          <Severity>SUCCESS</Severity>
          <Source>trck</Source>
          <Code>0</Code>
          <Message>Request was successfully processed.</Message>
          <LocalizedMessage>Request was successfully processed.</LocalizedMessage>
        </Notification>
        <TrackingNumber>538771710000717</TrackingNumber>
        <TrackingNumberUniqueIdentifier>12013~538771710000717~FDEG</TrackingNumberUniqueIdentifier>
        <StatusCode>DL</StatusCode>
        <StatusDescription>Delivered</StatusDescription>
        <CarrierCode>FDXG</CarrierCode>
      </TrackDetails>
    </TrackReply>
  </SOAP-ENV:Body>
</SOAP-ENV:Envelope>
Tags (1)
3 REPLIES 3
Anonymous
Not applicable

Re: Webhooks - syntax for parsing XML return

Hi Courtney - Make sure you have selected XML as the response type on the Webhook configuration panel.

0EM50000000RZtN.jpg
Anonymous
Not applicable

Re: Webhooks - syntax for parsing XML return

Given the XML response:

<?xml version="1.0"?>

<response>

  <success>true</success>

</response>

 

response.success will return "true"

Anonymous
Not applicable

Re: Webhooks - syntax for parsing XML return

Travis, Thank you for your responses on this.  The response type for my webhook is XML.  The XML response does not contain an XML version tag at the beginning.  Is is possible that this is the problem with saving data?  Could you try that and let me know?  I don't have any control over the response I am receiving from FedEx to add the version tag, however it would be nice to know if that is the problem.
Courtney