Javascript-форум (https://javascript.ru/forum/)
-   ExtJS (https://javascript.ru/forum/extjs/)
-   -   ExtJS + Rest (https://javascript.ru/forum/extjs/22098-extjs-rest.html)

mrshakirov 06.10.2011 13:41

ExtJS + Rest
 
Помогите с проблемой: запустил rest сервис на .net в сетке -
при url: http://localhost:1008/srv/adres/test/2
Вывод "example 2"
при url: http://localhost:1008/srv/adres/test/1
Вывод "example 1"

Вопрос: как подвязаться к сервису с помощью extJS? Как правильно написать Ext.Ajax.request?

DreamTheater 06.10.2011 18:35

http://docs.sencha.com/ext-js/4-0/#!...ata.proxy.Rest или Ext.Ajax.request с учетом CRUD

mrshakirov 07.10.2011 15:24

мне нужно из extjs вытянуть данные(хоть что-то) из wcf(c#)

вот вам сервис:
[ServiceContract]
public interface I_HttpAdres
{
[OperationContract]
//[WebGet(UriTemplate = "json/{id}")]
[WebInvoke(Method="GET",
ResponseFormat = WebMessageFormat.Xml,
BodyStyle = WebMessageBodyStyle.Wrapped,
UriTemplate = "test/{id}")]
string XMLData(string id);

[WebInvoke(
Method="GET",
ResponseFormat= WebMessageFormat.Json,
BodyStyle = WebMessageBodyStyle.Wrapped,
UriTemplate = "test2/{id}")]
string JSONData(string id);
}




public string XMLData(string id)
//----------------------------------------------------------------------
{
string s = "";
try
{
s = remoteObject.XMLData(id);
HttpHostBase.CloseProxy(remoteObject);
}
catch (Exception ex)
{
MonitorLog.WriteLog("Ошибка XMLData \n " + ex.Message, MonitorLog.typelog.Error, 2, 100, true);
}
return s;
}
//----------------------------------------------------------------------
public string JSONData(string id)
//----------------------------------------------------------------------
{
string s = "";
try
{
s = remoteObject.JSONData(id);
HttpHostBase.CloseProxy(remoteObject);
}
catch (Exception ex)
{
MonitorLog.WriteLog("Ошибка JSONData \n " + ex.Message, MonitorLog.typelog.Error, 2, 100, true);
}
return s;
}


как правильно написать Ext.Ajax.request???


Часовой пояс GMT +3, время: 10:13.