Related
We are adding some metadata under a specific location in JCR:
POST /some/jcr/location/_jcr_content/json HTTP/1.1
Accept: application/json
Authorization: Basic YWRtaW46YWRtaW4=
Cache-Control: no-cache
Host: localhost:4502
Accept-Encoding: gzip, deflate, br
Connection: keep-alive
Content-Type: multipart/form-data; boundary=--------------------------554953211468377919703514
Cookie: cq-authoring-mode=TOUCH
Content-Length: 383
----------------------------554953211468377919703514
Content-Disposition: form-data; name="./value"
{ "test": "test" }
----------------------------554953211468377919703514
Content-Disposition: form-data; name=":cq_csrf_token"
ey***our csrf token***-c5Oa0
----------------------------554953211468377919703514--
But when we fetch this same resource, the response type is test/html`:
GET /some/jcr/location/jcr:content/json/value HTTP/1.1
Accept: application/json
Cache-Control: no-cache
Host: localhost:4502
Accept-Encoding: gzip, deflate, br
Connection: keep-alive
Cookie: cq-authoring-mode=TOUCH
HTTP/1.1 200 OK
Date: Fri, 26 Feb 2021 13:49:38 GMT
X-Content-Type-Options: nosniff
Content-Type: text/plain;charset=utf-8
Content-Length: 18
{ "test": "test" }
What configuration do we need to add in JCR, or what do we need to edit in our request to make sure that JCR returns content type application/json.
UPDATE: As Sharath Madappa replied, you can request the data in JSON format by suffixing the location with the .json extension. However, that results in the following format:
{
"value": "{ \"test\": \"test\" }"
}
While I expect it to be:
{
"test": "test"
}
use GET /some/jcr/location/jcr:content/json/value.json while making the request. Sling is able to render/return the resource in multiple formats based on the extension in the request. By default, if no extension is provided it goes with HTML. The path tells which resource, the extension, and selectors tell how and what renders the resource.
You can also specify the depth you want to go for besides having JSON format response.
E.g
Depth of 1(just the node) in JSON format:
curl -u <user>:<pass> -v <URL>/some/jcr/location/jcr:content/json/value.1.json
All child nodes under a certain path in JSON format:
curl -u <user>:<pass> -v <URL>/some/jcr/location.-1.json
Posting JSON content and then retrieving it as Content-Type: application/json can be done by file upload instead of adding properties.
Here is a javascript example:
const data = { test: "test" };
const jsonData = new Blob([JSON.stringify(data)], { type: 'application/json' });
const formData = new FormData();
formData.append(`myFile.json`, jsonData, `myFile.json`);
return fetch(path, {
method: 'POST',
body: formData
});
This example does not take in account Authn/Authz.
To fetch you data as application/json, you just issue a GET call to the location of the JSON file:
http://localhost:4502/path/to/the/folder/jcr:content/files/myFile.json
I was calling a Rest API locally from terminal. This was like below:
http -v -f --timeout=60 GET 'http://localhost:8080/api/v1/public/users/signin?email=myemail#email.com&password=mypassword'
It is returning following output:
GET /api/v1/public/users/signin?email=myemail#email.com&password=mypassword HTTP/1.1
Accept: */*
Accept-Encoding: gzip, deflate
Content-Type: application/x-www-form-urlencoded; charset=utf-8
Host: localhost:8080
User-Agent: HTTPie/0.8.0
HTTP/1.1 400 Bad Request
Content-Type: application/json
Date: Mon, 28 Mar 2016 16:59:08 GMT
Set-Cookie: rememberMe=deleteMe; Path=/; Max-Age=0; Expires=Sun, 27- Mar-2016 16:59:13 GMT
Transfer-Encoding: chunked
{
"debugMessage": "Submitted credentials for token [org.apache.shiro.authc.UsernamePasswordToken - najmul#qianalysis.com, rememberMe=true] did not match the expected credentials.Submitted credentials for token [org.apache.shiro.authc.UsernamePasswordToken - najmul#qianalysis.com, rememberMe=true] did not match the expected credentials.: The subject was expected to be true, but was false",
"errorCode": "INCORRECT_CREDENTIALS",
"logId": "50a695c1a81e0542",
"stackTrace": "org.niopack.r.....
}
Now I want to read this JSON data using Alamofire. I tried with responseJSON serialiser with following way:
Alamofire.request(method, urlString, parameters: parameters, encoding: .URL, headers: cookieHeader)
.validate()
.responseJSON {
alamofireResponse in
let jsonData = alamofireResponse.result.value
}
But this I am getting jsonData as nil. What you will do if you were are here?
Thanks.
For me removing the validate() allowed me to see the reason the request was failing. For some reason when validate fails, the data of the response is not parsed.
I have JSON objects coming back from ASP.Net oData services which I am reading through JayData oData provider. On one service, JSON object is read into an array without any problems. On another service (from same server), the resulting array contains only etag data for all the elements.
I am not sure if there is a format mismatch or JayData is not decoding the JSON format correctly.
Could someone take a look and see where the problem is located?
Here is the header
GET /GCSData.svc/Customers HTTP/1.1
Referer: http://localhost:56786/HTMLClient/
MaxDataServiceVersion: 2.0
DataServiceVersion: 2.0
Accept: application/atomsvc+xml;q=0.8, application/json;odata=verbose;q=0.5, */*;q=0.1
Accept-Language: en-US
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko
Connection: Keep-Alive
DNT: 1
Host: localhost:56786
HTTP/1.1 200 OK
Cache-Control: no-cache
Content-Length: 2051
Content-Type: application/json;odata=verbose;charset=utf-8
Server: Microsoft-IIS/8.0
X-Content-Type-Options: nosniff
DataServiceVersion: 1.0;
X-AspNet-Version: 4.0.30319
X-SourceFiles: =?UTF-8?B?QzpcVXNlcnNcQ2hpIFJvd1xkb2N1bWVudHNcdmlzdWFsIHN0dWRpbyAyMDEzXFByb2plY3RzXEdDU2xzXEdDU2xzXGJpblxEZWJ1Z1xHQ1NEYXRhLnN2Y1xDdXN0b21lcnM=?=
X-Powered-By: ASP.NET
Date: Mon, 31 Mar 2014 19:35:09 GMT
and here is the JSON data.
{"d":[{"__metadata":{"id":"http://localhost:56786/GCSData.svc/Customers(1)","uri":"http://localhost:56786/GCSData.svc/Customers(1)","etag":"W/\"'John%20%20%20%20%20%20','Doe%20%20%20%20%20%20%20','1234567890'\"","type":"LightSwitchApplication.Customer"},"Orders":{"__deferred":{"uri":"http://localhost:56786/GCSData.svc/Customers(1)/Orders"}},"CustID":1,"FName":"John ","LName":"Doe ","Phone":"1234567890"},{"__metadata":{"id":"http://localhost:56786/GCSData.svc/Customers(2)","uri":"http://localhost:56786/GCSData.svc/Customers(2)","etag":"W/\"'Jane%20%20%20%20%20%20','Smith%20%20%20%20%20','7703211234'\"","type":"LightSwitchApplication.Customer"},"Orders":{"__deferred":{"uri":"http://localhost:56786/GCSData.svc/Customers(2)/Orders"}},"CustID":2,"FName":"Jane ","LName":"Smith ","Phone":"7703211234"},{"__metadata":{"id":"http://localhost:56786/GCSData.svc/Customers(3)","uri":"http://localhost:56786/GCSData.svc/Customers(3)","etag":"W/\"'Dan%20%20%20%20%20%20%20','Handy%20%20%20%20%20','6789876543'\"","type":"LightSwitchApplication.Customer"},"Orders":{"__deferred":{"uri":"http://localhost:56786/GCSData.svc/Customers(3)/Orders"}},"CustID":3,"FName":"Dan ","LName":"Handy ","Phone":"6789876543"},{"__metadata":{"id":"http://localhost:56786/GCSData.svc/Customers(4)","uri":"http://localhost:56786/GCSData.svc/Customers(4)","etag":"W/\"'Mike%20%20%20%20%20%20','Smith%20%20%20%20%20','4041231234'\"","type":"LightSwitchApplication.Customer"},"Orders":{"__deferred":{"uri":"http://localhost:56786/GCSData.svc/Customers(4)/Orders"}},"CustID":4,"FName":"Mike ","LName":"Smith ","Phone":"4041231234"},{"__metadata":{"id":"http://localhost:56786/GCSData.svc/Customers(5)","uri":"http://localhost:56786/GCSData.svc/Customers(5)","etag":"W/\"'Aaron%20%20%20%20%20','Hayes%20%20%20%20%20','2431235678'\"","type":"LightSwitchApplication.Customer"},"Orders":{"__deferred":{"uri":"http://localhost:56786/GCSData.svc/Customers(5)/Orders"}},"CustID":5,"FName":"Aaron ","LName":"Hayes ","Phone":"2431235678"}]}
In the resulting array, for each Customer, all the fields (FName, LName, phone) contain the exact data (which equals to the "etag" field). Here is an example for Customer(1)
{"CustID":1,"FName":"W/\"'John%20%20%20%20%20%20','Doe%20%20%20%20%20%20%20','1234567890'\"","LName":"W/\"'John%20%20%20%20%20%20','Doe%20%20%20%20%20%20%20','1234567890'\"","Phone":"W/\"'John%20%20%20%20%20%20','Doe%20%20%20%20%20%20%20','1234567890'\""}
The JSON data is read through toLiveArray() method.
Make sure you use the [TimeStamp] attribute on server-side to publish your ETag in byte array format:
[Timestamp]
public byte[] token { get; set; }
This topic seems to be one with a million "solutions" with even more mixed results. So please cut me a little slack as I will try to demonstrate what is going on, what I'm using and how I've attempted to solve the issue.
My testing environment is running IIS6 asp.net 2.0, I have set it up with
'Access-Control-Allow-Origin' *
I have also set the verbs for .asmx extensions to
"GET,HEAD,POST,DEBUG,OPTIONS"
via jQuery v1.7.2 ajax() calls I am able to GET xml files from the sever, and POST to a basic service that returns a string with expected results cross domain. So I KNOW at least partially my cross-domain requests are working.
My issue arises when I start to expand on that, and use json to post data to the service
I have a simple asmx webservice method:
[WebMethod]
[ScriptMethod(ResponseFormat = ResponseFormat.Json)]
public SubResponse HelloWorldX(SubRequestXX SubReq)
{
SubResponse sr = new SubResponse();
sr.resultCode = "777";
sr.resultMsg = "hello - " + SubReq.EmailAddress;
return sr;
}
Very simple, and not much magic happening there, all I want to do is pass 'SubRequestXX' object in, and for now simply validate it got there and respond.
Using jQuery:
$.ajax({
type: "POST",
url: "http://somedomain/subscription/MyService.asmx/HelloWorldX",
processData: false,
data: '{ "SubReq" : {"EmailAddress":"user#test.com"} }',
dataType: "json",
contentType: "application/json; charset=utf-8",
cache: false,
success: function(data, textStatus, jqXHR) {
ajaxSucccess3(data, textStatus, jqXHR);
},
error: function(jqXHR, textStatus, errorThrown) {
console.log("Retrieve Hello Failed (AJAX Error): " + jqXHR.statusText + " | " + textStatus + " | " + errorThrown);
}
});
}
Perhaps the answer lies there? but here's what fiddler's RAW data shows me using the exact same JS code from a page on the same domain (success - result code 200):
REQUEST:
POST http://somedomain/subscription/Service.asmx/HelloWorldX HTTP/1.1
Accept: application/json, text/javascript, */*; q=0.01
Content-Type: application/json; charset=utf-8
X-Requested-With: XMLHttpRequest
Referer: http://somedomain/subscription/subscription_-cors.html
Accept-Language: en-us
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0; 9LA)
Host: somedomain
Content-Length: 45
Connection: Keep-Alive
Pragma: no-cache
{ "SubReq" : {"EmailAddress":"user#test.ca"} }
RESPONSE:
HTTP/1.1 200 OK
Date: Fri, 28 Sep 2012 16:59:15 GMT
Server: Microsoft-IIS/6.0
X-Powered-By: ASP.NET
Access-Control-Allow-Origin: *
X-AspNet-Version: 2.0.50727
Cache-Control: private, max-age=0
Content-Type: application/json; charset=utf-8
Content-Length: 147
{"d":{"__type":"SubService.DataObj.SubResponse","resultCode":"777","resultMsg":"hello - rob#test.ca"}}
So Everything looks great and behaves as expected. Now if I take that same html/js code, deploy on another server and make the same request (cross-site) fiddler shows (fails result code 500):
REQUEST:
POST http://somedomain/subscription/Service.asmx/HelloWorldX HTTP/1.1
Accept: */*
Origin: http://www.crossdomainsite.com
Accept-Language: en-US
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0; 9LA)
Host: somedomain
Content-Length: 0
Connection: Keep-Alive
Pragma: no-cache
RESPONSE:
HTTP/1.1 500 Internal Server Error
Date: Fri, 28 Sep 2012 16:58:56 GMT
Server: Microsoft-IIS/6.0
X-Powered-By: ASP.NET
Access-Control-Allow-Origin: *
X-AspNet-Version: 2.0.50727
Cache-Control: private
Content-Type: text/html; charset=utf-8
Content-Length: 4732
.....
Request format is unrecognized for URL unexpectedly ending in '/HelloWorldX'
.....
[InvalidOperationException: Request format is unrecognized for URL unexpectedly ending in '/HelloWorldX'.]
System.Web.Services.Protocols.WebServiceHandlerFactory.CoreGetHandler(Type type, HttpContext context, HttpRequest request, HttpResponse response) +405961
System.Web.Services.Protocols.WebServiceHandlerFactory.GetHandler(HttpContext context, String verb, String url, String filePath) +212
System.Web.Script.Services.ScriptHandlerFactory.GetHandler(HttpContext context, String requestType, String url, String pathTranslated) +47
System.Web.HttpApplication.MapHttpHandler(HttpContext context, String requestType, VirtualPath path, String pathTranslated, Boolean useAppConfig) +193
System.Web.MapHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +93
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +155
Many search results suggest a couple of web.config changes. if I add the following to my system.web section:
<webServices>
<protocols>
<add name="HttpGet"/>
<add name="HttpPost"/>
</protocols>
</webServices>
then my request looks like
POST http://somedomain/subscription/Service.asmx/HelloWorldX HTTP/1.1
Accept: */*
Origin: http://www.crossdomainsite.ca
Accept-Language: en-US
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0; 9LA)
Host: somedomain
Content-Length: 0
Connection: Keep-Alive
Pragma: no-cache
And my RESPONSE:
HTTP/1.1 500 Internal Server Error
Date: Fri, 28 Sep 2012 17:37:00 GMT
Server: Microsoft-IIS/6.0
X-Powered-By: ASP.NET
Access-Control-Allow-Origin: *
X-AspNet-Version: 2.0.50727
Cache-Control: private
Content-Type: text/plain; charset=utf-8
Content-Length: 461
System.InvalidOperationException: HelloWorldX Web Service method name is not valid.
at System.Web.Services.Protocols.HttpServerProtocol.Initialize()
at System.Web.Services.Protocols.ServerProtocol.SetContext(Type type, HttpContext context, HttpRequest request, HttpResponse response)
at System.Web.Services.Protocols.ServerProtocolFactory.Create(Type type, HttpContext context, HttpRequest request, HttpResponse response, Boolean& abortProcessing)
So adding that section to my web.config did something since my results are slightly different. But I am unable to discern what.
Other solutions suggest these web config settings since I am using asp.net 2.0, note I have left these as shown during all the above results, commented out ones are originals from project creation:
<httpHandlers>
<remove verb="*" path="*.asmx"/>
<!--<add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>-->
<add path="*.asmx" verb="*" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
<!--<add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>-->
<add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<!--<add verb="GET,HEAD" path="ScriptResource.axd" validate="false" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>-->
<add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" validate="false"/>
</httpHandlers>
So... the big Question... Why are my cross-site requests failing with the same code, despite all the above? Seems like as soon as the request comes from another domain it chokes on JSON.
Any help would be greatly appreciated solving this mystery. I assume its either a IIS6 (server) setting or my $.ajax() call and I feel like its probably something simple or small, but I can't seem to put my finger on it.
I tried something simillar via JSONP. I think I based the solution off this article.
JSONP + CORS
Another potential thing is that putting in your JSON as a string to a WCF service typically does not end well (I know this is not WCF, just saying it could be the same issue). I usually do this:
Using jQuery:
$.ajax({
type: "POST",
url: "http://somedomain/subscription/MyService.asmx/HelloWorldX",
processData: false,
data: JSON.parse('{ "SubReq" : {"EmailAddress":"user#test.com"} }'),
dataType: "json",
contentType: "application/json; charset=utf-8",
cache: false,
success: function(data, textStatus, jqXHR) {
ajaxSucccess3(data, textStatus, jqXHR);
},
error: function(jqXHR, textStatus, errorThrown) {
console.log("Retrieve Hello Failed (AJAX Error): " + jqXHR.statusText + " | " + textStatus + " | " + errorThrown);
}
});
}
The use of JSON.parse will also catch any bad JSON that goes through.
Hope this will fix your issue.
Symptom:
When I make a web service request (from JQuery using .ajax, to ASP.NET .asmx file), if it is made using GET instead of POST, the .asmx file always returns XML instead of JSON. If I flip the call back to posts, it responds just fine as JSON.
Goal:
How can I get JSON instead of XML, using HTTP GET?
I've a fair bit of googling already and it isn't the usual suspects like missing ScriptService or not registering handler in web.config. It's behaving like the script handler factory is only working on posts? Please help point me in the right direction here!
Server code:
namespace mynamespace
{
/// <summary>
/// Summary description for ServiceAddresses
/// </summary>
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[ToolboxItem(false)]
[System.Web.Script.Services.ScriptService]
public class MyService : System.Web.Services.WebService
{
[WebMethod]
[ScriptMethod(ResponseFormat = ResponseFormat.Json, UseHttpGet = true)]
public string HelloWorld()
{
return "Hello World at " + DateTime.Now.ToLongTimeString();
}
}
}
Client code:
function testhelloworld(postorget) {
var webMethod = '/servicedir/MyService.asmx/HelloWorld';
$.ajax({
type: ('GET'===postorget)?'GET':'POST',
url: webMethod,
contentType: 'application/json; charset=utf-8',
dataType: 'json',
data: "{}",
success: function(msg) {
$('#info').text(msg.d);
},
error: function(xhr, ajaxOptions, thrownError) {
$('#info').text('Error: ' + xhr.responseText);
}
});
}
Works fine if I switch service to UseHttpGet = false and client requests as POST. Sends back XML if I use GET.
Fiddler says request is:
GET http://myserver/servicedir/MyService.asmx/HelloWorld?{} HTTP/1.1
Host: myserver
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.9) Gecko/20100824 Firefox/3.6.9 ( .NET CLR 3.5.30729)
Accept: application/json, text/javascript, */*
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 115
Connection: keep-alive
X-Requested-With: XMLHttpRequest
Referer: http://myserver/test/index.aspx
Response:
HTTP/1.1 200 OK
Server: Microsoft-IIS/5.1
Date: Thu, 14 Oct 2010 00:31:44 GMT
X-Powered-By: ASP.NET
X-AspNet-Version: 2.0.50727
Cache-Control: private, max-age=0
Content-Type: text/xml; charset=utf-8
Content-Length: 115
<?xml version="1.0" encoding="utf-8"?>
<string xmlns="http://tempuri.org/">Hello World at 8:31:44 PM</string>
Relevant parts of web.config:
<webServices>
<protocols>
<add name="HttpGet"></add>
<add name="HttpPost"></add>
</protocols>
</webServices>
. . .
<remove verb="*" path="*.asmx"/>
<add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
. . .
<remove name="ScriptHandlerFactory"/>
<remove name="ScriptHandlerFactoryAppServices"/>
<add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
Same exact thing but recompiling with UseHttpGet = false and requesting via POST works.
Fiddler says POST request is:
POST http://myserver/servicedir/MyService.asmx/HelloWorld HTTP/1.1
Host: myserver
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.9) Gecko/20100824 Firefox/3.6.9 ( .NET CLR 3.5.30729)
Accept: application/json, text/javascript, */*
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 115
Connection: keep-alive
Content-Type: application/json; charset=utf-8
X-Requested-With: XMLHttpRequest
Referer: http://myserver/test/index.aspx
Content-Length: 2
Pragma: no-cache
Cache-Control: no-cache
{}
Response:
HTTP/1.1 200 OK
Server: Microsoft-IIS/5.1
Date: Thu, 14 Oct 2010 00:37:03 GMT
X-Powered-By: ASP.NET
X-AspNet-Version: 2.0.50727
Cache-Control: private, max-age=0
Content-Type: application/json; charset=utf-8
Content-Length: 33
{"d":"Hello World at 8:37:03 PM"}
Pre-emptively answering the non-answers:
I want to use GET because I would like clients to be able to cache.
I am aware that there are security concerns with get e.g. posted on scott gu's blog.
I know I could not use ASP.NET's script stuff and just do it myself, or try out Jayrock. But, I would like to understand why the stock ASP.NET ScriptHandler isn't working.
Not sure about asmx web services, but we use WCF and it works with these attributes on the method
[WebGet(RequestFormat = WebMessageFormat.Json,
ResponseFormat = WebMessageFormat.Json]