on 07-18-2008 12:27 PM
A buyer platform sends a multipart message (same format as when posting data via an Internet Explorer form) via HTTP to our XI.
Which XI adapter is capable of receiving such a message ?
- Plain HTTP rejects multipart, this I found out.
- Marketplace adapter is not suitable, because the message is not in MML format.
- SOAP ? I tried it with nosoap=true, but run on an internal error 500. Can I use SOAP although the message has to do nothing with SOAP at all ?! Probably not
Anyone did it in a project and can tell me which adapter I need to use ? Or do I have to implement a new HTTP inbound handler in ICF ?! Hope not, XI should be capable of accepting a multipart message.
Sample message (in HTTP body):
-
7d831a217068c
Content-Disposition: form-data; name="username"
user
-
7d831a217068c
Content-Disposition: form-data; name="password"
pwd
-
7d831a217068c
Content-Disposition: form-data; name="document"; filename="cXML.xml"
Content-Type: text/xml
<?xml version="1.0" encoding="ISO-8859-1"?>
<-- here the payload which I need then to map in XI -->
<cXML payloadID="7362120000340" xml:lang="SV" version="2.0" timestamp="2008-07-11T12:29:19">
<!-- more data -->
</cXML>
-
7d831a217068c
Content-Disposition: form-data; name="Attach.x"
Submit
-
7d831a217068c--
CSY
Hi Stefan,
thanks for that useful information, I now get the content via SOAP sender into XI. But the next problem is, how to extract the attachment so that I can further use it in XI (for mapping and so on) ?
Currently XI shows me 4 payloads: MainAttachment and attachment2-4.
I understand from the documentation that I cannot use the PayloadSwapBean in the SOAP sender (which would be exactly what I need).
But I need to map attachment-3, and skip the rest. How to do it ? Only possible with Axis ? Can Axis use the PayloadSwapBean ? Is there a blog for an example configuration ?
Or could I use an XSLT or Java mapping which can work on the attachment ? Are the attachments still available when the mapping is called ? Or does the mapping get then only an empty payload (MainDocument payload does not exist) ? Or does it take only the first attachment as payload ?
CSY
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Christian,
the Axis adapter epxects a SOAP message, so it would not work in this scenario.
The SOAP adapter does not allow adapter modules.
So I have to say, that there is no support for your scenario here.
I recommend creating a servlet, parse the incoming message, extract the payload and send this to XI with help of a Java proxy or a web service client.
Regards
Stefan
Summary and solution:
the following ways do not work for processing incoming HTTP multipart messages into XI:
1. use plain HTTP adapter: rejects hardcoded multipart content-type (you will get error 415)
2. use SOAP sender adapter with nosoap=true, and Keep attachments. Although this will lead you one step further (the message is saved in XI), you have then the problem that you cannot extract the payload attachments (because you cannot use the PayloadSwapBean for SOAP sender).
from here there are following options:
1. own servlet
2. own ICF HTTP request handler for new URL prefix
3. making wild ABAP things in mapping to extract the attachment
I decided to take option 2 as least painful. I copied the existing request handler for the plain HTTP adapter (CL_HTTP_PLAIN_INBOUND) and adapted it to extract the needed XML payload from the HTTP body. This was quite straightforward. I added two parameters xmlTag and xmlEncoding which control what to extract, so it is generally usable for all multipart messages. Works perfect.
What I do not understand, why didnt SAP XI provide such a handler in the standard ? Its totally simple. Am I the first person who needs to connect to a marketplace which sends multipart via HTTP to XI ? Probably not.
Anyway, its working now. I will put these things into a blog.
Thanks Stefan for pointing out the dead ends.
CSY
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Christian Sy,
I ran into an issue with incoming HTTP message.
An external vendor posts xml into PI URL. The vendor expects a response - with some format.
HTTP by default gives HTTP OK 200. But that is not sufficient.
Do you think we will have to tweak the CL_HTTP_PLAIN_INBOUND to send out a message with desired response.
Will CL_HTTP_PLAIN_OUTBOUND be useful?
Please throw some light on this...
reg
For non-SOAP messages you have to add &no-soap=true to the URL of the SOAP adapter. In the channel you check: do not use "SOAP envelope" and "keep attachments".
The plain HTTP adapter does not support attachments.
You find this information here:
http://help.sap.com/saphelp_nw04/helpdata/en/0d/5ab43b274a960de10000000a114084/frameset.htm
Regards
Stefan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
How u made sure that http adapter wont work?
I dont remember exactly but i think jms adapter provide some related functionality.
Regards,
Prateek
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
77 | |
9 | |
9 | |
7 | |
6 | |
6 | |
6 | |
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.