on 12-12-2023 12:08 PM
Hi All,
I have a requirement to call the REST webservice to fetch the file and transfer to a folder (REST - PO - SFTP).
Before calling the actual REST api to fetch file, I need to call a Login REST api using basic authorization which will return the Token and logon key which has to be passed in second REST api and content-type is “application/x-www-form-urlencoded".
Login Input format: Call the URL via POST method with JSON object serialized and set parameter.
obj={
"login":"my_email@company.com",
"pword":"my_password"
}
File api input format:
obj={
"logonkey":"123456", "tokenkey":"ASDJH7Y7Y76767S34324", "fileid":"123456"
}
NOTE: To make the request calls, a JSON object will need to be created and passed as a POST form parameter obj={jsonObject}
Kindly suggest how to achieve this requirement.
Thanks & Regards,
Niyati Jain
Hi Niyati,
Please try following design approach
1. From ecc proxy message is triggered at regular intervals with payload
<?xml version="1.0" encoding="UTF-8" ?>
<root>
<login>my_email@company.com</login>
<pword>my_password</pword>
</root>
2. build an ICO PROXY to REST
a. in REST receiver channel convert the XML to JSON and strip root element and send request to log in.
b. Convert the response into file using request response bean
3. Create second ICO file to REST
a. modify response in required to include "fileid" in mapping
b. send request to REST WS using receiver REST adapter
c. convert response to file using request response bean.
4. Create third ICO file to SFTP
a. read file from earlier ICO target folder
b. Transfer to SFTP receiver adapter.
Regards
Anupam
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Anupam,
Thanks for the approach. Can you suggest how we can add "obj= {}" while sending request JSON message.
obj={
"login":"my_email@company.com",
"pword":"my_password"
}
Regards,
Niyati Jain
Hi Anupam,
Thanks for the approach. I have tried the suggested design and it is working but the messages are getting failed in SXMB_MONI for PROXY to REST scenario with below error.
<SAP:Category>XIProtocol</SAP:Category>
<SAP:Code area="PARSER">UNEXPECTED_VALUE</SAP:Code>
<SAP:P1>Main/@versionMajor</SAP:P1>
<SAP:P2>000</SAP:P2>
<SAP:P3>003</SAP:P3>
<SAP:P4/>
<SAP:AdditionalText/>
<SAP:Stack>XML tag Main/@versionMajor has incorrect value 000; expected value is 003 </SAP:Stack>
I have checked few blogs and as mentioned in blog, Message protocol is XI 3.0 in Proxy Communication channel.
Also, message in PO is showing as delivered but in Log viewer it is giving this error - "Acknowledgement handling failed for type AckNotSupported. Reason: com.sap.engine.interfaces.messaging.api.exception.MessagingException: Acknowledgement not possible for synchronous message."
Kindly let me know if I need to update any other config.
Thanks & Regards,
Niyati
User | Count |
---|---|
74 | |
9 | |
8 | |
7 | |
6 | |
6 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.