IBM webMethods Hybrid Integration

IBM webMethods Hybrid Integration

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

Using HTTP to post a file

  • 1.  Using HTTP to post a file

    Posted Tue September 28, 2004 10:10 PM

    I am using Business Connector 4.6. I have created a fixed length record flat file. It is in the pipeline as a string. I am wondering what the steps are to post this file to a https:// address using the HTTP service. Can you tell me the basic steps needed to do this and how to set the parameters in HTTP. I have a https address, a user id, and password. I can go to the address using a web browser and upload the file but I want to automate this from within BC. Thanks for any help.


    #webmethods-Protocol-and-Transport
    #webMethods
    #Integration-Server-and-ESB


  • 2.  RE: Using HTTP to post a file

    Posted Tue September 28, 2004 10:49 PM

    Rebecca,

    Here is the info of using that http service.
    Set these parameters of service Input:

    url-enter the destination https:\ipAddress
    method-Post
    data\string-directly map that flatfile string here
    or
    data\bytes-you can convert the flatfile string to bytes and map here
    or
    data\stream-you can convert the flatfile string to stream and map here if it is large file or so.
    auth/type-set as Basic
    auth/user-enter userid
    auth/pass-enter password
    headers/Content-type -explicitly create this param and set this to text/plain.

    HTH,
    RMG.


    #webmethods-Protocol-and-Transport
    #webMethods
    #Integration-Server-and-ESB


  • 3.  RE: Using HTTP to post a file

    Posted Wed September 29, 2004 02:12 PM

    Thanks RMG. Where do I put the file name? I need to be able to name the file. Also, since I am posting to a https ip address, does this make this a secure transfer?


    #Integration-Server-and-ESB
    #webmethods-Protocol-and-Transport
    #webMethods


  • 4.  RE: Using HTTP to post a file

    Posted Wed September 29, 2004 03:00 PM

    Rebecca,

    In Http no need of putting filename,just you are posting the data and the target system will extract the data,if you want to do a filetransfer then basically use the pub.client:ftp service(but this is not a secure FTP).

    HTH,
    RMG.


    #webmethods-Protocol-and-Transport
    #Integration-Server-and-ESB
    #webMethods


  • 5.  RE: Using HTTP to post a file

    Posted Wed September 29, 2004 03:07 PM

    Also regarding https transport you have to coordinate with the destination team and test the scenario if your IS giving any problems when posting the data to their https ip/port.
    If it is not SSL handshaking process then you are fine and in the runtime your target server will do a encryption(publickey)verification,so contact your partner in this transaction.

    Regards,


    #webmethods-Protocol-and-Transport
    #Integration-Server-and-ESB
    #webMethods


  • 6.  RE: Using HTTP to post a file

    Posted Fri October 15, 2004 02:51 PM

    Hi,

    i understand, that the post-method needs a service on the server-side. But my partner work with an iis 5.0 and there is only the put method available . Does anybody know what i have to do? When i try it, i ´ll get an error code like “HTTP/1.0 403 Forbidden”.


    #Integration-Server-and-ESB
    #webMethods
    #webmethods-Protocol-and-Transport


  • 7.  RE: Using HTTP to post a file

    Posted Wed October 27, 2004 08:50 PM

    OK, I am able to use the http to ‘put’ a file to a https address. I set Content-Type=text/plain and passed the data as bytes. Now my question concerns passing the data as a stream. According to the documentation I must use ‘post’, is this correct? What is the setting of Content-Type? Do I need to set encoding? When trying to pass as a stream I am getting this error returned in BODY/bytes :

    <!doctype>
    <html><head>
    <title>422 Unprocessable Entity</title>
    </head><body>

    Unprocessable Entity

    The server understands the media type of the
    request entity, but was unable to process the
    contained instructions.
    /aontest.txt: Permission denied. (POST)<p>
    </body></html>


    #webmethods-Protocol-and-Transport
    #webMethods
    #Integration-Server-and-ESB


  • 8.  RE: Using HTTP to post a file

    Posted Wed October 27, 2004 09:49 PM

    Rebecca,

    Once you have converted the data as Stream object then map the stream to data/stream and also select loadAs=Stream (param in the pub.client:http) and content-type=text/plain should be fine unless if it is not XML type.

    HTH,
    RMG.


    #Integration-Server-and-ESB
    #webmethods-Protocol-and-Transport
    #webMethods


  • 9.  RE: Using HTTP to post a file

    Posted Tue December 14, 2004 06:37 PM

    Hi All,

    Our partner is using BizTalk server to post xml messages to our SAP BC
    4.7.For some reason the default content-type for xml message is set to
    text/plain in biztalk server.When we process the xml file with a service having DocumenToRecord as a stating point we get 403 Service Error.

    Is there a way to receive the xml file sent by http post with content type text/plain.

    Thanks very much.
    rajammir


    #Integration-Server-and-ESB
    #webmethods-Protocol-and-Transport
    #webMethods


  • 10.  RE: Using HTTP to post a file

    Posted Tue December 14, 2004 06:46 PM

    Raj,

    Basically Content-Type should be text/xml,this is the only way of handling XML’s via http,so that WM content handler will handle the node object and parse it successfully.

    HTH,
    RMG


    #Integration-Server-and-ESB
    #webmethods-Protocol-and-Transport
    #webMethods


  • 11.  RE: Using HTTP to post a file

    Posted Tue December 14, 2004 07:02 PM

    hi RMG,

    Thanks for your reply.Is there a way we can receive xml file as a string.What method they should follow to send that as a string.

    Thanks,
    rajammir


    #webmethods-Protocol-and-Transport
    #Integration-Server-and-ESB
    #webMethods


  • 12.  RE: Using HTTP to post a file

    Posted Wed December 15, 2004 07:12 PM

    text/xml is the easiest way to receive XML but it isn’t the only way. When the content-type is text/plain, a variable named ffdata will be in the pipeline when the service is called. This is an InputStream-derived object which can be passed to pub.io.streamToBytes. The resulting bytes can be passed to pub.string.bytesToString.

    Raj, you don’t need the partner that is using BizTalk to make any changes. Change your service that they invoke to use the above steps (or whatever you need) and you’ll be set. You can go even further and make your receive service accept ffdata, node or a named string (such as “document” or “edidata”). That way your service can support content-types of text/plain, text/xml or an http get with a named var. The service would do these steps:

    • Check if node is not $null. If present, use it.
    • If node is $null, check for a named string. If present, convert it to a node.
    • If the named string is $null, check for ffdata. If present, convert to bytes, convert the bytes to a string, convert the string to a node.
    • If ffdata is $null, no usable data was passed. Return an error.
    • At this point, you have a node. Do whatever processing you need.

    HTH.


    #webmethods-Protocol-and-Transport
    #Integration-Server-and-ESB
    #webMethods


  • 13.  RE: Using HTTP to post a file

    Posted Tue October 11, 2005 08:48 PM

    Hi Rob,

    From your above posting, if the partner sends an xml data as a stream with the content-type text/xml in HTTP post. what should be the name of the variable in the pipeline?

    Thanks,
    SATYA.


    #webMethods
    #Integration-Server-and-ESB
    #webmethods-Protocol-and-Transport


  • 14.  RE: Using HTTP to post a file

    Posted Tue October 11, 2005 09:40 PM

    I got my answer.

    The name of the variable in the pipeline is node object.

    Thanks though.

    Thanks,
    SATYA.


    #webMethods
    #Integration-Server-and-ESB
    #webmethods-Protocol-and-Transport