0% found this document useful (0 votes)
4 views2 pages

SOAP Delivery Notification Parsing Guide

The document outlines a SOAP response structure containing a delivery order notification. It includes details on namespace registration and XPath queries to select specific nodes within the XML. A procedure is provided for parsing the response, ensuring proper XML formatting and namespace management.

Uploaded by

vit
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views2 pages

SOAP Delivery Notification Parsing Guide

The document outlines a SOAP response structure containing a delivery order notification. It includes details on namespace registration and XPath queries to select specific nodes within the XML. A procedure is provided for parsing the response, ensuring proper XML formatting and namespace management.

Uploaded by

vit
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

<soap:Envelope xmlns:soap="[Link]

org/soap/envelope/">
<soap:Body>
<deltaNotificationResponseElement
xmlns="[Link]
<responseData>
<notifications>
<notification>
<type>DELIVERY_ORDER_RECEIVED</type>
<deliveries>
<delivery
profile="pa160ac9c5795</delivery>
</deliveries>
</notification>
</notifications>
</responseData>
</deltaNotificationResponseElement>
</soap:Body>
</soap:Envelope>

Namespace Registration:

The XmlNamespaceManager is used to register the namespaces (soap and ns) with their
respective URIs.
XPath Query:
The XPath query includes the namespace prefixes (soap and ns) to correctly locate
the <notification> node.
Namespace Prefixes:
soap: Refers to the namespace [Link]
ns: Refers to the namespace
[Link]
Node Selection:
The SelectSingleNode method uses the namespace manager to resolve the prefixes in
the XPath query.

procedure ParseDeltaNotificationResponse(ResponseText: Text)


var
TempBlob: Codeunit "Temp Blob";
XmlDoc: XmlDocument;
RootNode: XmlNode;
NotificationNode: XmlNode;
NamespaceManager: XmlNamespaceManager;
InS: InStream;
OutS: OutStream;
XmlHeader: Text;
begin
// Add XML header if missing
XmlHeader := '<?xml version="1.0" encoding="UTF-8"?>';
if not StrPos(ResponseText, XmlHeader) > 0 then
ResponseText := XmlHeader + ResponseText;

// Write response to TempBlob


[Link](OutS, TextEncoding::UTF8);
[Link](ResponseText);
[Link](InS);

// Load XML document


if not [Link](InS) then
Error('XML document could not be loaded.');

// Get root node


if not [Link](RootNode) then
Error('XML document has no root element.');

// Create and configure namespace manager


NamespaceManager := [Link](XmlDoc);
[Link]('soap',
'[Link]
[Link]('ns',
'[Link]

// Select the <notification> node using the namespace


if [Link]('//soap:Body/ns:deltaNotificationResponseElement/
ns:responseData/ns:notifications/ns:notification', NamespaceManager,
NotificationNode) then begin
Message('Found notification node: %1',
[Link]().GetName());
end else
Error('No <notification> nodes found.');
end;

You might also like