cancel
Showing results for 
Search instead for 
Did you mean: 

Soap Axis adpater - nested header

Former Member
0 Kudos

Currently I'm using the soap axis adapter for the first time because I have to add some authentication information to the soap header.

Based on the Soap Axis FAQ I have configured the adapter for a simple header.

2	AF_Adapters/axis/HandlerBean	Local Enterprise Bean	hdr

module configuration

hdr | handler.type | java:com.sap.aii.axis.soap.HeaderInsertionHandler
hdr | name.1       | username
hdr | name.2       | password
hdr | namespace.1  | um:xxx
hdr | namespace.2  | um:xxx
hdr | value.1      | user
hdr | value.1      | 123

In this case I get the following header:

<soapenv:Header>
  <ns1:password soapenv:mustUnderstand="0" xmlns:ns1="urn:xxx">123</ns1:password>
  <ns2:userName soapenv:mustUnderstand="0" xmlns:ns2="urn:xxx">user</ns2:userName>
</soapenv:Header>

But I need a header that looking like this:

<SOAP-ENV:Header>
  <m:AuthenticationInfo xmlns:m="urn:xxx">
    <m:userName>user</m:userName>
    <m:password>123</m:password>
  </m:AuthenticationInfo>
</SOAP-ENV:Header>

I believe the solution must be simple but I need a hint.

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Here is a delayed one, a hint.

Actually, the answer is given in insert_hdr_any.png image file from faq_axis_adapter.zip attachment (note 1039369 - FAQ XI Axis Adapter) on a bit complex way. Let's imagine a situation where the values don't need to be dynamically read.  Configuration would be as follows:


Processing Sequence


3 | AF_Adapters/axis/HandlerBean | Local Enterprise Bean | hdr

Module Configuration

hdr | handler.type | com.sap.aii.axis.soap.HeaderInsertionHandler

hdr | value.1         | <m:AuthInfo xmlns:m="urn:test"><m:usr>user</m:usr><m:pwd>123</m:pwd></m:AuthInfo>

Perfectly simple

Former Member
0 Kudos

Hi Gil and everyone

We have to also write customhandler to send response(custom response strucuture wish using request message field) to Ariba after receiving order request message.

Can you please share if this is possible using custom handler and also deployment process?

I learned that handler deployment is different than custom adapter module.

I checked axis faq zip, which says below process for deploying custom axis handler:

When I write my own handler, where can I package
it?

There are several places you can package your handlers. If your handlers do
not require any references to any service or application components, they can be
simply packaged in the standard 3rd party library SDA
aii_af_jmsprovider.sda or com.sap.adapter.lib.sda
depending on the adapter engine version (i.e., the former for the 640/700 engine
and the latter for the 710 engine).

If your handlers require some references to some service or application
components, they must be packaged in a component that has references to these
components and has its own start/stop life-cycle management. Your handlers
should be registered to the Axis's class utility registry at the start up. In
particular, if the adapter uses some handler classes that are not included in
the standard library components of the Axis adapter, the class loaders of these
classes must be registered in the org.apache.axis.utils.ClassUtils
registry. This class is in axis.jar and is included in component
com.sap.aii.af.axisproviderlib. The registering component must call
static method ClassUtils.setClassLoader(String class-Name, ClassLoader
loader)
to register the class loader for the specified class name. The
following code fragment shows this step.

    // register the SimpleAuthentication handler to ClassUtils ClassUtils.setClassLoader(SimpleAuthentication.class.getName(), SimpleAuthentication.class.getClassLoader()); 

Regards

Divyesh

Former Member
0 Kudos

Hi Divyesh,

Could you please let me know if you got any pointers regarding using Custom Handler and its deployment process.

I need to develop a Custom hanlder in my project. Hence request you to provide me the information if yo uhave any.

Thanks & Regards

Swetha

Former Member
0 Kudos

Hi,

