Skip to Content
Author's profile photo Former Member

“PutPayloadValueBean” – not only for Synchronous Communications !!

With 7.31 EHP1 SAP has introduced new modules GetPayloadValueBean, PutPayloadValueBean and RemovePayloadValueBean. The modules usage is recently described by Beena Thekdi Insert value from Request message to Response message using GetPayloadValueBean and PutPayloadValueBean

The focus of this blog is to explain some new use cases of PutPayloadValueBean. As per SAP help: Adding PutPayloadValueBean in the Module Processor – Adding Modules to the Module Processor – SAP Library


Use PutPayloadValueBean to enrich the message with values from a module context. You can use this module in combination with GetPayloadValueBean to enrich a response message with information from the request. Normally you use GetPayloadValueBean to extract values from a message, then execute an adapter module (example, synchronous SOAP call) and finally use PutPayloadValueBean to enrich the response with stored values

Although, in SAP help it is described that PutPayloadValueBean can be used in combination with GetPayloadValueBean in case of synchronous communication interfaces, we can still use this module in asynchronous communications with below explained use cases

Case 1: Pass some static value “PutThisValue” to xml field /ns0:root/field. The trick is to use double quotes “” to treat it as a string rather than as a variable from module context

Module Type Module Key
AF_Modules/PutPayloadValueBean Local Enterprise Bean Payload
Module Key Parameter Name Parameter Value
Payload put:/ns0:root/field “PutThisValue”
Payload xmlns xmlns:ns0 = “http://yourxmlnamespaces

Case 2: Pass some static value but with xml fields “<Name>Praveen Gujjeti</Name><Company>IBM</Company>” to xml field /ns0:root/field. This way we can enrich basic xml structure at module level using this module

Module Type Module Key
AF_Modules/PutPayloadValueBean Local Enterprise Bean Payload
Module Key Parameter Name Parameter Value
Payload put:/ns0:root/field “<Name>Praveen Gujjeti</Name><Company>IBM</Company>”
Payload xmlns xmlns:ns0 = “http://yourxmlnamespaces

Check results yourself 🙂

Hope this information help for your integration requirements

– Praveen Gujjeti

Assigned Tags

      17 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Vladimir Balko
      Vladimir Balko

      Thank you. It was useful

      Author's profile photo Former Member
      Former Member

      Hi Praveen,

      Wonderful Thank you so much for sharing about putpayloadvaluebean. I appreciate all your efforts and involvement in SCN community.

      Keep sharing ! Keep Contributing ! Keep Motivating !

      Regards,

      Hari Suseelan

      Author's profile photo Former Member
      Former Member

      you are a master and i see it 🙂

      V.SS

      Author's profile photo Lalitha Devi Chintalapati
      Lalitha Devi Chintalapati

      Iam trying to do this scneario... But Iam stuck... Coudl you please provide sample scenario with ID configs..

      Author's profile photo Uday Suvvada
      Uday Suvvada

      Hi Lalitha,

      Send me your mail id I will send you the document how to do a end-end scenario.

      Thanks & Regards

      Uday Suvvada

      Author's profile photo Uday Suvvada
      Uday Suvvada

      Hi Praveen,

      Can we use this same config for Multiple Values(0.. Unbounded) case.

      Please let me know in case ifwe can.

      This is working for replace single field value.

      Thanks & Regards

      Uday Suvvada

      Author's profile photo Former Member
      Former Member
      Blog Post Author

      Hi Uday,

      I don't have a system to check. May be you can try with xpath array syntax

      put:/ns0:root/field[1]

      put:/ns0:root/field[2]

      ...

      ......

      put:/ns0:root/field[n]

      //BR,

      Praveen Gujjeti

      Author's profile photo Uday Suvvada
      Uday Suvvada

      Hi All,

      Also we can use dynamic configuration uSing ASMA to get the same request message content to response.

      Thanks & Regards

      Uday Suvvada

      Author's profile photo Former Member
      Former Member

      Hi Praveen,

      I am trying to use this in my SOAP receiver channel and get the below error :

      "Object not found in lookup of GetPayloadValueBean"

      I found in SDN that this is only available from SAP PI 7.31.  We are on PI 7.30 SP 10. But your blog says it is available from 7.3. Another thing, SAP help from the link you provided in your blog,  the help is available under

      Technology->SAP Netweaver Platform -> 7.3 EHP1

      Can you please help and confirm if we this is only available from EHP1. If that is the case we might have to look at another solution.

      Appreciate your help!

      Thanks,

      Vijita

      Author's profile photo Former Member
      Former Member
      Blog Post Author

      Hi Vijita,

      Yes, it's a typo in my blog. I will update this now as 7.31 EHP1.

      BTW, what is your scenario flow and is it sync or async? And what is your requirement

      Best Regards,

      Praveen Gujjeti

      Author's profile photo Former Member
      Former Member

      Thanks Praveen for your quick response. My scenario is a simple synchronous scenario where we are calling a webservice on the receiver side.

      I had to send a payload value from request to response similar to what you explained in your blog, except I wouldn't have to trick the system for Asynch use case.

      I wanted to use GetPayloadValueBean/PutPayloadValueBean to achieve this as it is just channel config and really easy option.But since we are on PI 7.30, I could not use this approach.

      I used the UDF instead to store the payload value in Dynamic Configuration objects. This method works and I am getting the expected result.  

      Thanks,

      Vijita

      Author's profile photo Former Member
      Former Member

      Hi Praveen,

      It looks like the module evaluates only absolute XPATH (/root/node1/element1) and fails if I use relative XPATH (//element1).  I am thinking it is possibly a bug. Any thoughts?

      Regards,
      Badari
       

      Author's profile photo Evgeniy Kolmakov
      Evgeniy Kolmakov

      Hi Badari!

      I guess it's not a bug but implementation feature. The point is that in module bean your XPath expression is used also for appending nodes to document. So, path splitting is performed in code and "/" is used as separator.

      Regards, Evgeniy.

      Author's profile photo Evgeniy Kolmakov
      Evgeniy Kolmakov

      The good news are that you can add new element with value to XML structure using this module.

      Regards, Evgeniy.

      Author's profile photo Former Member
      Former Member

      Thank you for the response, Evgeniy!  Would you mind posting also the snippet where the given XPATH is being evaluated please?  I think that the implementation is somewhat counter-intuitive.  Evaluating the relative XPATH is such a basic functionality that's missing in this module?!
       

      Author's profile photo Evgeniy Kolmakov
      Evgeniy Kolmakov

      Hi Badari!

      Here is the method used for storing value to payload in module bean:

      It calls method appendTemplateIfEmptyReq() shown above. And that method, in turn, calls getParts() method of XPathWrapper class where your XPath expression is splitted into tokens using "/" as separator. So, if you set xpath as "//element", you get empty token and it leads to error in further logic, I guess.

      Regards, Evgeniy.

      Author's profile photo Former Member
      Former Member

      Thank you, Evgeniy.  I appreciate your response.  Yes, it looks like the XPATH is getting messed up even before being evaluated.

      Regards,
      Badari