Wednesday, 14 February 2018

WS-Security Configuration in SAP HCI(CPI)

In the request wsdl we do not have the header structure, as this need to be enabled the security by WS security. We will see how we are going to add the ws security login details in header.
When trying to hit directly without HCI, we can see the request as:



Added WS-security in SOAP UI:


But when we are doing in the HCI, don’t use XSLT mapping and Groovy Script as that might not work. 

<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:cli="url" xmlns:com="url" xmlns:cli1="url">
   <soapenv:Header>
   <wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" >
            <wsse:UsernameToken xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" wsu:Id="UsernameToken-FqmwqrccDFGWEwe">
                <wsse:Username>ihub</wsse:Username>
                <wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">zrsdgffds32eef</wsse:Password>
            </wsse:UsernameToken>
        </wsse:Security>
        </soapenv:Header>  
         <soapenv:Body>
            <xsl:copy-of select="*"/>   
         </soapenv:Body>    
              </soapenv:Envelope>    
</xsl:template>
</xsl:stylesheet>


As the above xslt code not working, that adding the header is displayed in body on next step.now ws-security can't be achieved using XSLT.  So enable it in the channel as shown below.

Add the login details in the deployed artifacts before configuring channel.




Happy Learning!!!



1 comment: