Skip to Content
Author's profile photo Roberto Clemente

Asynchronous processing of third-party system messages in SAP ECC using WS-RM

The traditional use of web services in SAP ECC (Publish functions modules from SE37 transaction) has some disadvantages that in a lot of cases motivate the adoption of more complex solutions (file processing, middleware use, etc.).

   

In my opinion, the main disadvantages of traditional web service are:

  • Message Persistence does not exist. This makes impossible: Message monitoring (making error detection more complex), message reprocessing or cancelation.
  • Asynchronous message processing in order (EOIO) is not permitted. In a standard way, the calls to these web services are processed in parallel by the application server. In some cases,

 

Since SAP NetWeaver 7.0 SP 14, Web Services Reliable Messaging (WS-RM) has been introduced in ABAP stack. From the point of view of SAP systems integration, WS-RM provides reliable delivery of asynchronous messages using the SOAP protocol. The guide How To… Develop, Monitor and Debug WS Consumer and Provider provides details on how to configure WS-RM in SAP NW.

    

With WS-RM it is possible to process messages in order and also to persist them in the same persistence layer as the messages from SAP PI ABAP proxies. This has some important advantages: Message monitoring, message reprocessing or cancelation of erroneous messages.

    

But, how can we take advantage of WS-RM capacities for third-party system integration? In order to respond to this question, the next example simulates the sending of some messages from a web service traditional client through the soapUI tool to a SAP ECC.

    

First, we have configured our SAP ECC system (7.01 SP8 version) following the guide indicated above, and we have implemented a simple example service (ZEgpFmHolaMundoas, Asynchronous “Hello World in Spanish” 🙂 ) that receives a company code and stores it in a table.

      

The message sequence is the following:

/wp-content/uploads/2012/09/diagrama_de_secuencia_141204.jpg

 

  1. CreateSequence: Creates a sequence, with a queue associated for message processing.
  2. First message is sent. This message contains the sequence identifier created in the previous step and the data for our service (company code).
  3. Second message is sent, with different data (different company code).
  4. TerminateSequence: This message terminates the sequence created.

These steps are described with more detail below:

CreateSequence:

This message has the following structure:

 

<soapenv:Envelope xmlns:soapenv=”http://schemas.xmlsoap.org/soap/envelope/“>

     <soapenv:Header xmlns:wsa=”http://www.w3.org/2005/08/addressing“>

              <wsa:Action>http://schemas.xmlsoap.org/ws/2005/02/rm/CreateSequence</wsa:Action>

<wsa:MessageID>uuid:679f5980-a77a-4235-b44c-8dbb2a5a8b0d</wsa:MessageID>

<wsa:To>http://<host>:<port>/sap/bc/srt/rfc/sap/zhola_mundoas/200/zhola_mundo_as/zhola_mundo_as</wsa:To>

     </soapenv:Header>

<soapenv:Body xmlns:wsrm=”http://schemas.xmlsoap.org/ws/2005/02/rm“>

          <wsrm:CreateSequence>

<wsrm:AcksTo xmlns:wsa=”http://www.w3.org/2005/08/addressing“>

                    <wsa:Address>http://www.w3.org/2005/08/addressing/anonymous?id=8175d846-de01-4c27-8975-6705443c06d3</wsa:Address>

               </wsrm:AcksTo>

          </wsrm:CreateSequence>

     </soapenv:Body>

</soapenv:Envelope>

For testing we used the soapUI tool. We didn’t check the flag “Enable/Disable WS-Reliable Messaging”, because we were simulating WS-RM sending messages individually:

/wp-content/uploads/2012/09/soap_ui_141205.jpg

The response received contains the identifier of the sequence created. This identifier must be used in the subsequent messages:

/wp-content/uploads/2012/09/soap_ui_response_141209.jpg

In SAP ECC, this sequence has been created, as we can see in SRT_TOOLS transaction, “Sequence Monitor” option:

/wp-content/uploads/2012/09/sequence_step1_141210.jpg

This sequence has a queue associated, ready to process messages:

/wp-content/uploads/2012/09/queue_associated_141211.jpg

First Message:

In this message, the sequence identifier is indicated in field Identifier, and the Body tag contains the message for our service:

 

<soapenv:Envelope xmlns:soapenv=”http://schemas.xmlsoap.org/soap/envelope/” xmlns:urn=”urn:sap-com:document:sap:soap:functions:mc-style”>

     <soapenv:Header xmlns:wsa=http://www.w3.org/2005/08/addressing xmlns:wsrm=”http://schemas.xmlsoap.org/ws/2005/02/rm“>

          <wsrm:Sequence>

               <wsrm:Identifier>55B058504B256C4FE10000000A020477</wsrm:Identifier>

               <wsrm:MessageNumber>1</wsrm:MessageNumber>

          </wsrm:Sequence>

          <wsa:Action>urn:sap-com:document:sap:soap:functions:mc-style/ZHOLA_MUNDOAS/ZEgpFmHolaMundoasRequest</wsa:Action>

          <wsa:MessageID>uuid:039390e5-bc4c-475a-94d4-6e85758e36fe</wsa:MessageID>

          <wsa:To>http://<host>:<port>/sap/bc/srt/rfc/sap/zhola_mundoas/200/zhola_mundo_as/zhola_mundo_as</wsa:To>

     </soapenv:Header>

     <soapenv:Body>

          <urn:ZEgpFmHolaMundoas>

               <Bukrs>1122</Bukrs>

          </urn:ZEgpFmHolaMundoas>

     </soapenv:Body>

