2012-10-09 2 views
1

는 다음 코드를보고하십시오 입력 된 XML 데이터 i가 같은 응답을 얻었다 난 형태로 데이터를 전송포스트 - 오류 응답 : - : <strong>OK</strong> :

<form id='myform' name='myform' action='http://www.xxx.xom' method='post' accept-charset='UTF-8'> 
<input type='input' name='xmlData' value='<?xml version="1.0"?> 
<order_zip>23222</order_zip> 
<shipping_id>15</shipping_id> 
<products><product> <product_id>230</product_id> <quantity>40</quantity></product></products>'> 
</form> 

.

그러나 백엔드 (백그라운드)에서해야합니다.

set xmlhttp = server.createobject("MSXML2.XMLHTTP") 
xmlhttp.Open "POST",URL,False 
xmlhttp.SetRequestHeader "Content-Type","text/xml;charset=UTF-8" 
xmlhttp.Send xmlstring 
Response.write(xmlhttp.response.text) 

내가 오류 응답을 받고 있어요이 시간 :

그래서 내 코드는 테크 사람은 PHP에게 더 ASP를 모르는 입력 된 XML 데이터 - 그래서 그는 내가 필요 알고하지 않습니다 내 코드가 바뀌었다. 여기

는 PHP 코드 샘플입니다 :

<?php 
    $xml['xmlData'] .= '<order_zip>187654</order_zip>'; 
    $xml['xmlData'] .= '<shipping_id>3</shipping_id>'; 
    $xml['xmlData'] .= '<products>'; 
    $xml['xmlData'] .= '<product><product_id>458</product_id><quantity>11</quantity></product>'; 

    $connection = curl_init(); 
    curl_setopt($connection, CURLOPT_URL, "http://api.xml.com/xml/sendOrder"); 
    curl_setopt($connection, CURLOPT_SSL_VERIFYPEER, 0); 
    curl_setopt($connection, CURLOPT_SSL_VERIFYHOST, 0); 
    curl_setopt($connection, CURLOPT_POST, 1); 
    curl_setopt($connection, CURLOPT_POSTFIELDS, $xml); 
    curl_setopt($connection, CURLOPT_RETURNTRANSFER, 1); 
    set_time_limit(108000); 
    $strResponse = curl_exec($connection); 
    if(curl_errno($connection)) { 
    print 'Curl error: ' . curl_error($connection); 
    } 
    curl_close($connection); 
    print_r($strResponse); 
    } 
    ?> 

난 그냥 배경/백엔드에서 실행되도록 양식을 필요 - 그래서 내가 올바른 코드를 얻을 드릴 것입니다.

답변

0

시도 뭔가 같이 주셔서 감사합니다 :

xmlstring = "<root>" & _ 
      " <order_zip>23222</order_zip>" & _ 
      " <shipping_id>15</shipping_id>" & _ 
      " <products>" & _ 
      " <product>" & _ 
      "  <product_id>230</product_id>" & _ 
      "  <quantity>40</quantity>" & _ 
      " </product>" & _ 
      " </products>" & _ 
      "</root>" 

set xmlhttp = Server.CreateObject("MSXML2.ServerXMLHTTP") 
xmlhttp.Open "POST", URL, False 
xmlhttp.SetRequestHeader "Content-Type","application/x-www-form-urlencoded" 
xmlhttp.Send xmlstring 
Response.write xmlhttp.responseText 

나는 그렇지 않으면 유효한 XML-문서하지 않을 것 XML에 루트 요소를 추가했다.

같은 제목에 대한 KB 기사를 참조하십시오. http://support.microsoft.com/kb/290591