3rd party Webservice soap response

SOLVED

I'm trying to make a call to a 3rd party webservice using Sage X3 scripts on the SDH window, i'm using the func ASYRWEBSER.EXEC_HTTP wich is working fine, it's calling the webservice and receiving the answer of the soap call.


The Answer:

<s:Envelope
    xmlns:s=\"">schemas.xmlsoap.org/.../\">
    <s:Body>
        <CreateShipmentResponse
            xmlns=\"">">http://tempuri.org/\">
            <CreateShipmentResult
                xmlns:a=\"">schemas.datacontract.org/.../CTTExpressoWS\"
                xmlns:i=\"">www.w3.org/.../XMLSchema-instance\">
                <a:ErrorsList/>
                <a:ShipmentData>
                    <a:ShipmentDataOutput>
                        <a:ClientReference>teste</a:ClientReference>
                        <a:DocumentsList>
</a:DocumentsList>
                        <a:FirstObject>DB112320353PT</a:FirstObject>
                        <a:LabelList>
                            <a:LabelData>
                                <a:BestEncoding>65001</a:BestEncoding>
                                <a:FileName>ETI</a:FileName>
                                <a:Label>^XA&#xD;\n</a:Label>
                            </a:LabelData>
                        </a:LabelList>
                        <a:LastObject>DB112320353PT</a:LastObject>
                        <a:OriginalObjectID i:nil=\"true\"/>
                    </a:ShipmentDataOutput>
                </a:ShipmentData>
                <a:Status>Success</a:Status>
            </CreateShipmentResult>
        </CreateShipmentResponse>
    </s:Body>
</s:Envelope>

My problem is that i don't know how to use the XML fields that i need in X3 Scripts, can anyone point me in the right direction?

I need to get the <a:LastObject>, the <a:Status> and the <a:LabelList><a:LabelData>  of the response

Parents
  • +1
    verified answer

    Unfortunately there is no simple way to convert a XML response to fields, you will have to do some CLOB manipulation.

    I would suggest using something like the formulate below to find the value between the tags, this is obviously assuming each tag only appears once, if not you will have to loop through the CLOB breaking it up section by section.

    seg$("<a:LastObject>DB112320353PT</a:LastObject>", instr(0,"<a:LastObject>DB112320353PT<a/:LastObject>", "<a:LastObject>") + len("<a:LastObject>"), instr(0,"<a:LastObject>DB112320353PT</a:LastObject>", "</a:LastObject>")-1)

  • 0 in reply to Regard Hulsbos

    Tkz, i will try it out

Reply Children