Can not receive proper parameters in my WCF service (jQuery, ajax) - ajax

I have a method on my client side. And I pass "{'id':'1'}" as data and I got a small problem with double quotes "{"id":"1"}"):
But on server I got zero:
What am I doing wrong?
and attributes for WCF method:

Why did you add doublequotes to parameters? They must be send as json. In your exaple you send a string without key! Parameters must be set as
parameters = {id: 1}
Then server correctly receives data.

Related

Oracle ORDS 19.2: URI Template with multiple bind variables?

-currently testing through Postman-
want a guide for this as:
i do not want to expose the parameters and their values in URL.
when using URI Template like myuri/:bindvar (single bind variable) then i can send parameters in Body.
but when creating Handler's parameters ( multiple ) i can get successful message and update sending those through Parameter tab but i can't access successfully sending those parameters through Body, parameter values are null.
the sample from oracle have 3 Templates contain bind variables in URI but all are have single bind variable.
You only need to supply the values you want to return as response
Otherwise, there's nothing special about coding a PUT handler in ORDS compared to a GET or POST - You just need to build up your PLSQL block to do the work, in this case an UPDATE, and then build out the response you want to send back to your REST API consumer.
Full example and code here

In fine-uploader is there a callback for the json resturned by the server?

By default fine-uploader marks an upload as a success when it recieves the following json file.
{ "success": "true" }
Does fine-uploader support passing extra data back to the client and doing something with it?
All data passed from your server can be accessed on the 3rd parameter passed to your onComplete event handler, which is a JavaScript object. Note that the `XMLHttpRequest instance used to send the request is also available as the 4th param.

Send Form data and Query string in one POST request in Jmeter

I need to send POST request through jmeter. I have checked the requests workflow through browser dev. tools. In my Post request I need to send form data and one string Query. Question is next - if i will add my string Query to URL will it work fine?
Example : somesite.com/something?refURL=someRef
If it is a POST request, usually any form data will be sent in the request body. Not like a query string in the GET request. But the format is same.
refURL=someRef add this in the parameters section.
Check here for more info.
https://www.w3.org/TR/html401/interact/forms.html#h-17.13
Why not? Query string and request body are different beasts and they are processed differently on server side.
Instead of asking this kind of questions, why don't you just record your test using JMeter's proxy server?
References:
URI Syntax - Query Component
HTTP Method Definitions - POST
Yes it will.
You can even use variables like:
/some/path?refURL=${someCalculatedRefUrl}

Should a JSON-P callback function accept a string?

I'm calling a REST API somebody else created. It supports JSONP to facilitate cross domain access.
The response I get back from the service looks like:
mycallback('{"token": "123456789"}');
Notice the single quotes wrapping the JSON data; Passing it as a string rather than a raw object. JQuery can handle this, but other libraries seem to expect a raw object instead.
mycallback({"token": "123456789"});
The raw object parameter makes more sense to me since it avoids the need to parse the JSON data, but I want to know for sure before asking the maintainer of the API to make the adjustment:
Which is most correct?
Passing a javascript literal (second) as shown here is more correct as it avoids deserializing the string back to a javascript object.
Passing a string is obviously a bad thing - you have two choices (#1 is preferred):
Ask the developer of the JSONP service to send proper JSONp instead of a string
Make your callback function smart so it uses something like payload = JSON.parse(payload); in case payload is a string.

Flex 4 - Sending string (such as JSON) using HTTPService

When I use HTTPService.send(paramter) as a POST request, the web server does not appear to see variable "parameter" if it is a string. The server sees the parameter if it's an Object, but I'm looking to use something like httpservice.send(JSON.encode(object)); Is this possible?
Why not use the actual request objects.
in your service define request objects and post them or send them as get if you please.
Sample code here: http://pastebin.com/ft7QW2vg
Then just call .send on the service.
on the server you can simlpy process if with request.form (Asp)
Failing which why not append it to the url with a binding expression. (you would need to encode it since you would be more or less faking a url or a get behaviour).

Resources