on 02-05-2015 11:25 AM
Hello Experts,
I have a client requirement :
1. PI will make a soap call to ariba and receive and xml response .
2. The reponse will have base64 encoded payload.( coming in one field)
3. After decoding i will get a zip file .
4. After unzipping i will get a csv file .
5. Then i need to convert the csv file to xml .
I am trying to write java mapping code to decode base64, unzip the file and then convert the csv to xml.
However the java mapping is returning only the zip file . Can anyone please help here. Your inputs /suggestions would be great.
(PS:Unable to attach my java code)
Thanks in advance.
Anumeha.
Hi Anumeha
I would suggest that you split your interface into two scenarios:
Scenario 1 - Sync call and get response, decode base64 in response payload to zip content, and unzip content to csv, then directly save CSV content in a temporary file location
Scenario 2 - Pick up CSV file, perform FCC, map to target XML.
My java mapping code in the following thread will be sufficient for you to achieve the response mapping in scenario 1 - you just need to tweak the name of the element that contains the base64 value.
This would be better than having 1 java mapping to handle everything, because without actual knowledge of how the CSV structure looks like and how the target XML definition is, it is very hard to recommend sample code for it. Plus using standard FCC functionality to read the CSV is better than having to write your own mapping logic for it.
Do try out the code in the thread and if you have any further issues, do provide more details on what the issues are and we will try to assist where possible.
Rgds
Eng Swee
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Anumeha
Can you please let me know how did u make a SOAP call to Ariba . I am trying using SOAP receiver i am not able to connect.
Please let me know how u did
Regards
Sandeep
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Anumeha
In my case also ariba has provided webservice but i am not able to call or connect
I tried using SOAP and HTTP adapter i was not able to succeed because need to pass Credentials through HTTP header.
can you please share or shed light on axis adapter channel config how to achieve it?
it will be of great help
Regards
sandeep
Try referring this:
I did this in client system hence cannot provide screen shots . However the above document should help.
Thank you every one for your responses. I achieved the desired result using Java Mapping.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Anumeha,
In the same java mapping add the code to read zip files as you can see below
I am assuming resturn type of java mapping is "InputStream" class
Try use Appache.commons lib
and code as shown below
byte[] zipFileBytes;
zipFileBytes = IOUtils.toByteArray(InputStream input);
Now your Zip file is stored in a variable zipFileBytes, still in compressed form.
Then when you need to extract something use
ByteArrayInputStream bis = new ByteArrayInputStream(zipFileBytes));
ZipInputStream zis = new ZipInputStream(bis);
Then inputstream obtained needs to be converted to xml
as shown here
XML Parsing from an input stream Java - Stack Overflow
Try this, in case this does not work, need to look into your code.
Regards
Anupam
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
82 | |
10 | |
10 | |
9 | |
6 | |
6 | |
5 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.