curl-users
Re: Posting a text file containing xml to a web site-REVISED
Date: Mon, 1 Jul 2002 23:28:16 +1000
Are you sure you want to be posting the file as a plain file upload? If you
are trying to do XML-RPC or SOAP etc., you should probably just be posting an
entire XML body part in the request, with the real request type being
text/xml, not multipart/form-data.
Try something like this instead:
curl -v o testit.txt -E PerfPrivateVerCert.pem --data-binary=@xml.txt
--header 'Content-Type: text/xml'
https://52.128.224.9/NASApp/dpcus01/B2BConnectorDPCqa
This will read the whole body from your file, and send it as the content in
the POST request. You need to set the content type as a specific header.
Cris - http://www.awayweb.com/
On Sat, 29 Jun 2002 07:34, Steven R. Shourds wrote:
> curl -v -o testit.txt -E PerfPrivateVerCert.pem -F xml.txt;type=text/xml --
> trace-ascii trace.txt https://52.128.224.9/NASApp/dpcus01/B2BConnectorDPCqa
> ?tgt=JMSORDER01QA
>
> trace.txt
> == Info: About to connect() to 52.128.224.9:443
> == Info: Connected to 52.128.224.9 (52.128.224.9) port 443
> == Info: libcurl is now using a weak random seed!
> == Info: SSL connection using RC4-MD5
> == Info: Server certificate:
> == Info: . subject: /C=US/ST=Delaware/L=Newark/O=E.I. DU Pont DE Nemours an
> d Company/OU=CSC e-Commerce Infrastructure1/CN=icoe01.dupont.com
> == Info: . start date: 2001-09-12 00:00:00 GMT
> == Info: . expire date: 2002-09-12 23:59:59 GMT
> == Info: . common name: icoe01.dupont.com (does not match '52.128.224.9')
> == Info: . issuer: /C=US/O=RSA Data Security, Inc./OU=Secure Server Certifi
> cation Authority
> => Send header, 355 bytes (0x163)
> 0000: POST /NASApp/dpcus01/B2BConnectorDPCqa?tgt=JMSORDER01QA HTTP/1.1
> 0042: User-Agent: curl/7.9.7 (win32) libcurl 7.9.7 (OpenSSL 0.9.6b)
> 0081: Host: 52.128.224.9
> 0095: Pragma: no-cache
> 00a7: Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */*
> 00e9: Content-Length: 137
> 00fe: Expect: 100-continue
> 0114: Content-Type: multipart/form-data; boundary=curluaKZKd1a2g8rXTe7
> 0154: zfbq2EM3Ryb
> 0161:
> => Send data , 137 bytes (0x89)
> 0000: --curluaKZKd1a2g8rXTe7zfbq2EM3Ryb
> 0023: Content-Disposition: form-data; name="xml.txt;type"
> 0058:
> 005a: text/xml
> 0064: --curluaKZKd1a2g8rXTe7zfbq2EM3Ryb--
> <= Recv header, 17 bytes (0x11)
> 0000: HTTP/1.1 200 OK
> <= Recv header, 33 bytes (0x21)
> 0000: Server: Netscape-Enterprise/4.1
> <= Recv header, 37 bytes (0x25)
> 0000: Date: Fri, 28 Jun 2002 21:27:36 GMT
> <= Recv header, 19 bytes (0x13)
> 0000: Connection: close
> <= Recv data, 1487 bytes (0x5cf)
> 0000: <HTML><HEAD><meta http-equiv="Content-Type" content="text/html;
> 0040: charset=UTF-8"><title>Error</title><body><h1>Error</h1>We are so
> 0080: rry, a server error has occured.<br>Please contact the<a href="m
> 00c0: ailto:support_at_comergent.com"> system administrator</a><br><br
> 0100: > <FORM NAME="n" METHOD="GET" TARGET="_top"><P><INPUT TYPE="butt
> 0140: on" VALUE="Go Back" onClick="history.go(-2)"></FORM><!--------
> 0180: --------------- START STACK TRACE -----------------------------
> 01c0: -<br>java.lang.NullPointerException.at com.comergent.dcm.messagi
> 0200: ng.MessagingServlet.createRequest(MessagingServlet.java:59).at c
> 0240: om.comergent.dcm.core.DispatchServlet.dispatch(DispatchServlet.j
> 0280: ava:111).at com.comergent.dcm.core.DispatchServlet.doPost(Dispat
> 02c0: chServlet.java:85).at javax.servlet.http.HttpServlet.service(Htt
> 0300: pServlet.java:772).at javax.servlet.http.HttpServlet.service(Htt
> 0340: pServlet.java:865).at allaire.jrun.servlet.JRunSE.service(JRunSE
> 0380: .java:1024).at allaire.jrun.servlet.JRunSE.runServlet(JRunSE.jav
> 03c0: a:936).at allaire.jrun.servlet.JRunRequestDispatcher.forward(JRu
> 0400: nRequestDispatcher.java:88).at allaire.jrun.servlet.JRunSE.servi
> 0440: ce(JRunSE.java:1143).at allaire.jrun.servlet.JRunSE.service(JRun
> 0480: SE.java:1133).at allaire.jrun.servlet.JvmContext.dispatch(JvmCon
> 04c0: text.java:330).at allaire.jrun.jrpp.ProxyEndpoint.run(ProxyEndpo
> 0500: int.java:382).at allaire.jrun.ThreadPool.run(ThreadPool.java:272
> 0540: ).at allaire.jrun.WorkerThread.run(WorkerThread.java:75)--------
> 0580: ------------- END STACK TRACE -------------------------------->
> 05c0: </body></html>.
> == Info: Closing connection #0
>
> I believe the problem is that my content type needs to be "text/xml". Any
> help is appreciated. Steve
> www.perfectionsoftware.com
>
> ----- Original Message -----
> From: Steven R. Shourds
> To: Curl Mailinglist
> Sent: Friday, June 28, 2002 2:19 PM
> Subject: Posting a text file containing xml to a web site
>
>
> I want to post a file (test.txt) containing xml to a URL and wait for a
> response to put back into a local file.
>
> The content-type must be "text/xml".
>
> I am using the following command but it is failing. I know the
> Certificate and URL are correct.
>
> curl -v -o c:\testit -E C:\FILES\TECH\CURL\PerfPrivateVerCert.pem -F
> test.txt https://x.x.x.x/NASApp/dpcus01/B2BConnectorDPCqa?tgt=JMSORDER01QA
>
> Am I using the correct option (-F). Is there a way to specify the
> contect-type?
>
> Thanks,
> Steve
> www.perfectionsoftware.com
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
Received on 2002-07-01