cancel
Showing results for 
Search instead for 
Did you mean: 

How PI receiver could be sender in other's

Former Member
0 Kudos

Hello All,

As per design changes in one of our interfaces, some of receivers are now into sender for other receivers, so please tell me how to design this flow in PI.


File /File sender adapter ->PI->call JavaMap-->WS(Response payload)-->JDBC/sender or receiver adapter->PI-->Oracle/database(response)->PI->File adapter/receiver-->NFS folder


Here WS response was input for JDBC/Oracle and Oracle response was input for PI.


There is a little confusion in JDBC adapter/ looks ups need to use in this design, and also does it required BPM for make it one scenario?


Thanks for your time and let me know your design inputs.


Thanks,

Gayatri.



Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi.

Your flow will be as below.

File /File sender adapter(requestresponsebean) ->call JavaMap-->WS(Response payload)-->Graphical mapping with DB Lookup ->File adapter/receiver-->NFS folder


Regards

Venkat

former_member184720
Active Contributor
0 Kudos

Hi Venkat - Curious to know why do we need requestresponsebean here? The ws call is from a java mapping.

Former Member
0 Kudos

I do not think requestresponsebean required in my scenario, because the same file adapter not receiving the response. As Hareesh said, my java mapping getting the response already from WS , so I need to send this response to oracle and get the response from oracle.

Former Member
0 Kudos

Hi Gayatri

Your requirement can be done in one scenario and using without BPM. Below is the way

Scenario :  File ( sender )  ---PI ---File receiver

Create java mapping where the input will be the data from file and output will be web service response.

You have use soap look up inside the java mapping. You need to create a SOAP receiver channel fro the same.

Create one graphical mapping where input will be the output of Java mapping and output will be the response from data base.You need to perform JDBC look up inside graphical map. You need to create a receiver JDBC channel to connect to the data base.

Create one operation mapping and use both the mapping in below order

java map

graphical map

Let me know if any issues.

Former Member
0 Kudos

Hi ,

If you want your design as below ,then you need request response bean in sender file channel because File is asynchronous .

File(request response bean)-->Java Mapping-->SOAP-->Mapping(d/b Look up)-->File

If you want to go as below ,yes request response bean not required ,based on your requirement and complexity choose the apt one.

File-->Java Mapping (SOAP lookup)-->Graphical Mapping (d/b Look up) -->File

or

File-->Mapping (SOAP Lookup,d/b look up) -->File

Regards

Venkat

Former Member
0 Kudos

Hi Indrajit,

You steps looks like simple, but didn't get clearly.

Mine was REST webservice its not SOAP webservice,


The 1st call we did successfully, thru java map(hard coded input values) we are invoked the REST service and getting the response back,when I click the TEST tab in OM, java map calling that service and giving the results values in right side.


2nd Step we need to handle :- I need to took some of the values from this response and send it to Oracle, where I got struck. Bit confusion for handle this step? can you tell me details steps to send this response to oracle? I have Oracle table structure which will receive the Input. Mean time I'll try to understand the DBlookups process.


I am looking for DT/MT/MM/OM details for send the RESTService response to Oracle.

Once I am able to hit the Oracle database and get the response back then I'll go for 3rd step for file receiver.


Thanks,

Gayatri

Former Member
0 Kudos

Thanks Venkat!

Mine was REST webservice its not SOAP webservice,


The 1st call we did successfully, thru java map(hard coded input values) we are invoked the REST service and getting the response back,when I click the TEST tab in OM, java map calling that service and giving the result values in right side.


2nd Step we need to handle :- I need to took some of the values from this response and send it to Oracle, where I got struck. Bit confusion for handle this step? can you tell me details steps to send this response to oracle? I have Oracle table structure which will receive the Input. Mean time I'll try to understand the DBlookups process.


I am looking for DT/MT/MM/OM details for send the RESTService response to Oracle.

Once I am able to hit the Oracle database and get the response back then I'll go for 3rd step for file receiver.


Thanks,

Gayatri

Former Member
0 Kudos

Hello,

>> I need to took some of the values from this response and send it to Oracle,

So what exactly u r doing in oracle DB - update/insert or just looking for entries and getting back the response?

Just a word of caution - DB lookup should not be used for insert/update opeartions. It's a bad practice.


Now coming to ur question, i believe the response from Rest WS will always come in a predefined kind of structure, so in that case create a intermediate structure for WS response. And then ur second mapping will be :

WS Response Intermediate Structure - PI (DB lookup) - File.


Thanks

Amit Srivastava


Former Member
0 Kudos

