cancel
Showing results for 
Search instead for 
Did you mean: 

R/3->PI->webservice. Pass userid/password for Username Token from R/3

former_member195698
Active Contributor
0 Kudos

Hello,

We (SAP R/3) need to call Webservices from third party for which we are using SAP-PI system as the Middleware.

The Password and ID for USERNAME TOKEN to be passed in the SOAP Header request needs to be sent through RFC in SAP R/3.

The requirement is that SAP-PI should use this ID/password and prepare the USername Token in the SOAP Request header for the Webservice Call.

Note: PI has AXIS framework installed on it.

Can you please suggest as to what should be done? Request you to please provide the Custom Code / Detailed configuration etc. that is required to be done at the PI end.

Note: I have searched the Forum but couldn't find anything a detailed information.

Thanks & Regards,

Abhishek Jolly

Accepted Solutions (1)

Accepted Solutions (1)

stefan_grube
Active Contributor
0 Kudos

There is an FAQ note for the Axis adapter with an example for this scenario.

Sorry, i do not know the note number.

former_member195698
Active Contributor
0 Kudos

Hello Stefan,

I have seen the FAQ on AXIS adapter ("SAP Note 1039369 FAQ XI Axis Adapter ") but I couldn't find the exact Code that needs to be written to handle this scenario.

<soapenv:Header>

<wsse:Security>

<wsse:UsernameToken>

<wsse:Username>"This will come from RFC in SAP R/3"</wsse:Username>

<wsse:Password Type="PasswordText">"This will come from the RFC in SAP/R3"</wsse:Password>

</wsse:UsernameToken>

</wsse:Security>

</soapenv:Header>

I want to have the above Header created with Password and ID coming from RFC in SAP R/3.

Thanks & Regards,

Abhishek

former_member195698
Active Contributor
0 Kudos

Hello All,

Your valuable inputs are awaited.

Regards,

Aj

Former Member
0 Kudos

The help contains a suggestion how to use AXIS framework to set something like cookies in HTTP header. You can find by Google a PDF named "How Tou2026 Set http-Header Parameters using the Axis Framework" (http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/b092777b-ee47-2a10-17b3-c5f59380957f?quicklink=index&overridelayout=true)

I don't use AXIS framework, couse I need to set something in SOAP Header, not in HTTP Header.

In this topic it resolved by Java-mapping:

I use an XSLT mapping in Interface Determination to transform message, comes from BPM to message that goes as SOAP Request.

Message that goes from BPM to Adapter in SendStep of BPM looks like this:

<soap:Envelope><soap:Header/><soap:Body><SessionId>123567890</SessionId><.....></soap:Body>

Message that goes from Adapter is:

<soap:Envelope><soap:Header><SessionId>123567890</SessionId></soap:Header><soap:Body><.....></soap:Body>

SOAP Response I also transforms by XSLT.

former_member195698
Active Contributor
0 Kudos

Hello Vsevolod,

Thanks for the inputs. I could only find that using Java Mapping / XSLT mapping its possible but "How to do this mapping"?

Any "Help document" might solve my problem.

Regards,

Abhishek

Former Member
0 Kudos

Month ago I didn't find an any help documents, and I had to create this way of sending SOAP by myself. 😃

For learning how transform one message to other - check this site http://www.w3schools.com/xsl/xsl_w3celementref.asp

To create transformation very simple and quick - try to use an any XML Tools like Altova XMLSpy or Oxigen XML Editor. They has a debugger for XSLT! I use an Oxigen.

1) XSLT mapping.

XI looks only on structure of XML, not a namespace. XI ignore namespace, but SOAP Target can be very capricious.

This is envelope that needs for SOAP Target:


<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wsh="http://something/wsh">
   <soapenv:Header>
        <wsh:Context>
            <SessionId>0123456789</SessionId>
        </wsh:Context>
    </soapenv:Header>
    <soapenv:Body>
        <wsh:MySoapFunction>
            <Parameters>
                <Parameters>
                    <Scope>otherScope</Scope>
                    <Name>someParam</Name>
                    <Value>someValue</Value>
                </Parameters>
        </wsh:MySoapFunction>
    </soapenv:Body>
</soapenv:Envelope>

