on 10-14-2020 2:10 AM
Dear all,
Situation
I have a ERP (Proxy) --> PI --> 3rd Party (REST) synchronous scenario. I'm using GET to receive data. I'm on PO 7.5 SP13
The 3rd party service either provides a single record or multiple records as JSON array as a response.
Single:
{
"guid": "1234",
"subject": "My subject",
"existEmlAlready": true
}
Multi:
[
{
"guid": "1234",
"subject": "My subject",
"existEmlAlready": true
},
{
"guid": "4321",
"subject": "My other subject",
"existEmlAlready": true
}
]
What I want to achieve
I want to ideally process both responses with a single operation with a single response message type
Single
<messageType>
<record>
<guid>1234</guid>
<subject>My subject</subject>
<existEmlAlready>true</existEmlAlready>
</record>
</messageType>
Multi
<messageType>
<record>
<guid>1234</guid>
<subject>My subject</subject>
<existEmlAlready>true</existEmlAlready>
</record>
<record>
<guid>4321</guid>
<subject>My other subject</subject>
<existEmlAlready>true</existEmlAlready>
</record>
</messageType>
What I tried / where I fail
My Questions
Many thanks and kind regards
Jens
Hi Jens,
I did a prototype of something similar to this several months ago although it might be slightly different. I'm not sure if it had the anonymized array element to it but this is something that you can try that may work. I set my REST sender channel to convert to XML but did not do anything with the wrapper element. Inside my operation determination I used a variable in the HTTP path to derive the message type that I wanted to use and all it has is a single data type of type string (although in your case it might need to be 0...unbounded instead). Here are some screenshots to give you an idea:
Maybe this will help give an approach to solve it.
Regards,
Ryan Crosby
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks a heap, Ryan.
so bottom line of your solution would be using different expressions (you only have one in the screenshots) to map to different operations like so:
However, I feel I would not be able to adapt this fully, I'm afraid. I briefly lay out where I think I might fail:
I have Response Determination tab, where, If I understood the concept correctly, I could map an XML response from the 3rd party to an operation on PI like so
However, I don't have an 3rd party service, that sends back an XML node, it sends an unnamed array of JSON records or a single record (see original post)
Even if I could persuade the 3rd party to send a named array / object like so...
aaa
"record": [{
"guid": "1234",
"subject": "My subject",
"existEmlAlready": true
}, {
"guid": "4321",
"subject": "My other subject",
"existEmlAlready": true
}
]
... would PI then magically convert that to an XML and if so, would the root XML response node than be "record" and what would the namespace be.Lot's of questions I dont excpect you to have an answer, of course. But I tried to give as much detail as necessary, so you and others might get a grisp of the roadblocks in this scenario 😄
Anyways, a big Thanks and cheers
Jens
Hi Jens,
Yes, your scenario is clearly different being synchronous but it may still be worth a short in setting a data type structure for thirdPartyXMLRootNode like I have suggested and have the system doing the XML conversion. For the sake of keeping it simple set the type to single string and see what happens because that may give you clues about whether 0...unbounded would work. I just don't have a scenario with an anonymized array that I can test out my system with or I would have tried it to confirm.
Regards,
Ryan Crosby
Dear Jens,
I got requirement like you..here is ECC to PI to third party.Third party wants json request structure as Below so how can I achive this requirement could you please help on this requirement
[{ "employee_id":"44556", "establishment_head_mobile_number":"9999999999" }, { "employee_id":"33423", "establishment_head_mobile_number":"9999999999" }]
I am able to send request in below format but third party wants above format
{ "root":[{ "employee_id":"44556", "establishment_head_mobile_number":"9999999999" }, { "employee_id":"33423", "establishment_head_mobile_number":"9999999999" } ] }
Thanks and Regards,
DILEEP
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
In the Response Type tab, make sure you provide the details mentioned above. make sure your response message type for the SI is 0...Unbounded.
Regards,
Paul.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.