Thank you Very much Amit .Your inputs giving me some more clarity.

I am looking for entries (select query) and getting back the response which I need to send it to file.

Right now I am trying to do :Take some field/data  from WS response and send it to Oracle DB.

For ex : I use to get the User id and other details from WS response,. I'll take only User IDs from this response and send it to Oracle database and fetch the all details of those UserIds.

and after send these Oracle Response to File

Yes your correct, the REST service response coming like Plain(structure) XML/Http string  in OM :

<string xmlns="http://schemas.microsoft.com/2003/15/Normalization/"><?xml version="1.0" encoding="utf-8"?><PersonDetails><Person ID="19"><USER>20000</USER><Group>sdfsdfsfsdfsd</Group></Person></PersonDetails></string>

I need to create structure for above response (DT/MT) and SI was OB_Async? right?

Thanks,

Gayatri

Former Member
0 Kudos

Hello,

>>I need to create structure for above response (DT/MT) and SI was OB_Async? right?

No, for intermediate structure only create DT and MT(no need for SI) that will be similar to ur WS response structure.

So in all u will have 2 mappings:

1) one obviously is java mapping

2) And the second one will be message mapping i.e. MT_Intermediate - PI - Receiver File

And eventually under OM u will add both java mapping followed by message mapping.

Thanks

Amit Srivastava

former_member184720
Active Contributor
0 Kudos

Yes. You need to create a DT,MT

Operation Mapping:

Create one operation mapping - your sender SI is the file and the target SI would be the final File.

Inside the interface mapping you'll select your java mapping first and then a graphical mapping

Graphical Mapping:

source would be the responce of your WS and target would be the final file.

Inside the mapping, you'll do a JDBC lookup.(hope you have gone though the above provided blog for DBlookup)

Let me know if anything is unclear.

Former Member
0 Kudos

One suggestion - u can parse ur response which is coming from WS and instead of above structure try to output below str from JM:

<?xml version="1.0" encoding="utf-8"?>

<PersonDetails>

   <Person ID="19">

      <USER>20000</USER>

      <Group>sdfsdfsfsdfsd</Group>

   </Person>

</PersonDetails>

and then ur Intermediate structure can easily be created for above response message

Former Member
0 Kudos

Thanks for your responses!

Trying to create the Intermediate structure(DT/MT) according to WS response like above, but in PI name space is additional tag which is not matched exact to structure of WS response. That is the issue now, so how to avoid/trim this name space in PI or do I need to add this name space along with output structure in java map/ code?  There are some trail and errors trying at this time, but pls. let me know which way is better and easy to handle?


WS response structure like below :

----------------------

<?xml version="1.0" encoding="utf-8"?>

<PersonDetails>

   <Person ID="19">

      <USER>20000</USER>

      <Group>sdfsdfsfsdfsd</Group>

   </Person>

</PersonDetails>

PI  DT/MT structure for above structure:

----------------

<?xml version="1.0" encoding="UTF-8"?>

<ns0:PersonDetails xmlns:ns0="http://xxxxxxx.com/javamap/restservice">

<Person ID="19">

      <USER></USER>

      <Group></Group>

   </Person>

</ns0:PersonDetails>

Thanks,

Gayatri

former_member184720
Active Contributor
0 Kudos

Hi Gayatri - You can  handle it in the Java mapping and it's the best way in your case

Former Member
0 Kudos

Hello,

U can delete this namespace while creating intermediate MT in PI - so no need to do anything in java mapping.

Thanks

Amit Srivastava

Former Member
0 Kudos

U can refer this also:

Former Member
0 Kudos

I tried this step, but overlooked. let me try again.

Thanks,

Gayatri

Former Member
0 Kudos

Hi Gayathri,

For d/b look .Below is the process .

1st step: Create a communication channel between PI and the database to connect to database.

2nd step :Import the d/b table definition in PI as external definition.

Create Object-->Interface Objects-->External Definition-->select category as dbtab-->

Communication channel/Click on import external definitions-->Continue-->select your communication component,Receiver JDBS channel -->continue -->finish.

3rd step :Use the above table definition in  message mapping where this lookup is to be used by selecting JDBC Look up under Conversions and map and then

4th step :In message mapping go to signature tab and define the parameter as "channel" and category as "JDBC Adapter Type".

5th step:Under Operation mapping define the parameter and associate it with parameter defined in Message Mapping.

Regards

Venkat

Former Member
0 Kudos

Thanks Amit,

Looks like it worked,  exact structure was not showing any error at level of OM test.  You saved some of my time for not putting lack of my  java skills.


