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: 
Dimitri
Active Contributor

Reading the SOAP header when a web service is consumed seems to be an easy task. Nothing could be further from the truth in my case. It really took some time to realize. That is the reason for this blog, to share my thoughts, problems and insides with the community.

System

We use a SAP PI 7.11 SP11 system to realize this scenario.

Context and requirement

It all starts with the requirement to know who consumed a web service and to store that information on the SAP back end system. It means that a user ID must be provided within the SOAP call, but the requirement is not to put this in the message body, but dynamically in the SOAP header.

The input message could look like this

What preceded it were a blog and the follow-up.

*** Important remark     Please note that this blog is based on Service Interfaces containing only 1 operation.

                                          Currently, it does not work with multiple operations within 1 service interface.

                                See Open items and doubts section below.

Configuration

The input structure looks like this

DT_input

     Name

The output structure looks like this

DT_output

     UserID

     Name

The objective is to fill the UserID field with the value of the AuditUser field within the SOAP header. To accomplish this, an XSLT mapping will be used. No other mappings are being used within the Operation Mapping step.

This is the XSLT mapping I used:

<?xml version="1.0" encoding="UTF-8"?>

<xsl:stylesheet version="1.0" xmlns:xsl=http://www.w3.org/1999/XSL/Transform xmlns:ns1="namespace">

  <xsl:template match="/">

            <ns1:DT_output>

                  <UserID><xsl:value-of select="*/*/AuditUser"/></UserID>

                  <Name><xsl:value-of  select="*/*/DT_input/Name"/></Name>     

</ns1:DT_output>

  </xsl:template>

</xsl:stylesheet>

Concerning the Integration Directory, a sender SOAP adapter is used and the option Do Not Use SOAP Envelope is enabled.

Also, I added nosoap=true in the URL in soapUI, to allow sending messages in no soap mode. In that case, the SAP PI system puts the complete message in the payload.

After successful tests, I still have some doubts and things I want to clarify…

Open points and doubts

  • What about multi-operation Service Interfaces? I already started with a thread on this topic. I also created a new thread.
  • For testing purposes, I use soapUI, but for real scenarios, Microsoft Visual Studio will be used. What about enabling the no soap mode there? Check out this thread.
  • What about the SAP Enterprise Service explorer for Microsoft.NET, compatible with Microsoft Visual Studio 2012 and 2013? Is there any? For MS Visual Studio 2008, I know there is one.

Once these open points and doubts are cleared out, I will update this blog to have everything in 1 place.

[UPDATE]


Just a tip to quickly test/modify an XSLT mapping and immediately see the result: go to XSLT Tutorial and click on the button try it yourself.

On the left side of the screen, put the XML structure entering the SAP PI or PO system. And on the right side of the screen, put your XSLT mapping code.

Press the button Edit and Click me and see the conversion result at the bottom of the screen.

Special thanks go to antonio.sanz for helping me out with the XSLT mapping and the scenario.

8 Comments
Labels in this area