Skip to content

qie.parseSoapContent

Signature: qie.parseSoapContent(content, multiPartResponse, encoding*)

Returns: String parsedContent - the parsed content as a string

When calling a soap web service with the 'fullResponse' option, then this call is used to parse the content.

Note

This will only return the root content with all the references replaced with the base64 encoded part. If the other parts are not referenced in the root part, then they are ignored.

Parameters

Type Name Description Default
byte[] content the content from the fullHttpResponse
Boolean multiPartResponse indicates if the content is MTOM content. If the content-type contains the text 'multipart', then it is MTOM content.
String encoding* (optional) the character encoding for this message UTF-8

Example

// Example: parse raw SOAP content from a full HTTP response (MTOM multipart)
var rawHttpResponse = `
HTTP/1.1 200 OK
Content-Type: multipart/related; boundary="boundary123"; type="application/xop+xml"; start="<rootpart@soap.example>"; start-info="text/xml"

--boundary123
Content-Type: application/xop+xml; charset=UTF-8; type="text/xml"
Content-ID: <rootpart@soap.example>

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <Response>
      <Document>
        <xop:Include href="cid:doc1@attachments.example"
                     xmlns:xop="http://www.w3.org/2004/08/xop/include"/>
      </Document>
      <Image>
        <xop:Include href="cid:image1@attachments.example"
                     xmlns:xop="http://www.w3.org/2004/08/xop/include"/>
      </Image>
    </Response>
  </soap:Body>
</soap:Envelope>

--boundary123
Content-Type: application/pdf
Content-ID: <doc1@attachments.example>

JVBERi0xLjUKJcTl8uXrp4IK
--boundary123
Content-Type: image/jpeg
Content-ID: <image1@attachments.example>

/9j/4AAQSkZJRgABAQEAAAAAAAD/2wCEAAEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEB
--boundary123--
`;

// Parse MTOM SOAP content, replacing xop:Include references with base64 data
var parsedSoapContent = qie.parseSoapContent(
        new java.lang.String(rawHttpResponse).getBytes("UTF-8"),
        true
); // <parsed SOAP XML with inlined base64 content>