While I doing this step , got one question?


How WS response values going into at the time of Message mapping  between Intermediate_MT(DBLookup) to File_MT? Does OM will takecare this step?


Still I need to work for receiving WS response values and populate in structure at OM TEST/RESULTS TAB , this is pending in Java code/map.



Thanks again.


Gayatri.


Former Member
0 Kudos

Thanks for your help Venkat.

These step by step guidelines very helpful at this time and saves my time

Thank you verymuch.

Gayatri.

Former Member
0 Kudos

Hello,

>>Does OM will takecare this step?

Yes, OM will take care of that. To be precise u have created intermediate structure just to ease out ur second mapping program - that's it.

So at runtime ur JM will return WS response, and it will automatically feed the intermediate structure and provide input for ur message mapping.

And eventually, during E2E execution u will only see structures which are generated before (source file structure) and after mapping(target file structure).


Thanks

Amit Srivastava

Message was edited by: Amit Srivastava

Former Member
0 Kudos

Hi,

Go through the below links for screenshots if required.

Regards

Venkat

Former Member
0 Kudos

Thanks Again!

2 more questions, sorry bothering you all again.

My current requirements got changed, Its looks like I need to retrieve more User ids from different groups and along with recursive calls to find other details, so my WS response sends single XML/String contains nested tree structures with different group of User values. This output structure from WS may vary each call to WS.

How do I handle these different structures in Java map/Code which are dynamically change? the current one is hardcoded in Java map/code, which I treated as fixed structure, but now they changed.

According to WS response structure, I build intermediate _MT structure and working fine at this time. But is there any way to change my Intermediate_MT structure dynamically based on WS response structure at run time?


or let me know is there any feasible solutions strike in your mind for above challenges?


Thanks,

Gayatri.

former_member184720
Active Contributor
0 Kudos

When you say different use groups and different values, it's just that you receive multiple details or the strcture itself is not known?

I mean existing responce:

<PersonDetails>

   <Person ID="19">

      <USER>20000</USER>

      <Group>sdfsdfsfsdfsd</Group>

   </Person>

</PersonDetails>

different groups and user the responce would be :

<PersonDetails>

   <Person ID="19">

      <USER>20000</USER>

      <Group>sdfsdfsfsdfsd</Group>

   </Person>

</PersonDetails>

<PersonDetails>

   <Person ID="20">

      <USER>20001</USER>

      <Group>sdfsdfsfsdfsd</Group>

   </Person>

</PersonDetails>

<PersonDetails>

   <Person ID="21">

      <USER>20002</USER>

      <Group>sdfsdfsfsdfsd</Group>

   </Person>

</PersonDetails>

<PersonDetails>

   <Person ID="22">

      <USER>20002</USER>

      <Group>sdfsdfsfsdfsd</Group>

   </Person>

</PersonDetails>

If this is the case then you can change the occurence of PersonDetails to 0..unbounded and you should be good.

If this is not the ws responce, please provide sample xml

Former Member
0 Kudos

Thanks Hareesh!

At this point structure is not known.

I am changing the Java code according to new Input parameters to call WS, after multiple calls with different parameters might give the approximate output structures from WS.

I am expecting different USER groups with different User values like you said above?

Will let you know ,thanks again.

Former Member
0 Kudos

Hello,

>>This output structure from WS may vary each call to WS.

So u mean to say that everytime WS returns data in a different format?

BTW, u always enquire DB using user id and group?

If yes then parse the dynamic response and create a XML structure (having userid and group) from JM  similar to what u have defined in PI and then may be u can still use MM...

Thanks

Amit Srivastava

former_member184720
Active Contributor
0 Kudos

You should be good as long as you just get multiple user details.

But if the responce strcture is not same, then i'm afriad it becomes very complex

Possible option i see if the response strcuture not consistent :

You might have to handle the DB look up also in the java mapping then without any graphical mapping you can pass the file to target(if there is no tarnsformation)

simillar discussion :

http://scn.sap.com/thread/3358326

Former Member
0 Kudos

Once I test this java map then I could estimate what kind of output structures coming out from WS, I guess WS will sends different structures according to input parameters.

But the DB look up always based on USER only, I need to pass all group User ids to DB and fetch the full details of USERs.

I need at lease  one round of testing using JM. so that i'll get clarity how WS responding.

Will let you know. Thanks again.

Former Member
0 Kudos

Hi,

>>Does OM will takecare this step?

Yes, OM will take care of that. To be precise u have created intermediate structure just to ease out ur second mapping program - that's it.

