on 05-16-2017 10:07 PM
Hi Expert,
I want to send user and pass in the header to soap receiver, but it does not work.
I have created the following xslt mapping
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:map="java:java.util.Map"
xmlns:dyn="java:com.sap.aii.mapping.api.DynamicConfiguration"
xmlns:key="java:com.sap.aii.mapping.api.DynamicConfigurationKey">
<xsl:output method="xml" encoding="utf-8" indent="no"/>
<xsl:param name="inputparam"/>
<xsl:template match="/">
<xsl:variable name="dynamic-conf"
select="map:get($inputparam, 'DynamicConfiguration')" />
<xsl:variable name="dynamic-key"
select="key:create('http://sap.com/xi/XI/System/SOAP', 'XHeaderName1')" />
<xsl:variable name="dynamic-value"
select="dyn:get($dynamic-conf, $dynamic-key)" />
<xsl:variable name="new-value"
select="concat($dynamic-value, 'admin')" />
<xsl:variable name="dummy"
select="dyn:put($dynamic-conf, $dynamic-key, $new-value)" />
<xsl:variable name="dynamic-key1"
select="key:create('http://sap.com/xi/XI/System/SOAP', 'XHeaderName2')" />
<xsl:variable name="dynamic-value1"
select="dyn:get($dynamic-conf, $dynamic-key1)" />
<xsl:variable name="new-value1"
select="concat($dynamic-value1, 'admin')" />
<xsl:variable name="dummy1"
select="dyn:put($dynamic-conf, $dynamic-key1, $new-value1)" />
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tem="http://tempuri.org/">
<soapenv:Body>
<xsl:copy-of select="*" />
</soapenv:Body>
</soapenv:Envelope>
</xsl:template>
</xsl:stylesheet>
In the communication channel, I have marked "Do not use SOAP Envelope" and "Keep Headers"
And Activated ASMA
I have marked the option "Use SAP XML Toolkit" in OM
When I run no error appears in sxi_monitor, and generates the following xml without tag header:
But "DynamicConfiguration" is OK.
Finally the response from the webservice indicates that neither user nor paaword has been sent:
Any help will be highly appreciated.
Regards, Joel
Hi,
Thank you for answering me, when it is static if it works, but the values must be variable and sent from the abap proxy.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Joel!
If your header elements are static you can use AddSOAPHeaderBean to add it to message header:
https://blogs.sap.com/2013/11/22/addsoapheaderbean-module/
Otherwise you should manually construct Header section of SOAP message in your XSL transformation. That's what you set parameter "Do not use SOAP Envelope" for.
Something like this:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Header>
<ServiceAuthHeader xmlns="http://WIND.WEBSERVICES.DMS/">
<Username>USER</Username>
<Password>PASSWORD</Password>
</ServiceAuthHeader>
</soap:Header>
<soap:Body>
<xsl:copy-of select="*"/>
</soap:Body></soap:Envelope>
</xsl:template>
</xsl:stylesheet>
Regards, Evgeniy.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Your username and password is static or it will vary?
Thanks,
Apu
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
9 | |
7 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.