on 01-18-2006 3:32 PM
Is there a simple way to http post a flat file?
The scenario -
We are invoking an ABAP client proxy that sends data to XI which maps the data to an xml file which represents the flatfile data.
The issue - I can generate the flat file through the file adapter receiver specifying file content conversion and giving it the fieldFixedLengths. But I have no option to do this in the HTTP adapter receiver.
What I am attempting to do is to pick up the flatfile generated through the file adapter in a temporary file location as a binary file, send it through an non-existent interface (not defined in the Repository but just made up) and then post this content to the HTTP destination. I am able to pick up the flatfile and route it all the way through to the HTTP receiver sender channel. I am getting an error at that point - but I am not sure if this is because i am just posting it to the XI integration server temporarily (the partner's URL is not available yet).
I am not sure if this is a good approach. Is there a simple way to do this without developing any custom code?
Regards,
Jay Malla
SAP XI Consultant
Licensed To Code
You can use the SOAP adapter. Check the flag <i>Do Not Use SOAP Envelope</i>.
You can use the content conversion module <i>MessageTransformBean</i>
I do not know, why your scenario does not work. Maybe you check the content type and the charset.
Regards
Stefan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Stefan,
Thanks for the feedback. The issue is that the partner site allows us to upload the file via a html page with a form file input. We are trying to simulate that through XI. The partner has not created a webservice that accepts the flat file posting (ideally xml would be better and they could just convert it to flat file themselves). But we're working under certain constraints.
So for now, we need to simulate posting using a web page with the file input field. So though I can post the flat file based on your suggestion of using the SOAP adapter and stripping out the SOAP envelope, i am not sure I can simulate the http form post which passes the necessary http header information (input type="file") :
Content-Disposition: form-data; name="files"; filename="file1.txt"
Content-Type: text/plain
Here is some notes regarding posting file data from HTML pages:
http://www.w3.org/TR/REC-html40/interact/forms.html
... The following example illustrates "multipart/form-data" encoding. Suppose we have the following form:
<FORM action="http://server.com/cgi/handle"
enctype="multipart/form-data"
method="post">
<P>
What is your name? <INPUT type="text" name="submit-name"><BR>
What files are you sending? <INPUT type="file" name="files"><BR>
<INPUT type="submit" value="Send"> <INPUT type="reset">
</FORM>
If the user enters "Larry" in the text input, and selects the text file "file1.txt", the user agent might send back the following data:
Content-Type: multipart/form-data; boundary=AaB03x
--AaB03x
Content-Disposition: form-data; name="submit-name"
Larry
--AaB03x
Content-Disposition: form-data; name="files"; filename="file1.txt"
Content-Type: text/plain
... contents of file1.txt ...
AaB03x
If the user selected a second (image) file "file2.gif", the user agent might construct the parts as follows:
Content-Type: multipart/form-data; boundary=AaB03x
--AaB03x
Content-Disposition: form-data; name="submit-name"
Larry
--AaB03x
Content-Disposition: form-data; name="files"
Content-Type: multipart/mixed; boundary=BbC04y
--BbC04y
Content-Disposition: file; filename="file1.txt"
Content-Type: text/plain
... contents of file1.txt ...
--BbC04y
Content-Disposition: file; filename="file2.gif"
Content-Type: image/gif
Content-Transfer-Encoding: binary
...contents of file2.gif...
BbC04y
AaB03x
Thanks for your help. I appreciate it.
Regards,
Jay
I get this error though - which is probably from the HTTP adapter not being able to read in the data to post... but i am not sure...
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
- <!-- Call Adapter
-->
- <SAP:Error xmlns:SAP="http://sap.com/xi/XI/Message/30" xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/" SOAP:mustUnderstand="">
<SAP:Category>XIAdapter</SAP:Category>
<SAP:Code area="PLAINHTTP_ADAPTER">ATTRIBUTE_SERVER</SAP:Code>
<SAP:P1>500</SAP:P1>
<SAP:P2>Internal Server Error</SAP:P2>
<SAP:P3>Error during parsing of SOAP header</SAP:P3>
<SAP:P4 />
<SAP:AdditionalText />
<SAP:ApplicationFaultMessage namespace="" />
<SAP:Stack>Http server code 500 reason Internal Server Error explanation Error during parsing of SOAP header</SAP:Stack>
<SAP:Retry>M</SAP:Retry>
</SAP:Error>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
83 | |
24 | |
12 | |
9 | |
7 | |
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.