“AddSOAPHeaderBean” module
AddSOAPHeaderBean? thinking??, is it a custom adapter module?? Well, it is a standard SAP module but unfortunately no where documented ๐
1. What is the use?
As the module name indicates, we can add our own custom soap headers for incoming and outgoing message in XI using this module
2. How to use in channel?
Simply add AF_Modules/AddSOAPHeaderBean in require channel as a local ejb type with a module key entry e.g., 0, ns, auth etc.. as per your requirement
3. What parameters it supports?
Mandatory Parameter: namespace as key and it’s value e.g., namespace http://customheader.com
Optional Parameters: any textual key, pair values. Each key will become a soap header tag with the maintained value in module configuration
The module key will be suffixed with static ‘ns’ string and will become namespace prefix for each soap header that is required via this module
e.g., if modulekey is 0, key is hdr1, value is 1234 then below value will be added in SOAP Header
<SOAP:Header><ns0:hdr1 xmlns:ns0=’http://customheader.com‘>1234</ns0:hdr1></SOAP:Header>
4.Use cases
Case1: for modulekey is 0, namespace http://customheader.com and hdr1 1234
Result:
<SOAP:Header>
<ns0:hdr1 xmlns:ns0=’http://customheader.com‘>1234</ns0:hdr1>
</SOAP:Header>
Case2 (tricky one): for modulekey is 0, namespace http://customheader.com and authenticationHdr <UserName>Praveen Gujjeti</UserName><Password>exposedpasswordinID</Password>
Result:
<SOAP:Header>
<ns0:authenticationHdr xmlns:ns0=’http://customheader.com‘>
<UserName>Praveen Gujjeti</UserName>
<Password>exposedpasswordinID</Password>
</ns0:authenticationHdr>
</SOAP:Header>
Case3 (same as case2, but we can hide all header params in ID): for modulekey is 0, namespace http://customheader.com and pwd.authenticationHdr <UserName>Praveen Gujjeti</UserName><Password>passwordNotExposedinID</Password>
Result:
<SOAP:Header>
<ns0:authenticationHdr xmlns:ns0=’http://customheader.com‘>
<UserName>Praveen Gujjeti</UserName>
<Password>passwordNotExposedinID</Password>
</ns0:authenticationHdr>
</SOAP:Header>
5. What other alternative solutions are available to add custom SOAP headers?
Well, adding custom soap headers has been a frequent integration requirement in XI world since XI3.0. Java/XSLT mapping to create custom headers is one such option. And recently, this feature was also introuduced with AXIS HandlerBean module. Also this feature seems to be available with WS adapter with some limitations
References for Alternative solutions
http://scn.sap.com/community/pi-and-soa-middleware/blog/2013/03/18/axis-adapter-sender-comm-channel-with-usernametoken
http://scn.sap.com/community/pi-and-soa-middleware/blog/2012/06/05/soap-axis-receiver-communication-channel–how-to-remove-xi-headers-from-payload
**Note: Though this module is a standard SAP one, but since it is not documented and released officially by SAP, developers should use this module at their own risk.
Regards,
Praveen Gujjeti
Thank you Praveen! I used to see this module in the JNDI browser but there is no documentation. Now we can run some simple header addition without resorting to no soap mode.
Regards,
Mzrk
Indeed Mark ๐
Best Regards,
Praveen Gujjeti
Hi Praveen,
I want to construct below SOAP Header in SAP PO 7.4, will it be possible using this adapter module, please advice:
Can we modify the namespace from ns0 to wsse ?S I get below error: SOAP: Response message contains an errorXIAdapter/PARSING/ADAPTER.SOAP_EXCEPTION - soap fault: An error was discovered processing the <wsse:Security> header.
Hi Praveen,
Thank you so much for sharing this information.
I will try to implement in upcoming projects if it required!
I appreciate.
Regards,
Hari Suseelan
Thanks Hari
Hi Praveen,
You are welcome.
Keep sharing and rocking as usual.
All the best!
Regards,
Hari Suseelan
Hi Praveen,
Good to know about the hidden module via this blog ...keep blogging..
Regards
Rajesh
Thanks Rajesh.
Thank you, This information is very important for me, I did this with java Mapping and check do not use envelope on receiver channel. now I have a question, How can I set parameter value dynamically?.
The idea is use message mapping and set parameter value for UDF.
Thank you.
Hello Johan,
Sorry, I didn't understand your question completely. Can you please explain a little more..
As far as I understood, you are expecting a dynamic value for parameter value in module configuration. AFAIK, there is no standard way we can pass value dynamically to the module configuration parameters.
Best Regards,
Praveen Gujjeti
Thank you for you answer.
I want to set parameter value the module from UDF in message mapping
thank you.
Well, this is long overdue.. I've spent countless hours for unsuccessful attempts at writing Java mappings, adapter modules etc. only to be able to pass some custom SOAP header data, only to be "ignored" by the SOAP adapter. It's kinda frustrating to see there was even a standard module for it, which is not even documented. Thanks Praveen for pointing it out, much appreciated!
Praveen, nice blog.
I have basic question, althought it is already answered here only but wanted to get some real time examples.
My question is why do we need to add additional soap header, what is the use of it?
Can anyone share example to showcase need of the same.
--Divyesh
Hello Divyesh,
Some applications hosting webservices handle messages in a different way using SOAP header such as for e.g., "WS-Security Username Authentication" as per this link WS-Security Username Authentication.
Also in general, using soap header information one application hosting this webservice can process the message and then can forward the message to another application hosting same or a different webservice for further processing of message. The same concept can be realized within PI system for e.g., SOAP header information gets modified during each pipeline stage of message processing
Best Regards,
Praveen Gujjeti
Got it, Praveen.
Thanks for your explaination and examples.
--Divyesh
Hi Praveen,
From which PI version we can use AF_Modules/AddSOAPHeaderBean? We are using PI 7.0 SP 12, but we find we couldn't use it cause the communication channel monitoring gave the following the error after we configured that parameter: "com.sap.engine.services.jndi.persistent.exceptions.NameNotFoundException: Object not found in lookup of AddSOAPHeaderBean."
Thanks.
Hi xinjiang li,
As far as I know, AF_Modules/AddSOAPHeaderBean module is available from PI7.11 version on wards.
Regards,
Praveen Gujjeti
OK, thanks a lot.
Hi,
where I can see results like these?():
<SOAP:Header>
<ns0:authenticationHdr xmlns:ns0='http://customheader.com'>
<UserName>Praveen Gujjeti</UserName>
<Password>passwordNotExposedinID</Password>
</ns0:authenticationHdr>
</SOAP:Header>
I have configured but not working, I guess that's the manespace, I need to remove it, any ideas?.
Regards.
Hi Maximiliano Colman,
If you configure the AddSOAPHeaderBean module in sender channel, then you should be able to check added soap header in Moni.
And if configure the module in receiver channel, then you should be able to realize added headers in receiving (target) application system if it logs
For testing purposes, you can also simulate receiver mode by creating a mock webservice in SOAP UI and then by sending message with module configuration in PI to mock webservice endpoint and then you can watch the soap headers in SOAP UI mock service editor
//BR,
Praveen Gujjeti
Thank you very much! I do not understand how I could live without knowing the Mock Services in SOAP UI!
Hi Praveen,
Thanks a lot for sharing this information. It will help us a lot.
Regards,
Partha
Hi Praveen,
I just create a demo as what you instructed in the article. However I could not find the ideal SOAP header I want in the moni.
The following is the configuration:
And in addition, in the msg log I could find that
Did I miss something important?
Regards,
Leon
Hi Leon,
In general, the default adapter modules (in this case it is callSapAdapter) for any adapter channel should always be the last in module configuration for all Asynchronous communications. So, move the AddSOAPHeader Bean as first module in channel configuration and activate.
** One general point for SOAP sender adapter channel since it has some limitations with standard SAP/custom adatper modules. check this: Can modules be added to the sender SOAP adapter?
Please let us know the outcome
Best Regards,
Praveen Gujjeti
Hi Praveen,
I just moved the AddSOAPHeader Bean as the first module and try it again and happy to tell you that I could successfully find the additional data in the SOAP header.
Many many thanks.
Best Regards,
Leon Luo
Cheers ๐ .. And thanks for the update
//BR,
Praveen Gujjeti
Good blog Praveen.
so no need of going for axis framework like below one.
How to Configure AXIS Framework for Authentication Using the "wsse" Security Standard in SAP PI
i missed this blog else could have used it instead of going for axis framework ๐
Regards,
Muni.
Hi Praveen,
I have a use case where the receiver expects the "To" element in the header like:
<s:Envelope xmlns:a="http://www.w3.org/2005/08/addressing" xmlns:s="http://www.w3.org/2003/05/soap-envelope">
<s:Header>
<a:To s:mustUnderstand="1">https://myurl.com/spml</a:To>
</Header>
...
I Wonder how to configure this using AF_Modules/AddSOAPHeaderBean?
I have tried allmost anything. The problem is: How do I get the mustUnderstand attribute into the "To" element?
Any suggestions?
Best Regards,
Olaf Bertelsen
Thank you Praveen - nice blog.
Does anybody know if there is somthing similar the way around - getSOAPHeaderBean which fills XHeaderName1 on which we have access within user defined functions?
Or do we have the source of that AddSOAPHeaderBean?
Thanks for any idea.
Best regards
Stefan
Thanks Stefan
Please wait for few days, you should have my new blog on 'getSOAPHeaderBean' custom module. I will update the blog info here...
Best Regards,
Praveen Gujjeti
Hi Praveen,
I tried to add the module in Soap sender channel.But not getting soap headers which I added as parameters in ModuleConfig tab.Please have a look and suggest me how to get the headers.
After adding the module, below is the log in msg monitor
Hi Praveen,
I want to construct below SOAP Header in SAP PO 7.4, will it be possible using this adapter module, please advice:
Can we modify the namespace from ns0 to wsse ? I get below error: SOAP: Response message contains an errorXIAdapter/PARSING/ADAPTER.SOAP_EXCEPTION - soap fault: An error was discovered processing the <wsse:Security> header.\
I have tried below configuration in Module:
name: Security value: <UsernameToken><Username>2</Username><Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">pass1234</Password></UsernameToken>
name : namespace value : http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd
Hi Ravijeet,
Could you please tell me what solution you used to get this output? I have a similar requirement of Soap header with WSSE.
Thanks
Minal Bakore
Hi Minal,
I had used this module to insert the soap security header. It is working good in Production.
Thanks
Ravijeet
Hi Ravijeet,
Did you manually insert the soap security header under pwd.authenticationHdr ?
parameter name: pwd.authenticationHdr
Parameter value:ย <wsse:Security soap:mustUnderstand=\"1\" xmlns:soap=\"http://schemas.xmlsoap.org/wsdl/soap/\" xmlns:wsse=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd\">
<wsse:UsernameToken wsu:Id=\"UsernameToken-1\" 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\">password</wsse:Password>
</wsse:UsernameToken>
</wsse:Security>
Appreciate your response.
Thanks a lot!
Hello Marc,
Can you please detail out how have you implemented wsse security as I am getting fault error exception if putting the tags in namespace value.
Apppreciate your response.
Thanks.
Sarbtej
Hello Sarbtej,
Did you already solved your issue?
Thanks,
Marc
Hello Ravijeet,
Can you please detail out the steps to implement the SOAP Header as was your requirement. I have tried to use the module, but I am getting error as fault was not recognized.
Thanks.
Sarbtej
Hi Praveen,
Very Nicely Explain. I tried to add this headers in my modules but when I execute the same through SOAPUI getting error HTTP/1.1 401 Unauthorized. My PI Version is 7.40.
Below is the code for the header
<soapenv:Header>
<ns0:authenticationHdr xmlns:ns0='http://Customers.com'>
<UserName>user</UserName>
<Password>pwd556</Password>
</ns0:authenticationHdr>
</soapenv:Header>
Also I tried
<soap:Header>
<ns0:authenticationHdr xmlns:ns0='http://Customers.com'>
<UserName>user</UserName>
<Password>pwd556</Password>
</ns0:authenticationHdr>
</soap:Header>
Can you help me out?
Regards,
Alex
Hi Alex,
Sorry, I couldn't understand your requirement completely. Can you please explain your requirement in detail and where exactly you are getting this error
Sender (protocol ?) --> PI/PO --> Receiver (protocol ? )
Br,
Praveen
Hi Praveen,
Thanks for your response onto this. My requirement was to allow third party system use WSDL without entering username and password which is done through using below thanks to Karthik B.
http:// <host name> : <port name> /XISOAPAdapter/MessageServlet?senderParty= <name of the sender party> &senderService= <name of the sender service> &interface= <name of the interface>&receiverParty= <name of the receiver party> &receiverService= <name of the receiver service>&interfaceNamespace= <name of the interface namespace>&j_username=<UserName>&j_password=<Password>
Set Username and password
Regards,
Alex
Hi Alex,
I think this is not possible since SOAP MessageServlet on SAP PI/PO by default authenticates using BASICauthentication mechanism. And BASIC authentication is a general HTTP header and we can't include this in SOAP message as SOAP headers
I remember that, there is a way where you can by-pass SOAP adapter BASIC authentication mechanism with SOAP adapter setting in NWA(don't remember the parameter). And with this, any soap message(interface) can enter into system without needing any credentials information
a nice work around: Anonymous SOAP calls in SAP PI
Hope it is clear...
Thanks,
Praveen
Hi Praveen,
I am using AddSOAPHeaderBean to include custom fields to the SOAP header. I have a requirement where I need to add attribute to the element as below,
<ns1:async expectReply="false" xmlns:ns1="http://schema.xml"/>
here "async" is element and "expectReply" is attribute.
Can you please let me know how to handle attributes to the element using AddSOAPHeaderBean.
Regards,
Rajesh
Unless you are asking for clarification/correction of some part of the Document, please create a new Discussion marked as a Question. The Comments section of a Blog (or Document) is not the right vehicle for asking questions as the results are not easily searchable. Once your issue is solved, a Discussion with the solution (and marked with Correct Answer) makes the results visible to others experiencing a similar problem. If a blog or document is related, put in a link. Read the Getting Started documents (link at the top right) including the Rules of Engagement.
NOTE: Getting the link is easy enough for both the author and Blog. Simply MouseOver the item, Right Click, and select Copy Shortcut. Paste it into your Discussion. You can also click on the url after pasting. Click on the A to expand the options and select T (on the right) to Auto-Title the url.
Thanks, Mike (Moderator)
SAP Technology RIG
Thanks for the blog gujjeti..:)
It helped meย in our project,