I am calling webservice which takes two parameters like category and salt then provide the json output with constructed url but url is not working. PFA url
Service Url:
http://qalisting.corelogic.com/ChaseListingServices/v1.5/test
constructed URL: http://qalisting.corelogic.com/ChaseListingServices/v1.5/listings/search/test/0/4e9c00b32794edfeba257aa0c74f500b
Looking at the error message on your constructed URL, the Service needs to be called using a POST and not a GET Request.
Responding to your comments: it's not the URL which is the problem but how it is called. When you follow a link, such as the one you posted - the browser sends it as a GET request. The service is expecting the JSON arguments as part of the "body" of a POST request. This must be done programmatically.
Related
I am testing a controlling algorithm. I am using windows-hosting/plesk and c#.
I am having a problem like this:
My hosting account is called myhosting.com.
My sites in this account,
myhosting.com , files in httpdocs folder
second.com , files in second.com folder
controller.com , files in controller.com folder
Normal running process:
A page on second.com sends an HTTP-POST request to a page on controller.com,
for to get a string.
Before controller.com responds to the POST request, sends an HTTP-GET request
to an another page on second.com, for to get the control string.
The page on controller.com, because the string it receives with GET is correct
it responds positively to the POST request in the first step.
Incorrect operation (performing normal operation from myhosting.com):
A page on myhosting.com sends an HTTP-POST request to a page on controller.com,
for to get a string.
Before controller.com responds to the POST request, sends an HTTP-GET request
to an another page on myhosting.com, for to get the control string.
According to the log records, myhosting.com responded to the GET request
although, the page on controller.com has not yet evaluated the GET's response,
it answers the POST request in the first step with the HTTP 500 error. The error
cannot catch with try/catch.
Where does the error come from? Access permissions? Verb settings? It was working
initially. I deleted the index.aspx from the default doc list in the myhosting.com
and unwittingly did another action, then the error started to occur.
Thanks in advance for the answers.
Solved with Failed Request Tracing. The reply to the post message contains no error details. With this method, error details can be obtained.
I have a URL abc.com/#cancel. In my servlet I need to store #cancel for future use. I have already tried HttpServletRequest getRequestURI() and few other options. But don't see this value in request object. How do I get this value.
In my application I am using GWT which uses rpc calls and rpc request is made based on the hash tag value. eg: mydomain.com/#profile, forwards the request to profile.rpc. In my case I am intercepting this call with a filter which does some basic check and then I want to forward the request again to mydomain.com/#profile. but I am not able to find #profile in request object. Hope this explains my question and what I am looking for.
You cannot get the fragment part of a URL server side, as the browser won't send it to the server.
Eg: User click a link to http://www.example.com/foo#bar. Browser connect to www.example.com and send:
GET /foo HTTP/1.1
Host: www.example.com
Hash(#) is used to separate fragment from Url. Fragment is an optional part of the URL and is used to address a particular part of a resource.
please see below links
http://www.skorks.com/2010/05/what-every-developer-should-know-about-urls/
URL fragment (#) allowed characters
List of valid characters for the fragment identifier in an URL?
request.getRequestURI() will gives you the url eg:abc.com/#cancel.
String url1=request.getRequestURI();
url1.split("/");
Found out that fragmented URL doesn't come in request, when we do response.sedRedirect(), browser doesn't remove the fragmented part from browser URL bar. But not sure how this happens. Anyways in my case instead of posting request to another JSP and then submitting the form to different URL, I am directly doing response.sendRedirect(), which doesn't remove the fragmented part, so its working now :)
I have a api url like below in my mvc4 app
http://localhost:15839/api/mydata/getdata/3365895543/PROBLEMDATA/myotherparam
Now client is consuming the above url to send httprequest. In response api is sending back a response. but in PROBLEMDATA of the url user is sending bad characters that are giving me Bad Request - Invalid URL. I can't force my client source to encode data. i need to handle it in my web api and give back my client a string "Unsucessful". I have seen this webapi cycle wondering at which point I should handle this. probably at http message handler but How?
I may need to follow this. but Register(HttpConfiguration config) also doesn't get hit
I believe you can capture this globally by overriding the application_error method. From there I suppose you could produce the "unsucessful" response or pass the request along to be handled at the controller level.
Take a look at this question as well.
is there a way to get all params that were posted to ASMX in ASP.NET . Request.Form/QueryString/Params - all do not contain keys that were submitted to the page.
Unless your ASMX gets invokes as HTTP POST with content type as "application/x-www-form-urlencoded", you will not get those parameters from HttpRequest object.
This is simply because request body can be of any content type - for example, in script services (ASP.NET AJAX), the request body will have JSON data. If ASMX has been accessed as a SOAP web service then the request body will be an xml (the actual SOAP envelope).
Typically, ASP.NET run-time based on the configuration, attempts to parse the request body and tries to convert it into an method call along with actual method parameters. So the correct way would be to check your method parameters in the method code. A convoluted approach would be to refer request content type and parse (by your self) the request body (HttpRequest.InputStream) accordingly.
I want to encode a URL such that it sends a POST request to a server. is that possible? and if so, how? I have searched around and mostly found that appending parameters to a url only sends them as parameters for GET request. is there a way to do that for POST request?
basically, i am trying to implement a CSRF (not for malicious but testing purposes) and i want to be able to send a POST request to a server by encoding my url.
GET and POST are HTTP methods. In GET the request parameters are taken as query string in the request URL. In POST the request parameters are taken as query string in the request body.
So you need to instruct whatever tool you're using to pass the parameters through the request body instead of the request URL along with a HTTP method of POST instead of (usually the default) GET.
Either way, the parameters just needs to be URL encoded anyway. There's no difference for POST or GET, unless you're setting the content encoding to multipart/form-data instead of (usually the default) application/x-www-form-urlencoded.
If you give more details about what programming language and/or library and/or framework you're using, then we may be able to give a more detailed answer how to invoke a HTTP POST request.
No.
The method is not part of the Url. You'd have to make the request in such a way that it uses the post method.
You didn't mention any details, but if it's from inside a document in the browser, you can either use a form:
<FORM action="someUrl.htm" method="post">
You can make a link that will send the form by javascript:
<form action="http://www.example.com/?param=value" method="post" id="someForm">
link
</form>
or an XmlHttpRequest with javascript:
var xhr = new XMLHttpRequest();
xhr.open("POST", url);
...