cancel
Showing results for 
Search instead for 
Did you mean: 

REST to Web service Interface - Pick date from sender HTTP url and pass it in mapping

srikanthe_sapxi
Explorer
0 Kudos

Hi Experts,

I am using REST polling sender adapter to retrieve HTTP GET request. In this interface I need to pick the date from sender URL and pass it in Date field in mapping to the target Web service.

sample Sender URL:

http://<server_name>/api234/rowdata/bydate/2017-06-11

Please provide me your suggestions.

Thanks in advance.

Srikanth E

Accepted Solutions (0)

Answers (2)

Answers (2)

former_member186851
Active Contributor
0 Kudos

Hello Srikanth,

Its like which value you define in the URL pattern Element.

Check the below image.

Define the same in the mapping.

srikanthe_sapxi
Explorer
0 Kudos

Hi Raghu,

We are using REST polling for sender and the data should be picked on Incremental request based on timestamp of last call.

The UDF in mapping should pick the timestamp/date from the URLs and pass it to the target.

http://host:server/rowdata/bydate/{incrementalToken}

As REST Polling adapter doesn't have Adapter Specific/URL patter parameters, instead I tried to pass {incrementalToken} as input for attribute but it didn't work.

Can you please guide me further.

Thanks,

Srikanth E


former_member186851
Active Contributor
0 Kudos

Please post the screenshots of channel configuration.

Date you wish to get from the URL right?

srikanthe_sapxi
Explorer
0 Kudos

Hello Raghu,

please find the channel configuration.

Yes, Date should be picked from the URL.

former_member186851
Active Contributor

Hello Sreekanth,

I don't think its possible with Standard way as I tried the same and URL or the increment requests are not recorded anywhere in SAP PO.I will check more if I can find something.

But since this is only date field why don't you map the current date in the mapping which will change everyday.

srikanthe_sapxi
Explorer
0 Kudos

Hello Raghu,

Thanks for your response.

but we have to pick old data as well and the old data and date is not regular(eg: 2017-08-08, 2017-08-10... 2017-08-11) 😐

In this case current date cannot work.

Thanks,

Srikanth E

former_member186851
Active Contributor
0 Kudos

OK Srikanth.

This is actually little weird and which SAP PO version and SP your using.

Can you try keeping some HTTP headers and see if those values are getting reflected.

In my version HTTP headers are not working seems to be bug.

former_member186851
Active Contributor
0 Kudos

Hello Srikanth,

Using the UDF mentioned in the below link you can get the values from the rest URL and map it to that target structure of WS.

Instead of REST IDS you can define your custom attributes as well.

https://blogs.sap.com/2014/12/18/pi-rest-adapter-using-dynamic-attributes/

srikanthe_sapxi
Explorer
0 Kudos

Hello Raghu,

The image UDFs in the link given are disabled/unable to open, can you please ping here if you can open them.

Thanks,

Srikanth E

former_member186851
Active Contributor
0 Kudos

Hello Srikanth,

Below is the UDF code

@LibraryMethod(title=“getASMA”, description=“get adapter specific message attribute”, category=“UDFPool”, type=ExecutionType.SINGLE_VALUE

public String getASMA (

@Argument(title=“”) String namespace,

@Argument(title=“”) String attribute,

Container container) throws StreamTransformationException{

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

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

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

String value = dynConf.get(key);

return value;

Inputs are namespace which is standard -

http://sap.com/xi/XI/System/REST.

For attribute select as per the one mentioned in channel.
srikanthe_sapxi
Explorer
0 Kudos

Hello Raghu,

Thanks for the UDF.

I did not understand what to be given as input for attribute, below is my channel configuration.