Specific: how to remove text from incoming xml-message

BlackBirdBlackBird Member Posts: 52
Hi there,

I have a communication set up with a 3rd party webservice. I send and receive messages through SOAP which worked fine until now.
The reponse i get has changed. Instead of the following repons (example):
<soap:Envelope soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
   <soap:Body>
      <SendEmailResponse xmlns="http://www.xxxxxx.nl/Webservice">
         <result>
            <success xsi:type="xsd:boolean">true</success>
            <message xsi:type="xsd:string">The message has been sent successfully</message>
         </result>
      </SendEmailResponse>
   </soap:Body>
</soap:Envelope>
i get the following respons:
Status: 200 OK
Content-Length: 592
Content-Type: text/xml; charset=utf-8
SOAPServer: SOAP::Lite/Perl/0.710.08
<soap:Envelope soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
   <soap:Body>
      <SendEmailResponse xmlns="http://www.xxxxxxx.nl/Webservice">
         <result>
            <success xsi:type="xsd:boolean">true</success>
            <message xsi:type="xsd:string">The message has been sent successfully</message>
         </result>
      </SendEmailResponse>
   </soap:Body>
</soap:Envelope>

When i try to fetch the response through:
objDomDocResponse := objXMLHTTP.responseXML; (objDomDocResponse = 'Microsoft XML, v3.0'.DOMDocument30' and objXMLHTTP = Microsoft XML, v3.0'.XMLHTTP) it doesn't load the response because when i try to save it to a physical file it's 0 Kb.
My guess is that the 4 headers in the respons is the cause because the same code worked fine when the headers weren't there.

Does anyone recognize this behaviour? Do you have any idea how to solve this?

Thanks for your help.

Comments

  • ara3nara3n Member Posts: 9,256
    try to use objXMLHTTP.response
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • BlackBirdBlackBird Member Posts: 52
    Thanks for the tip.
    Can you tell me if it's possible to remove the headers through these functions, or do i have to remove the headers and save the remainder as a physical file and pick it up again?
  • ara3nara3n Member Posts: 9,256
    I believe response returns only the body of the message, unless the webservice sends the Header messages inside the body.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
Sign In or Register to comment.