cancel
Showing results for 
Search instead for 
Did you mean: 

Reading custom SOAP header with XHeaderName1

Former Member
0 Kudos

Hello Experts,

I have a SOAP to File scenario and I am trying to do dynamic receiver determination by looking at the SOAP request header info. I am adding a custom field (System_ID) that I want rules to run against in Receiver Determination..

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"

xmlns:urn="urn:*******************">

<soapenv:Header>

<System_ID>100</System_ID>

</soapenv:Header>

<soapenv:Body>

</soapenv:Body>

</soapenv:Envelope>

In the Receiver Determination I have multiple rules using SOAP context object to XHeaderName1 = the System_ID (100) to pass the message to the right system at runtime according to the System_ID.

In the SOAP sender channel I have Set Adapter-Specific Message Attributes and Variable Transport Binding checked. I also have the variable name System_ID in the first Variable Header (XHeaderName1).

In the SOAP sender Conversion Parameters I have Do Not Use SOAP Envelope and Keep Headers checked, as well as nosoap=true in the SOAP request URL.

I'm getting the System ID to show in XI in sxmb_moni in the Header but no where do I see it being used with XHeaderName1.

Am I using XHeaderName1 right? If not could you advise as to how XHeaderName1 should be used?

My requirement is to read system ID from Header, not payload.

Thank you!

Tim

Accepted Solutions (0)

Answers (2)

Answers (2)

former_member200962
Active Contributor
0 Kudos

I assume that your receiver determination is giving some error.

When you are determining the Condition in Receiver Determination what kind of object are you using? If not wrong you should be using the Context Object.....in the list present you will find the relevant Header field...select it....and then apply the condition....now hopefully it should work

Regards,

Abhishek.

stefan_grube
Active Contributor
0 Kudos

XHeaderName1 is for HTTP header, not for SOAP header.

former_member200962
Active Contributor
0 Kudos

Help section mentions the availability of XHeaderName1 for SOAP sender (as it is the case here):

http://help.sap.com/saphelp_nw70/helpdata/en/fc/5ad93f130f9215e10000000a155106/content.htm

I hope I am not missing any part of the discussion

Regards,

Abhishek.

stefan_grube
Active Contributor
0 Kudos

The Sender SOAP adapter reads the HTTP header of the incoming HTTP call (as every web service is based on HTTP) and puts the HTTP header field into XHeaderName1, the same way as the HTTP adapter does.

The SOAP adapter does not interpret the SOAP header.

Is this more clear now?

Former Member
0 Kudos

Thank you Stefan and Abhishek for your replies...

Stefan, I think I see your point now. I believe I was over-simplifiying my solution with what I was trying to do. I can try handling the HTTP header then.

Is there no way to retrieve values from the SOAP header then? and..

Once HTTP header is passed to XHeaderName1, where can it be handled so that I can extract a value from it?

Thank you

Tim

prateek
Active Contributor
0 Kudos

But what data do you need to extract with SOAP header?

You may use adapter specific message attributesin mapping for accessing XHeaderName1.

Regards,

Prateek

Former Member
0 Kudos

Hello Prateek,

I have seen examples of adapter specific message attributes in mapping done with a UDF using dynamic conifguration, but not one with SOAP.

It would be helpful if I could get confirmation that the one I am using is correct, if it is not please advise on the correct code.

This is in a UDF in mapping...

public String AssignSOAPHeader(String value, Container container) throws StreamTransformationException{

DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);

DynamicConfigurationKey key1 = DynamicConfigurationKey.create( "http://sap.com/xi/XI/System/SOAP", "XHeaderName1");

String value = conf.get(key1);

return value;

stefan_grube
Active Contributor
0 Kudos

When you have "do not use SOAP envelope" checked, then the SOAP header is part of the XML message.

You can easily define an XPATH to examine the SOAP header field and use this for receiver determination.

If you want touse the Http header, then the sender of the message has to provide this. Usually this is not the case.

Former Member
0 Kudos

Stefan,

Thank you for the reply. I have set the sender channel to "Do not use SOAP Envelope" .

Using XPATH, would looking at the SOAP header (now part of the whole message) be accomplished using a UDF in mapping? If not, it would be very helpful to get an idea how to use XPATH to look at the message header part of the message.

Currently I can only see how XPATH works with looking at just the payload and what is defined as my message type. Im trying to understand how its possible to access the header info using the XPATH.

Thanks

Tim

Former Member
0 Kudos

I was able to find a solution to my problem.

I created a basic senario below to test:

1.A basic Asynchronous scenario is created using a SOAP sender adapter to 2 possible flat file receivers.

2.The SOAP sender channel will have the option u201CDo Not Use SOAP envelopeu201D checked and SOAPUI URL will have u201C&nosoap=trueu201D added to the end.

3.The receiver system name will be stored in the WS-Addressing u201CActionu201D field sent from SOAPUI.

4.Two ABAP mappings are created. One mapping will extract the system number from the WS-Addressing u201CActionu201D field. The other mapping will extract just the body of the SOAP message to send along. Using regex and string manipulation in the ABAP mappings we can reuse the mappings for any SOAP message.

5.Enhanced (Extended) Receiver Determination is selected and interface mapping using system/XI ReceiverDetermination service interface is used to capture the receiver system.

While this is a solution is not the best, it is a solution. Upon research I found a recent SAP Note 1385579 talking about implementing a SAP delivered generic SOAP Sender AXIS handler com.sap.aii.axis.soap.HeaderExtractionHandler to extract SOAP Header elements and place in message attributes. I will be trying this out.

Former Member
0 Kudos

I was able to find a solution to my problem.

I created a basic senario below to test:

1.A basic Asynchronous scenario is created using a SOAP sender adapter to 2 possible flat file receivers.

2.The SOAP sender channel will have the option u201CDo Not Use SOAP envelopeu201D checked and SOAPUI URL will have u201C&nosoap=trueu201D added to the end.

3.The receiver system name will be stored in the WS-Addressing u201CActionu201D field sent from SOAPUI.

4.Two ABAP mappings are created. One mapping will extract the system number from the WS-Addressing u201CActionu201D field. The other mapping will extract just the body of the SOAP message to send along. Using regex and string manipulation in the ABAP mappings we can reuse the mappings for any SOAP message.

5.Enhanced (Extended) Receiver Determination is selected and interface mapping using system/XI ReceiverDetermination service interface is used to capture the receiver system.

While this is a solution is not the best, it is a solution. Upon research I found a recent SAP Note 1385579 talking about implementing a SAP delivered generic SOAP Sender AXIS handler com.sap.aii.axis.soap.HeaderExtractionHandler to extract SOAP Header elements and place in message attributes. I will be trying this out.

Former Member
0 Kudos

Hi,

can any body help me with this error, when i chose Do Not Use Soap Envelop check in sender communication channel (quality of service :B E)and add the &nosoap=true in request url i am getting below mentioned error . Can any body help me with this error.

Received HTTP response code 500

regards

sandeep

Former Member
0 Kudos

Hi Mr,

Probably there's some error in inbound or outbound (based on your scenario) message structure (http error 500 refer to an internal server error).

You need to check message structure.