Look at the following note : 1385579 ! The HeaderInsertionHandler has been extended so it can now insert nested headers (initially it couldn't) ... Otherwise you'll have to go for your own custom handler

Rgds

Chris

Former Member
0 Kudos

Yes, I know this note but I don't know which setting I have to make to get the requiered header.

Former Member
0 Kudos

search for "insert_hdr_any.png" image file (from notes's faq_axis_adapter.zip attachment), it shows how to insert complex/nested structure in SOAP header

Chris

PS : chapter #30 "Can I insert some SOAP headers?"

Edited by: Christophe PFERTZEL on Dec 8, 2009 5:09 PM

Former Member
0 Kudos

Chris, I know this screen. As I wrote in my first post I have read this FAQ but I have not understood the part for the nested headers. Second point is that I don't want to use dynamic configuration. I only want to create this soap header (see first post) and the header content is static.

Sorry, I need some extra help.

Former Member
0 Kudos

I understand, as FAQ is not that clear about this nested feature and how to write it ... Have you tried "serializing" your header and add it in the relevant field, like this :

<m:AuthenticationInfo xmlns:m="urn:xxx"><m:userName>user</m:userName><m:password>123</m:password></m:AuthenticationInfo>

I'm not sure about how to declare namespaces, guess we'll have to make different attempts before reaching a good solution :-S

Chris

Former Member
0 Kudos

I have tried already the following:

hdr | handler.type | java:com.sap.aii.axis.soap.HeaderInsertionHandler
hdr | name.1       | AuthenticationInfo
hdr | namespace.1  | um:xxx
hdr | value.1      | <ns1:userName>user </ns1:userName><ns1:password>123</ns1:password>

In this case I get this soap haeder:

<soapenv:Header>
  <ns1:AuthenticationInfo soapenv:mustUnderstand="0" xmlns:ns1="urn:Wsvc_Sap_CiList">& lt;ns1:userName& gt;user & lt;/ns1:userName& gt;& lt;ns1:password& gt;123& lt;/ns1:password& gt;</ns1:AuthenticationInfo>
 </soapenv:Header>

But the web service doesn't understand this request. It is because of this & l t ; instead of < and so on. If I exchange this at my XML Spy Proxy (only for testing purpose) before I forward this to the web service all works fine.

Edited by: Gil Ritter on Dec 9, 2009 11:54 AM

I have inserted some blanks because this message board transforms a & lt; automaticaly to a <.

Former Member
0 Kudos

I guess this is because the handler treats value.x fields as "content" fields, so it automatically replaces reserved characters with corresponding XML entities ... But this is weird, as example screenshot shows similar content :-S

Former Member
0 Kudos

Hi Gil,

I came across this old thread through one of the threads I replied sometime ago.

I don't know if this thread is still active but I hope you will find it.

You are getting the value.1 property interpreted as the CDATA content because you are setting its namespace and name using the name.1 and namespace.1 properties.

Just get rid of these two properties and the value.1 property is interpreted as the whole element.

You can add any variables into the value by following the sample in the axis adapter FAQ.

And here is another example of using variables to construct a non-static nested header.

Regards, Yza

Former Member
0 Kudos

Hi,

Did you manage to handle this?

I am facing the same issue.

Regards,

Akshay

Former Member
0 Kudos

Hi Yzr,

I saw your replies on developing custom handler, could you please share deployment steps for custom handler and it can handle below scenario?

We have SOAP AXIS sender adpater to Proxy scenario.

Axis soap sender adpater is sync - Qos = BE and Proxy is ASYNC.

My scenario is as below":
Ariba is sending order request message and SAP PI need to send ACK - response message immdediately upon receipt of it, as Ariba wants session to be open till it receives response from SAP PI.
Response message is custom strucutre with one of the request message field as well.
Proxy is Async.

I think this can not be achieved using RequestOneWayBean as here SAP PI need to create custom response with request message field, in standard bean it is possible if we have file is ready with response and correlation can be done with request message.
I also thought of HTTPGetter task in sender soap adapter so that it can call PI web service(??) and it will match with ICO object which will send response message back to HTTPGetter task.
But it is not possible as we need to send message to proxy as well apart of sending response to Ariba.

Any thoughts please?

--Divyesh