cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

SOAP WS-RM in CAP nod js project

Philip_Nell_1
Discoverer
0 Kudos
338

I followed this SAP tutorial to consume a SOAP service from the Public Cloud (Consume SOAP Web Services in SAP Cloud Application Programming Model (CAP) | SAP Tutorials). The use case as defined in the tutorial is working 100%. I have updated the soap service to Proof Of Delivery (Overview | Proof of Delivery ‒ Update (B2B) | SAP Business Accelerator Hub). However, this service requires WS-RM to operate correctly. 

How do I configure WS-RM in a CAP project with a node.js backend? In PostMan, you can add the following header: 

    <soap:Header>
        <wsa:messageId>urn:uuid:{{$randomUUID}}</wsa:messageId>
    </soap:Header>
which solves the issue, but this is not working when adding it to node.js

Accepted Solutions (0)

Answers (1)

Answers (1)

Chuma
Active Contributor
0 Kudos

Hello @Philip_Nell_1 

Good news,The Proof of Delivery, Update (B2B) SOAP service in S/4HANA Public Cloud does not require the WS-ReliableMessaging. Instead, it expects WS-Addressing, which is why including wsa: MessageID in Postman enabled it to work.

Here’s the recommended setup for your CAP (Node.js) service:

What you should send

  • wsa:MessageID (unique per call, e.g. a UUID)
  • wsa:Action (exact value from the WSDL)
  • wsa:To (service endpoint from your Communication Arrangement)
  • wsa:ReplyTo = http://www.w3.org/2005/08/addressing/anonymous
  • Use your Communication User (Basic auth) from the S/4 communication arrangement

Minimal Node.js example (using soap and uuid)

import soap from 'soap';

import { v4 as uuidv4 } from 'uuid';

 

const WSDL_URL = process.env.POD_WSDL_URL;      // from BTP Destination

const ENDPOINT = process.env.POD_ENDPOINT_URL;  // from Comm. Arrangement

const ACTION   = '...exact Action from your WSDL...';

 

const client = await soap.createClientAsync(WSDL_URL, { endpoint: ENDPOINT });

client.setSecurity(new soap.BasicAuthSecurity(process.env.S4_USER, process.env.S4_PASS));

 

const wsa = `

<wsa:MessageID xmlns:wsa="http://www.w3.org/2005/08/addressing">urn:uuid:${uuidv4()}</wsa:MessageID>

<wsa:Action xmlns:wsa="http://www.w3.org/2005/08/addressing">${ACTION}</wsa:Action>

<wsa:To xmlns:wsa="http://www.w3.org/2005/08/addressing">${ENDPOINT}</wsa:To>

<wsa:ReplyTo xmlns:wsa="http://www.w3.org/2005/08/addressing">

  <wsa:Address>http://www.w3.org/2005/08/addressing/anonymous</wsa:Address>

</wsa:ReplyTo>`;

client.addSoapHeader(wsa);

 

const req = { /* your PoD payload */ };

const [resp] = await client.ProofOfDeliveryUpdateRequest_InAsync(req);

Common gotchas

  • Make sure the WS-Addressing namespace is exactly: http://www.w3.org/2005/08/addressing.
  • Use the precise wsa: Action from the PoD WSDL (it’s case-sensitive).
  • Read endpoint/user/password from a BTP Destination, not hard-coded

With kind regards

Chuma

 

 

GenAI Assisted Content (Useful references)

Proof of Delivery – Update (B2B) SOAP service (API Hub): official service page for the PoD inbound SOAP you’re calling

CAP tutorial – Consume SOAP Web Services in CAP (Node.js😞 step-by-step guide for wiring SOAP in a CAP Node.js service (basis for the sample code)

Example of WS-Addressing MessageID requirement in S/4HANA Cloud SOAP: SAP Help page for a product SOAP service that explicitly mandates a unique MessageID in the SOAP header (illustrates the WS-Addressing pattern many S/4 Cloud SOAP services use).