cancel
Showing results for 
Search instead for 
Did you mean: 

Multipart HTTP Post

Former Member
0 Kudos

Dear All,

I need to forward a text file (without any conversion or mapping) to the HTTP receiver adapter and create a HTTP POST to an external server. Now the problem is that the HTTP Post is supposed to be a multipart message with 3 different content-types, content-lengths and all of them have to be delimited by a "--BOUNDARY" constant.

I read through a lot of SDN Blogs and HTTP forum post, even setup TCPGATEWAY in order to trace my HTTP output, but just can't come even close to producing this sample HTTP Post:

"POST /hapld/tos/kdwhapltos HTTP/1.1

Host: www.xxx.com

Content-type: multipart/mixed; boundary=BOUNDARY

Content-length: 1040

--BOUNDARY

Content-type: application/x-www-form-urlencoded

Content-length: 140

AppVersion=1.0&AcceptUPSLicenseAgreement=Yes&ResponseType=application/x-xxx-pld&VersionNumber=

V4R1&UserId=useridvalue&Password=passwordvalue

--BOUNDARY

Content-type: application/x-xxx-binary

Content-length: 719

020082 2.0 2002101700000000000010500 000000001*AA0A1754 US

1234567002000001*BA1z1234560100002352 00001+0000000000000010 +000

0000000000000LBS01PRE10 3INUSD000001*CA18ATTENTION

DELIVERY 234 SOME LOCAL ST SO

ME CITY NJ 07652 US12015551212 *PA1z1234560100002352

02+0000010 +0000010

*SA000004

BOUNDARY"

1. Is it even possible to produce that kind of multipart post, using the HTTP adapter with it's header filed, prolog or epilog possibilities? How to insert a "new line" within the prolog string for example?

2. Can anyone who was required to develop a similar complex HTTP post, please provide his solution or any useful tips and links. I've read the SAP Help sites...

Thanks in advance!

Michael

Accepted Solutions (0)

Answers (1)

Answers (1)

stefan_grube
Active Contributor
0 Kudos

You can create that structure with Java mapping.

I have done this for Mail adapter, but the principles are the same:

/people/stefan.grube/blog/2007/04/17/xi-mail-adapter-an-approach-for-sending-emails-with-attachment-with-help-of-java-mapping

Former Member
0 Kudos

Hi Stefan,

thank you for the advice!

As mentioned in need to simply forward an unstructured text file via HTTP. If I manage to construct the correct HTTP format using your java mapping as an example, I will still need to provide an inbound and outbound interface and therefore I would need to perform a file conversion to XML first. Is there any way to avoid this?

Thanks

Michael

stefan_grube
Active Contributor
0 Kudos

As you talked about a file, I thought you use a file adapter, there you need no conversion. Which adapter type you want to use instead?

Former Member
0 Kudos

Hi again,

I am using the file adapter and a virtual Inbound Interface and namespace, so that I don't need to define any object within the Repository, but in order to use the java mapping, I need to create an interface-mapping. The interface mapping requires an inbound and outbound interface though.

What I want to achive is polling a text file from a local network folder via the file adapter and forwarding this file without any conversion as an HTTP Post to an external HTTP service. As this receiver service requires a multipart HTTP message, I'm forced to figure out another way to foward the original payload, but modify the HTTP buildup.

Regards

Michael

alejandro_bindi
Active Contributor
0 Kudos

Hello Michael, I know this is an old post, but I'm having a very similar need and nobody answers my own thread on this subject (http://scn.sap.com/thread/3262537).

Could you please specify briefly how you solved it (if you did)?

Many thanks in advance

Former Member
0 Kudos

Hi Alejandro,

I think you are looking for a general documentation on the HTTP_AAE adapter, however I only required to know the timeout value and found the answer via the following link:

http://scn.sap.com/community/pi-and-soa-middleware/blog/2011/01/26/tuning-the-pi-messaging-system-qu...

Best regards

Michael

alejandro_bindi
Active Contributor
0 Kudos

Hi Michael, thanks for the quick response.

What i'm actually looking for is the best way to achieve this kind of multipart HTTP post.

The HTTP_AAE adapter has multipart funcionality, but it generates only one part.

So I'm trying to either find a way to make it separate the different parts, or else look into other solutions people already used (java proxy, for example).

I'll post further details in my own thread to avoid more confusion.

Many thanks