cancel
Showing results for 
Search instead for 
Did you mean: 

Accessing SOAP envelope to place values in SOAP header dynamically

avinash_ayanala
Participant
0 Kudos

Hi Experts,

I am trying to develop a java mapping to access the SOAP envelope of the target message to place the source message values dynamically in the SOAP header.

First of all i want to conform is it possible to perform above task?

If it is possible then, how it can be done?

Any help from your end is really appreciable.Thank you very much in advance.

Regards,

Avinash.

Accepted Solutions (0)

Answers (3)

Answers (3)

RaghuVamseedhar
Active Contributor
0 Kudos

We can access a few fixed elements of input SOAP envelope. Link. Only one element in output SOAP evelope. Link.

But if input to PI is SOAP message, I think, we can try below solution.

Please check this blog, How to Read SOAP Header Information. Read comments at the end of blog.

As a POC, create a SOAP -> PI -> File scenario. Make sure sender channel and service interface are as defined according to blog (MT can be any 1-2 elements). Do not select any operational mapping in interface determination (this will be pass-through scenario).

Get the WSDL link from sender agreement and test the scenario from SOAPUI. You should be able to see entire SOAP message (with envelope) in target folder.


If above POC is successful. You can create Java Mapping to handle entire SOAP message, even SOAP header (after all SOAP is an XML).

avinash_ayanala
Participant
0 Kudos

Hi Raghu,

Thanks for your suggestion it was really helpfull.

But i have worked with the How to Read SOAP Header Information using that i am able to do asynchronous scenario from SOAP to File but it is not working for Synchronous scenario.

I haven't tried the java yet i will check it once and reply you back.

Regards,

Avinash

RaghuVamseedhar
Active Contributor
0 Kudos

Avinash,

It's good to know that POC (SOAP -> PI -> File) worked. You are able to see entire SOAP message (SOAP Envelope in it Header and Body) in target file.

Is your scenario

SOAP <-> PI <-> SOAP?

For synchronous scenario. You know, we need request message mapping and response message mapping. As you can see, SOAP Envelope has multiple namespaces, so you cannot use Graphical Mapping (it is difficult). Use Java Mapping.

First solve request and then response. Develop Java request message mapping, do not select response message mapping in Interface determination (let response be pass-through, for now). Test the synchronous scenario using SOAPUI, check payload at each step.

If it is fine then develop Java response message mapping. Test using SOAPUI.

avinash_ayanala
Participant
0 Kudos

Hi Raghu,

Thank for your response .

Yes for me SOAP to File worked i am getting whole SOAP body along with header in payload

but for  SOAP to SOAP synchronous scenario i am getting error in SOAP UI it is not accepting SOAP message it is accepting only XML message and getting response in XML message in SOAP UI.

Is there any java mapping or java functionality to access the SOAP envolope or any other process.

Regards,

Avinash

RaghuVamseedhar
Active Contributor
0 Kudos

Sync scenario.

Sender (1st SOAP message) -> PI -> (2nd SOAP message) Receiver

Sender (4th SOAP message) <- PI <- (3rd SOAP message) Receiver

Getting '2nd SOAP message' and '3rd SOAP message' for sync scenario: -

Create a new SOAPUI project 'FirstProject'. Directly connect to Receiver using SOAPUI  (using receiver WSDL) and get '2nd SOAP message' (left side of SOAPUI) and '3rd SOAP message' (right side of SOAPUI).

Paste both '2nd and 3rd SOAP messages' in the discussion (I will have a look and guide you).

iaki_vila
Active Contributor
0 Kudos

Hi Avinash,

Another alternative is to do via XSL mapping. You can do it easily like this thread explains:

Also, you can develop your XSL without install anything in your laptop, you can test via online XSLT Transformation - Online Toolz

Hope this helps.

Regards.

avinash_ayanala
Participant
0 Kudos

Hi Inaki,

Thanks for your reply i have tried as you said but i want to access the SOAP envelope but when i tried the XSL code in the link i found that it is adding the envelope tag in the XML structure.

If I am wrong your explanation on the code would be truly helpful.

Regards,

Avinash

Former Member
0 Kudos

Hello Avinash,

That is correct. The mapping code will add a SOAP envelope and you need to check the 'Do Not add SOAP envelope' property for the SOAP receiver channel.

So, the SOAP envelope for the message will be created only through your XSLT/java code.

BR,

Diptee

avinash_ayanala
Participant
0 Kudos

Hi Diptee,

Thanks for the conformation. Is it possible to access the SOAP envelope of the message instead of creating the node in XML structure.

Regards,

Avinash

Former Member
0 Kudos

Hello Avinash,

I doubt that can be done, it's either we use the standard header added by the PI SOAP adapter or add our custom header. What is it that you specifically want to modify in the header?

BR,

Diptee

avinash_ayanala
Participant
0 Kudos

Hi Diptee,

As you said i am able to add the value to soap header using the AddSOAPHeaderBean module in sender adapter but here i am able to add the value statically only but i want the value to be added dynamically.


For performing this i am thinking to use the custom bean to access the payload value dynamically and send the value as input to AddSOAPHeaderBean module can this be done?


Regards,

Avinash

Former Member
0 Kudos

Hello Avinash,

I do not think dynamic values are possible with the AddSOAPHeaderBean module, please check the below blog for more details. Also, in this case, it would be easier for you to add the header via mapping

BR,

Diptee

Former Member
0 Kudos

Hello Avinash,

Yes, it is possible with Java mapping. Refer to the blog for details

SFDC Integration using PI 7.1 - How to add SOAP Envelope in Java Mapping - Process Integration - SCN...

BR,

Diptee