I’m trying to automate a file upload process to a website using HTTP.
From reading on this forum it sounds like I need to mime encode the contents of the file, and set the Content-Type to multipart/form-data before using the pub.client:HTTP to perform the upload.
Is this true? If so, then can someone tell me how I can mime encode my file?
Frank is right; MIME services from WmSamples is where to go. It won’t complete the picture, though. There has been a lot of questions about MIME-encoding messages on the Discussion Forums.
Take some time to learn from everyone else – read up!
Hi there,
I have read (I think) all threads on HTTP file posts to the IS, but unfortunately no one speaks about getting the actual InputStream to create the mime object. I have found a thread about creating custom content handlers but the sample code given has quite a number of bugs in it, and in the end does not do the job
Problem is that after posting a form (multipart/form-data) to the IS, the only way I can get the InputStream from the pipeline is by using (IData)pi.getProtocolProperty(“contentStream”);… When checking the info in the stream (by converting to a byteArray), it looks as if I am missing some headers.
I am not quite sure why the boundaries are still present, as I assumed they would be removed from the stream before being put into the pipeline. Do you have any additional info on this or am I just going down the wrong track in handling this problem?
PS. Currently using IS 6.0.1 SP1 on both Unix & Windows 2K
Chris, your post states that you posted the form data to the IS, while the previous messages in this thread are about posting from the IS. For receiving multipart data in IS, you want to obtain the multipart content handler from webMethods. I believe you can get this by contacting webMethods technical support or professional services.
Thanks for the info. I know it is the other way around, but it seems that most threads on this subject are mixed like that so I am trying my luck on various threads.
As far as I could figure out, wM does not have such a content handler, but I will try again with PS.
Hi,
I want to uplaod file over jsp side.
in google i found a lot of Example. but i think that somting is missing.
so, i want to upload file on IS ( Integration Server ) .
Here ist the HTML Side:
<form>
<input>
<input>
</form>
this html is runing okay but by the jsp side is missing something
How can i complete this jsp-side, so that i can upload file on IS?
the JSP side:
<% Stirng filename=request.getParameter(“file”);
FileInputStream is =new FileInputStream (filename);
int ch;
while ((ch =is.read())>=0)
out.print((char) ch);
is.close();
%>
in JSP side is missing the adress of IS and maybe more.
can someone give some tip? how can i coplete the jsp seid?
thanks, Roya
Roya, if you need a quick resolve, check the shareware section of wmusers. I placed a demo package there that uses a DSP to upload the file. The services will explain to you what happens and what you need to do.
In JSP the matter is of a different nature. I would suggest you have a look at Apache Struts and see if you can incorporate those in your application. That might also save you a lot of problems.
I too have a scenario where a (excel) file needs to be uploaded directly to a webMethods service through a JSP. I went through your shared package and it seems very useful… however, there are references to certain GDCUtils services which are not a part of the package. There’s one for writing to a file - which is not a prob at all… I have that covered, but there’s another one (GDCUtils.mime:getFormInputs)that extracts from the mimeHeader into ‘itemName’, ‘itemType’ and ‘localFilename’. I have very little or almost no understanding of the mime object and contents… this is my first attempt at it… thus, I do not know how to extract the above in absence of the getFormInputs service. Could you please share that service too? Also any helpful tips on how this all works would be greatly appreciated.
Reading a couple of threads and specifications on the Mime helped me understand the structure and I was able to write a java service to extract the required info from the mimeHeader.
I was trying to do the same kind of HTTP file transfer into my application back and forth from client machine to IS and reverse. I couldnot able to find “shareware section of wmusers” for your codes(demo). could you pls. tell where is it under?
Hi Rohit,
I’m also facing the same issue. I have to upload excel file to IS from DSP. Can you please share your services as I’m not able to find sample package given by Chris.