cancel
Showing results for 
Search instead for 
Did you mean: 

REST ADAPTER - Dynamic attributes to get XML Input

Former Member
0 Kudos

Hi All,

I have an REST<–> PI <–> RFC scenario with a PI 7.4 system. We had a requirement for Exposing the Function module as RESTful service. In that I am using  Synchronous Sender Rest Adapter where I want to give 2 Runtime parameters

(TOKEN, INPUTREQUEST) as input in the URL and the same should pass to RFC and get the response back.

The sample Request URL will be like:

http://Host:Port/RESTAdapter/Demo/PO?TOKEN=12345&XMLREQUEST=<?xml version="1.0" encoding="UTF-8" ?>

<Z_Request>

<REGION>ASIA</REGION>

<SOURCE_SYSTEM>PRO</SOURCE_SYSTEM>

<item>

<KOKRS>1000</KOKRS>

<BUKRS>100</BUKRS>

</item>

</Z_Request>

Here is the UDF  for getting the inputs from the URL:

Map<String, Object> all = container.getInputHeader().getAll();

DynamicConfiguration dynConf = (DynamicConfiguration)all.get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);

DynamicConfigurationKey key = DynamicConfigurationKey.create( namespace, attribute);

String xml = dynConf.get(key);

return xml;

When we place the URL in Rest Client tool, SAP PI takes the two parameters through GET variable but the value of XMLREQUEST is getting truncated as "<?xml version". We are not able to get the complete xml from "XMLREQUEST" and

pass as an input to RFC.

Kindly suggest some ideas/solutions for this issue.

Many Thanks,

Ezhil.

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Experts,

The call is successful without ‘=’ symbol in the XML Header. '=' symbol is causing problem , where each attribute is separated by '=' seems to be that this has been hardcoded in Rest adapter.

please find the URL for the reference.

URL:

http://Host:Port/RESTAdapter/Demo/PO?TOKEN=12345&XMLREQUEST=<?xml version="1.0" encoding="UTF-8" ?>

<Z_Request>

<REGION>ASIA</REGION>

<SOURCE_SYSTEM>PRO</SOURCE_SYSTEM>

</Z_Request>

The Communication channel configuration below:

Please suggest the potential solution to achive the above business case since we also tried the adapter module to manage the call but somehow the Rest sender adapter is not supporting the same.

Many Thanks

Ezhil.