2
我有下面的代碼,它試圖將xml構建的數據發佈到webservice .asmx 但xml構建的數據根本沒有到達webservice文件。當我使ajax調用控件是根本不移動到webservice文件。他們在ajax中的任何語法問題。 這是我在客戶端的代碼。張貼xml數據到.net webservice的問題asmx
$.ajax({
type: "POST",
async: false,
url: "/blkseek2/JsonWebService.asmx/GetList",
datatype:"xml",
data:"<?xml version='1.0'?><keyword1>"+keyword1+ "</keyword1><streetname>"+address1+ "</streetname><lat>"+lat+"</lat><lng>"+lng+ "</lng><radius>"+radius+"</radius>" ,
contentType: "application/xml; charset=utf-8",
// processData: false,
failure: function(XMLHttpRequest, textStatus, errorThrown)
{ ajaxError(XMLHttpRequest,textStatus, errorThrown); },
success: function(xml)
{ ajaxFinish(xml); }
});
這是Web服務的WebMethod我的代碼,試圖返回XML文件輸出請求
[WebMethod]
[ScriptMethod(ResponseFormat = ResponseFormat.Xml)]
public XmlDocument GetList(string keyword1, string streetname, string lat, string lng, string radius)
{
XmlDocument xmldoc= CreateXML(keyword1,streetname,lat,lng,radius);
return xmldoc;
}
我不會說「應該」。它的奇怪,我同意 - 但它是完全可以接受的XML發佈到Web服務。 – RPM1984 2010-09-03 05:30:58
我還沒有看到一個成功的jquery ajax調用通過發佈XML格式的參數。大多數情況下,因爲Jquery API將「數據」參數轉換爲查詢字符串。您可以發送XML INSIDE參數。 – SirDemon 2010-09-03 05:38:04
感謝您的回覆,如果他們是任何好的文章,試圖將一些數據發佈到webservice並以xml文件的形式獲得回覆,請告訴我。 – mahesh 2010-09-03 05:46:41