First problem: 3 namespaces - "soapenv", "wsh", and empty namespace (some tags must be without namespace!). Second problem: SessionID must be in the Header tag. And SOAP Target is a very capricious, something changes and SOAP call faults.

...

Former Member
0 Kudos

...

XSLT-Mapping looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
 <xsl:output method="xml" indent="yes"/>
 <xsl:template match="/">
   <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:wsh="http://something/wsh">
     <soapenv:Header>
       <wsh:Context>
       <SessionId>
         <xsl:value-of select="/*[local-name()
=MySoapFunction]/Parameters/Parameters
[Scope[text()='XI'] and Name[text()='SessionID']]/Value"/>
      </SessionId>
     </wsh:Context>
    </soapenv:Header>
    <soapenv:Body>
     <wsh:MySoapFunction>
      <xsl:if test="count(./*[local-name()=MySoapFunction]/Parameters/Parameters)>1">
       <Parameters>
         <xsl:for-each select="./*[local-name()=MySoapFunction]/Parameters/Parameters">
           <xsl:if test="Scope!='XI'">
             <Parameters>
               <Scope><xsl:value-of select="Scope"/></Scope>
               <Name><xsl:value-of select="Name"/></Name>
               <Value><xsl:value-of select="Value"/></Value>
              </Parameters>
             </xsl:if>
           </xsl:for-each>
          </Parameters>
         </xsl:if>
       </wsh:MySoapFunction>
      </soapenv:Body>
 </soapenv:Envelope>

I save XSLT to file.

Input message that creates in XI and live only in BPM:

<?xml version="1.0" encoding="UTF-8"?>
<ns0:MySoapFunction xmlns:ns0="http://something/wsh">
    <Parameters>
        <Parameters>
            <Scope>XI</Scope>
            <Name>SessionID</Name>
            <Value>0123456789</Value>
            </Parameters>
        <Parameters>
            <Scope>otherScope</Scope>
            <Name>someParam</Name>
            <Value>someValue</Value>
         </Parameters>
    </Parameters>
</ns0:MySoapFunction>

In BPM's SendStep this message is used.

2) Create ZIP archive with this XSLT file (one archive can contains many XSLT programs). And Import ZIP it into XI. You can see this in Imported Archive and list of filenames of Archived Program in XI.

...

Former Member
0 Kudos

3) Create Operation Mapping.

At source set BPM message, at target - SOAP message from WSDL-file.

Choose a Type of Mapping Program - XSL - than choose a XSLT filename.

After that I set this Operation Mapping in Interface Determination.

Without setted channel parameter "Do not use Envelope" your message wrapped in envelope tags twice. 😃

Maybe you had to do something like this and for Response messages, for reverse transformation from SOAP Response to BPM Response Message.

Regards.

former_member195698
Active Contributor
0 Kudos

Thanks a lot for the inputs.

Our PI team says that since AXIS framework is installed, we have to use JAVA Mapping for preparing the USERNAME TOKEN in the SOAP header through custom code.

Do you have any information on writing the custom code or a sample for the "username token".

Your valuable inputs are awaited.

Regards,

Abhishek

Former Member
0 Kudos

Hi SAP PI group

could someone help me with SOAP adapter configuration for security section.

I have similar issue with Receiver SOAP adapter using HTTP protocol and soap1.1 message protocol.

I have enabled the user authentication and security paramerts section and selected the web services security profile.

However I couldn't generate the soap header security section as mentioned below.



<soapenv:Header>
    <wsse:Security soapenv:mustUnderstand="1" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
      <wsse:UsernameToken wsu:Id="UsernameToken" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
        <wsse:Username>USERNAME</wsse:Username>
        <wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">PASSWD</wsse:Password>
        <wsse:Nonce EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary">8dkiLKuEm7oWToMzEa==</wsse:Nonce>
        <wsu:Created>2011-02-28T12:08:11.382Z</wsu:Created>
      </wsse:UsernameToken>
    </wsse:Security>
</soapenv:Header>

I have gone through different posts in the forum and thought to post the question on this thread which is relevant issue.

Any pointers or help would be appreciated.

Former Member
0 Kudos

Hi all - I have the same issue. If anyone has done this preferably with the Axis adapter, please let us/me know.

Thanks,

Keith

Answers (0)