HTTP - File content as Stream

Hi,
I’ve a scenario where I need to send file content as stream and an IS document together as inputs to another service over http.

What is the best way to achieve this in webMethods.

Please note that the target service is also an webMethods flow service.

use the service: pub.client:http to post, you can populate either: data/stream
or: data/mimeStream
with a stream object
also set:
Content-Type=application/octet-stream
under headers

on the receiver side, you will have a Stream object with name:
contentStream

Yes try with the contentStream object and make sure the content-type also set to appropriate one like application/octect-stream etc…

It worked after setting the Content-type to octet-stream, previously I had it as multipart/mixed.
However, I have an issue while extracting the content of the mime message. On the sender side, I’m adding two body parts. File Content and XML data but on the receiver end when I used getNumParts service, it just shows me 1.

The sender has following steps to build the mime message

  1. createMimeData
  2. convert xml string to stream
  3. addBodyPart (content as above stream, contentype as text/plain)
  4. Read file as Stream
  5. addBodyPart ( content as above stream, contentype as text/plain)
  6. getEnvelopeStream - createMultipart to yes
  7. call http (data/mimeStream as above stream, method - post, Content-type - application/octet-stream

Receiver has createMimeData to create mime object out of contentStream and invoke getNumParts to get a list of parts

I’ve installed the WmSamples package and added pub.client:http service with the url and it does not work as the number of parts is returning me just 1 :slight_smile:

Any idea, why the mime message just has one part instead of all the parts we add ?

I tried all the options I could think of but could not get the mime part working as it all the time gives me that the message has only one parts.

Can I send the variables in the args and send the file content as stream in the http call ?
Is it a good idea or can I use http headers to go around this problem ??

Yes you can in deed send vars in args and stream content (with appropriate content-type) in the http call and make sure the end point also accept the args.

HTH,
RMG