3 Replies Latest reply on Mar 10, 2014 8:17 AM by Courtney Bauman

    Webhooks - syntax for parsing XML return

    Courtney Bauman
           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>