</soapenv:Envelope>

 

The response received is an acknowledgment message (ack) that indicates the message has been successfully enqueued for its processing.

       

In SAP ECC, the sequence status has changed:

/wp-content/uploads/2012/09/sequence_step2_141227.jpg

 

The message processing can be monitored from SXMB_MONI transaction. This represents one of the main advantages of this solution:

/wp-content/uploads/2012/09/xml_messages_1_141228.jpg

 

From this transaction it is possible to see the message content:

/wp-content/uploads/2012/09/xml_messages_1_detail_141229.jpg

 

If an error occurs during the asynchronous processing, it is possible to restart the message processing or cancel it with the following buttons:

/wp-content/uploads/2012/09/restart_cancel_141230.jpg

 

Second Message:

 

This message has the same structure of the first message. The only changes are the message number (field MessageNumber) and the body of the message (company code).

       

The message is processed in the same queue as the first message, and we can also monitor it in SXMB_MONI transaction:

/wp-content/uploads/2012/09/xml_messages_2_141231.jpg

 

TerminateSequence:

 

Finally, once the messages have been sent, it must be necessary to terminate the sequence with the following message:

 

<soapenv:Envelope xmlns:soapenv=”http://schemas.xmlsoap.org/soap/envelope/“>

     <soapenv:Header xmlns:wsa=”http://www.w3.org/2005/08/addressing“>

          <wsa:Action>http://schemas.xmlsoap.org/ws/2005/02/rm/TerminateSequence</wsa:Action>

          <wsa:MessageID>uuid:5d5425a5-726d-40ff-8ecc-6eca9fd9b653</wsa:MessageID>

          <wsa:To>http://<host>:<port>/sap/bc/srt/rfc/sap/zhola_mundoas/200/zhola_mundo_as/zhola_mundo_as</wsa:To>

     </soapenv:Header>

     <soapenv:Body xmlns:wsrm=”http://schemas.xmlsoap.org/ws/2005/02/rm“>

          <wsrm:TerminateSequence>

               <wsrm:Identifier>55B058504B256C4FE10000000A020477</wsrm:Identifier>

          </wsrm:TerminateSequence>

     </soapenv:Body>

</soapenv:Envelope>

In SAP ECC, the sequence status has changed again, and it will be deleted by the execution of a batch process:

/wp-content/uploads/2012/09/sequence_step3_141233.jpg

Next links provide more information about WS-RM protocol and web services in SAP:

Assigned Tags

      8 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Claudio Capra
      Claudio Capra

      Hi Roberto,

      thanks for your clear blog.

      I need a monitor for synchronous Web service(Publish functions modules from SE37 transaction) .

      can you help me?!

      thanks in adevance.

      regards.

      Claudio

      Author's profile photo Roberto Clemente
      Roberto Clemente
      Blog Post Author

      Hi Claudio,

      As far as I know, you can't monitor these web services 🙁

      You can see the errors in the ICM Monitor (SMICM transaction), and monitor the workload and statistics in the workload monitor (ST03N transaction), but you can't monitor the payload and details of the messages.

      Regards,

      Roberto

      Author's profile photo David Encinas Fernandez
      David Encinas Fernandez

      Hi Roberto,

       

         Did you manage to get this working with authentication enabled? SOAPUI is not sending the user and password for the first soap messages (start sequence) so I always get login errors.

         Thanks in advance,

            David.

      Author's profile photo Roberto Clemente
      Roberto Clemente
      Blog Post Author

      Hi David,

      We worked with authentication disabled, because we used a test system.

      Regards,

      Roberto

      Author's profile photo Rodrigo Castro
      Rodrigo Castro

      Que bueno Roberto!

      Con dibujos y todo!

      Un abrazo!

      Author's profile photo Former Member
      Former Member

      Nice blog for people starting on WS-RM in ABAP.Thanks.

      Author's profile photo Former Member
      Former Member

      Hi

      I am trying to access an enterprise service delivered by SAP from SOAP UI.

      I have enabled the all the settings that you have mentioned SRT_ADMIN_CHECK is green

      I have not enabled WSRM in SOAP UI, i have used your create sequence in the request.

      I keep getting this error "Only the anonymous value for wsrm:AcksTo is supported"

      Any clues ?

      Also when i enable WSRM and WSA in  SOAP UI and try the same i can see that first SOAP UI tries to createsequence then 2nd and 3rd step mentioned here.
      There i get a "HTTP 401 Unauthorized."

      I have created a service endpoint with BASIC auth in SOAMANAGER.

      Could you please give some pointers?

      regards

      Muru

      Author's profile photo Claudio Capra
      Claudio Capra

      Hola Roberto,

      do you think it's possible to define a Queue Name(BGRFC) from a parameter of a provider asyncronouns web service?

      Thanks in advance

      Regards.