webMethods

webMethods

Join this online group to communicate across IBM product users and experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.

 View Only
Expand all | Collapse all

How to send a mimestream using pub.client:http

  • 1.  How to send a mimestream using pub.client:http

    Posted Tue March 13, 2018 01:26 PM

    Hi community!

    i have to create and pass a multipart/form-data mimestream through the pub.client:http service.
    I am able to produce following mime string.

    [i]
    Message-ID: 1183093294.126.1520957381494.JavaMail.DEDCW28EAI201$@DEDCW28EAI201
    MIME-Version: 1.0
    Content-Type: multipart/form-data;
    boundary=“----=_Part_125_1965686719.1520957381494”

    ------=_Part_125_1965686719.1520957381494
    Content-Type: application/json

    {
    “id” : “00d75c67-21d8-43d8-a675-505173a9a170”,
    “fields” : {
    “DokumentartRgWare” : “GS”,
    “Barcode” : “”,
    “Lieferscheinnummer” : “”,
    “RechnungsNr” : “”,
    “Rechnungsdatum” : “06.10.2017”,
    “Lieferantenname” : “”
    }
    }
    ------=_Part_125_1965686719.1520957381494–
    [/i]

    This contains the correct Content-Type header which is needed by the application server that is going to deal with the request.

    Then i pass this string to the pub.client:http service.

    Now the remote service fails with: “Unable to get boundary for multipart”

    When i checked the HTTP Trace, i can see that IS is setting the Content-Type to “application/x-www-form-urlencoded”,
    which explains the error message. It looks like pub.client:http does not take care of the mimestring headers and passes the complete mimestring (including headers) as body.

    What do i have to do, to get
    Content-Type: multipart/form-data;
    boundary=“----=_Part_125_1965686719.1520957381494”

    as a http request header?

    Kind regards,
    Martin

    IS Version: 9.7
    mime.txt (594 Bytes)


    #Integration-Server-and-ESB
    #webMethods


  • 2.  RE: How to send a mimestream using pub.client:http

    Posted Tue March 13, 2018 02:42 PM

    Hi,

    Can you please add a very first step with flow:getTransportInfo in the receiving svc logic and see what you get in the pipeline?

    Also I assume you have set the Content-Type in the send http service and receiving service the service input set as *Node object or *ContentStream?

    HTH,
    RMG


    #Integration-Server-and-ESB
    #webMethods


  • 3.  RE: How to send a mimestream using pub.client:http

    Posted Wed March 14, 2018 05:40 AM

    Hi RMG,

    thank you for your reply. I found the solution myself.

    After pub.mime:createMimeData, pub.mime:addBodyPart and pub.mime:getEnvelopeStream you can easily pass the generated envStream to pub.client:http (data/mimeStream).

    IS then takes the header of the stream and appends them to http headers.

    I changed my implementation accordingly and it is working fine.

    Kind regards,
    Martin


    #webMethods
    #Integration-Server-and-ESB


  • 4.  RE: How to send a mimestream using pub.client:http

    Posted Wed March 14, 2018 03:48 PM

    I also assume you have set this in the http service param:

    Content-Type: multipart/form-data

    I think you are indeed good on track:)

    Cheers!
    RMG


    #webMethods
    #Integration-Server-and-ESB


  • 5.  RE: How to send a mimestream using pub.client:http

    Posted Thu March 15, 2018 08:38 AM

    Hello,
    I have the same need for my project but I don’t success

    can you share your code ?

    remarks : whereas in others “languages” like Java or C, we can’t share easily source code of flow service. I don’t see anywhere in w3 some code.
    what is the good way to share ?

    thanks


    #Integration-Server-and-ESB
    #webMethods


  • 6.  RE: How to send a mimestream using pub.client:http

    Posted Thu March 15, 2018 10:23 AM

    Hi Bruno,

    please check the attachment. There is a steb by step documentation what i did to get it working.

    It´s important that you do not operate on the envStream object, that is generated by pb.mime:getEnvelopeStream before passing it to pub.client:http. Otherwise the stream is empty.

    Hope it is working.

    Kind regards,
    Martin

    StepByStep.pdf (118 KB)


    #Integration-Server-and-ESB
    #webMethods


  • 7.  RE: How to send a mimestream using pub.client:http

    Posted Fri August 28, 2020 07:14 AM

    thanks for your help

    client:http was sending application/x-www-form-urlencoded because :
    I was using pub.io.streamToString with envStream from getEnvelopeStream for debug before launching client:http

    Strange no ?


    #Integration-Server-and-ESB
    #webMethods


  • 8.  RE: How to send a mimestream using pub.client:http

    Posted Thu July 04, 2019 06:06 AM

    Hi Martin, This is too late to ask this, but if you remember, please let me know if passed any input to pub.mime:createMimeData. Because same implementation is not working for me in the pub.mime:getEnvelopeStream step.


    #webMethods
    #Integration-Server-and-ESB


  • 9.  RE: How to send a mimestream using pub.client:http

    Posted Fri August 28, 2020 02:10 PM

    Hi Bruno,

    Do you still need help on this or code is in working condition now?

    HTH,
    RMG


    #webMethods
    #Integration-Server-and-ESB