2011-06-27 57 views
0

我想張貼xml文件到dealmap enter link description here api使用一個xml文件我用軌中的生成器(儘管這應該適用於任何xml POST請求)。張貼xml文件爲api使用rails

我嘗試發送的XML文件可以在這裏找到:

http://www.frugle.me/frugles/25-10-off-purchase/dealmap.xml

,我想在這裏公佈的地址:我試圖

http://api.thedealmap.com/deals/?key=0-2304664-634434226955110000

用捲曲法使用/兩者:

curl -X POST -d -v http://www.frugle.me/frugles/25-10-off-purchase/dealmap.xml http://api.thedealmap.com/deals/?key=0-2304664-634434226955110000 

curl -d -v http://www.frugle.me/frugles/25-10-off-purchase/dealmap.xml http://api.thedealmap.com/deals/?key=0-2304664-634434226955110000 

,但有的時候我在我結束一個404錯誤,其他時候我得到像這樣的dealmaps 500錯誤結束:

* About to connect() to api.thdealmap.com port 80 (#0) 
* Trying 173.227.66.251... connected 
* Connected to api.thdealmap.com (173.227.66.251) port 80 (#0) 
> POST /deals/?key=0-2304664-634434226955110000 HTTP/1.1 
> User-Agent: curl/7.19.7 (universal-apple-darwin10.0) libcurl/7.19.7 OpenSSL/0.9.8l zlib/1.2.3 
> Host: api.thdealmap.com 
> Accept: */* 
> Content-Length: 65 
> Content-Type: application/x-www-form-urlencoded 

< HTTP/1.1 500 Internal Server Error 
< Connection: close 
< Date: Sun, 12 Jun 2011 05:04:42 GMT 
< Server: Microsoft-IIS/6.0 
< Content-Language: en-US 
< Content-Type: text/html 
< 
* Closing connection #0 

我要對所有這一切錯了嗎?有沒有一個標準的方法來做到這一點?我無法在互聯網上找到任何有關此類行爲的信息,儘管看起來它們很平常。

任何幫助你可以給予非常感謝!

回答

2

你在做什麼不是在這裏發佈xml文件http://www.frugle.me/frugles/25-10-off-purchase/dealmap.xml你正在發佈這個文字字符串「http://www.frugle.me/frugles/25-10-off-purchase/dealmap.xml」到http://api.thedealmap.com/deals/?key=0-2304664-634434226955110000

試試這個發佈的XML:

curl -X POST -v --data-ascii @xmlfile.xml http://api.thedealmap.com/deals/?key=0-2304664-634434226955110000 
* About to connect() to api.thedealmap.com port 80 (#0) 
* Trying 50.19.80.24... connected 
* Connected to api.thedealmap.com (50.19.80.24) port 80 (#0) 
> POST /deals/?key=0-2304664-634434226955110000 HTTP/1.1 
> User-Agent: curl/7.19.7 (universal-apple-darwin10.0) libcurl/7.19.7 OpenSSL/0.9.8l zlib/1.2.3 
> Host: api.thedealmap.com 
> Accept: */* 
> Content-Length: 1271 
> Content-Type: application/x-www-form-urlencoded 
> Expect: 100-continue 
> 
< HTTP/1.1 100 Continue 
< HTTP/1.1 400 Bad Request 
< Cache-Control: no-cache 
< Content-Type: text/html 
< Date: Mon, 27 Jun 2011 06:39:54 GMT 
< Server: Microsoft-IIS/7.0 
< Set-Cookie: ASP.NET_SessionId=wo1i2h45dprmkqec41sl4v55; path=/; HttpOnly 
< X-AspNet-Version: 2.0.50727 
< Content-Length: 1165 
< Connection: keep-alive 
< 
<?xml version="1.0" encoding="utf-8"?><HTML><HEAD><STYLE type="text/css">#content{ FONT-SIZE: 0.7em; PADDING-BOTTOM: 2em; MARGIN-LEFT: 30px}BODY{MARGIN-TOP: 0px; MARGIN-LEFT: 0px; COLOR: #000000; FONT-FAMILY: Verdana; BACKGROUND-COLOR: white}P{MARGIN-TOP: 0px; MARGIN-BOTTOM: 12px; COLOR: #000000; FONT-FAMILY: Verdana}PRE{BORDER-RIGHT: #f0f0e0 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #f0f0e0 1px solid; MARGIN-TOP: -5px; PADDING-LEFT: 5px; FONT-SIZE: 1.2em; PADDING-BOTTOM: 5px; BORDER-LEFT: #f0f0e0 1px solid; PADDING-TOP: 5px; BORDER-BOTTOM: #f0f0e0 1px solid; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e5e5cc}.heading1{MARGIN-TOP: 0px; PADDING-LEFT: 15px; FONT-WEIGHT: normal; FONT-SIZE: 26px; MARGIN-BOTTOM: 0px; PADDING-BOTTOM: 3px; MARGIN-LEFT: -30px; WIDTH: 100%; COLOR: #ffffff; PADDING-TOP: 10px; FONT-FAMILY: Tahoma; BACKGROUND-COLOR: #003366}.intro{MARGIN-LEFT: -15px}</STYLE> 
<TITLE>Request Error</TITLE></HEAD><BODY> 
<DIV id="content"> 
<P class="heading1">Request Error</P> 
<BR/> 
<P class="intro">The server encountered an error processing the request. See server logs for more details.</P> 
<P class="intro"></P> 
</DIV> 
* Connection #0 to host api.thedealmap.com left intact 
* Closing connection #0