I have a problem that no data returns when I read an OData service via ODataModel.
But when I copy the request URL directly to web browser I can get through the odata service and the results are listed. Can you please help on this issue?
This was solved because of some CORS coding in the backend services.
Related
Trying to automate my test cases using jmeter. I have used cxf for rest apis on my web server. I have an api which actually takes a java object as parameter. On jmeter I have selected the POST method under HTTP-request and sending json data in Body data. The api gets called fine. However the parameter comes null and hence by api fails. I did try changing the parameter to String object, however I get this string as null.
Is this the right way to call apis via jmeter. Or is this failing because I have used cxf on my server.
Any help is appreciated.
Thanks
Most likely you need to add a HTTP Header Manager and configure it to send Content-Type header with the value of application/json
See Testing SOAP/REST Web Services Using JMeter for detailed explanation on JMeter configuration for REST API testing.
Other thing you could try out is using SoapUI tool to send the request to your CXF endpoint and if it succeeds - inspect the request and configure JMeter accordingly. By the way, SoapUI has some limited load testing capabilities, may be it will be enough for your scenario
I'm using Restlet v2.1.2 to build a Java based REST service. Everything has been working flawlessly BUT no I've run into problems while trying to PUT/POST to the service using a .Net client, which in turn uses RestSharp to talk to the service. As I mentioned various GET/PU/POST/DELETE request have all worked flawlessly but now when I try to send a "large" request I've run into problems.
I have a URI looking something like: "http://:/matches"
What I'd like to do is to provide two URI parameters {index} and {base64encoded} but as the {base64encoded} may get veeeeeery large, I unfortunately have to rely on PUT/POST in order to use the request.AddBody() method and there provide an object containing those parameters. Furthermore I set request.RequestFormat = DataFormat.Json; but when I execute the request I get either a http 405 or 415 error.
What am I doing wrong here???
I'm so sorry! I had simply overseen the fact that I had forgot to provide the "...foo(JsonRepresentation bar)" parameter declaration for the Get method!!! After adding this parameter it works like a charm:) Thanks for your reply though...:)
Breeze.js - + Facing problem while accessing service metata.
Request for metadata is sent to
http://mylocalmachine:4625/WcfDataService1.svc/Metadata
but metadata is getting published at http://mylocalmachine:4625/WcfDataService1.svc/$Metadata
Your Breeze client must be configured to communicate with your remote service. As I read your question, it appears that you're trying to reach an OData data source whose data service name is "http://mylocalmachine:4625/WcfDataService1.svc".
If so, you'll have to tell Breeze to switch from its default Web Api dataService adapter to the OData dataService adapter. Do that during your application bootstrapping with a line such as:
breeze.config.initializeAdapterInstance("dataService", "OData");
Now, when you run your app and look at the network traffic, you should see that Breeze requests metadata with something like
http://mylocalmachine:4625/WcfDataService1.svc/$Metadata
There is a prerequisite JavaScript library that you will need to include on the page in order to use the OData adapater.
It's mentioned in the documentation:- dataJS.
Hope this helps.
I am building a rest api in mvc. When consuming the API, I need to be able to get the referring URL that is calling the service. I have tried Request.UrlReferer and it comes back null. How can I get the url that is consuming the service?
Are you sure you don't mean in the consumer you need to know the referer of the client making the REST call?
If this is the case what you need to do is look at the request header and extract from it the Referer.
How can we implement like this request:
http://nominatim.openstreetmap.org/reverse?format=xml&lat=52.5487429714954&lon=-1.81602098644987&zoom=18&addressdetails=1
in a windows service.
what we are trying to do is this:
run a request from windows service, and when we get the response back,we will save to DB?
Edit: the service is in C++ native code
Simply use the WebRequest or WebClient classes.
In native code you can use the WinINet library to make HTTP requests. The HttpSendRequest() method in particular.