Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
robertot4s
Active Participant

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:




 

  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:




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



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



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



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:




 

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




 

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



 

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




 

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:




 

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:




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

8 Comments
Labels in this area