So at runtime ur JM will return WS response, and it will automatically feed the intermediate structure and provide input for ur message mapping.

And eventually, during E2E execution u will only see structures which are generated before (source file structure) and after mapping(target file structure).


When you say automatically feed the WS response into Intermediate structure?


It means E2E time? because I just tested Javamap at OM level and getting the response back from WS at Results side , but when I open message map in below java map, I do not see any data feed into Intermediate structure ?


What was the reason?


Thanks,

Former Member
0 Kudos

Hello,

Ideally u should see the target File structure (instead of JM response) in result view of OM test tab becoz at runtime ur JM and MM will be executed sequentially. 

Anyway, what u can do is take the JM response and test ur message mapping and see if u are getting correct output or not?

Thanks

Amit Srivastava

Former Member
0 Kudos

BTW, u can test JM and MM one by one from OM only.

So for JM -> From and TO will be: 1 and 1

and then for message mapping, paste JM response in source text view and then change "From" and "To step" to 2 and 2 respectively and test?

Former Member
0 Kudos

Ok,  the MM response giving the correct output while using JM output.

I have used same MT structure(exact matched the WS response structure) in source and target for MM at this time.  So it means the one at OM level  Result was final output data of File?

Thanks!

Former Member
0 Kudos

>>So it means the one at OM level  Result was final output data of File?

Yes, Indeed

Former Member
0 Kudos

Ok, I noticed what you saying in at OM.

and l changed the File output structure and seen the results according to file structure..

Once again thanks .

Former Member
0 Kudos

Hi,

As part of DBlookups in this development, I am suppose to query the Database VIEW.

In my case JDBC sender adapter required? right?

I can't import metadata from VIEW, instead of that I'll manually create the DT/MT for VIEW? does it allowed for DBLookup?

Thanks,

Gayatri.

Harish
Active Contributor
0 Kudos

hi Gayatri,

you need to manualy creat dt/mt of view.

regards

Harish

Former Member
0 Kudos

Ok, thanks!  but DBlook ups work with Sender JDBC channel?

Thanks,

Harish
Active Contributor
0 Kudos

Hi Gayatri,

DB lookup works with sender JDBC.

regards,

Harish

former_member184720
Active Contributor
0 Kudos

AFAIK - Are you sure? The DBlookup function always looks for receiver channel.

former_member184720
Active Contributor
0 Kudos

Hi Gayatri - Not sure if you can call a VIEW using DBlookup.

The other appoach i can think of is..

Create a stored procedure in which you can call this view.

Execute that procedure using a UDF from the graphical mapping to fetch the data.

something like this

http://scn.sap.com/community/pi-and-soa-middleware/blog/2013/07/19/sap-pi--udf-to-capture-multiple-r...

But please wait for experts comments to see if you can call a oracle VIEW using JDBC lookup.


Former Member
0 Kudos

Thanks for your inputs and guidance!

Will wait and mean time I am closing thread because its getting Huge thread. People may not show interest to see and answer this huge thread.

Will reopen with new thread with similar subject line .

Once again thanks to every one.

Gayatri.

Harish
Active Contributor
0 Kudos

My Bad it should be receiver channel.


regards,

Harish

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi ,

As above said you don't require a BPM in your scenario.In sender file channel use RequestResponse bean .

Go through below link for steps to use.

http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/80f96dbf-adca-3010-ffb5-daf2d1f0e...

Regards

Venkat

Harish
Active Contributor
0 Kudos

Hi Gayatri,

you have below scenario

schenario

1) File /File sender adapter ->PI->call JavaMap-->WS(request)

2) WS response -->->PI-->JDBC receiver adapter

3) Oracle/database(response)->PI->File adapter/receiver in NFS folder

If you have sync call to WS then you need BPM to handle the response.

regards,

Harish

Former Member
0 Kudos

Java map handling request and reply for WS, we are getting the response from WS , now I need  pass those WS response to Oracle and get the response and pass that Oracle response to file.

former_member184720
Active Contributor
0 Kudos

Hi Gayatri -I don't think you need a BPM.

You can make use of the JDBC Lookup function to request the database operation&get the responce . Map the responce to File adapter strcuture.

Like below if i understand your scenario correctly

File /File sender adapter ->PI->call JavaMap-->WS(Response payload)-->Graphical mapping with DB Lookup ->File adapter/receiver-->NFS folder

Former Member
0 Kudos

Thanks Hareesh!

I never used DB lookups,  Let try with DB lookups. Otherwise you understand correctly.

Thanks,

Gayatri

former_member184720
Active Contributor