response getting from server is html response. How can i know whether the reponse is correct? how can i check that in server?
These api urls corresponds to a REST web service and thats why when you call those urls, you are getting data. So you need to create your own REST service api for your site to fetch data first.
For creating dot net based REST Service, Use this link. For creating Java based REST service, follow this link.
Related
How can we know the name of the page or service or state of page which has called RESTful API in java file. Something like $state.current.name in AngularJS.
I have created api's in java using #RequestMapping(). In this java file I want to know about the name of page that has called this API. As I want to call same api on different pages and want to log different strings according to the page which has requested the API. I am using $http.get(api) in AngularJS to call API.
We found the most reliable way to achieve knowledge of the current URL/state is to send it as part of the request payload. This gets around issues of HTTP referer header stripping. You already have $state.current.name, so adding this to your API-calling JS service function should be straightforward.
If you need to add this to every request, one option is to use an interceptor to add the metadata into every HTTP request which contains JSON.
How can I write a web service where I can query in the URL with some parameters and display the result in the JSON format.
For example, There is a table AppInfo in my database which has two columns named AppID and Status
Now, what I want is to write a web service like that
http://10.11.201.84?q=Select+*+from+AppInfo+where+AppID='21212'&format=json
So, from a user, I will take the application id and get the status using this web service. I might have to use get method for using the HTTP URL request.
Which web service I have to use in this case and how?
I implemented the necessary http url based web service by this, I have used restful web service implementation
1) Create a Java Web Project and create a servlet
2) Connect with my Oracle database (using ojdbc 6.0)
3) Taking the query as a parameter in the url (as requirement) and then process the query (I used preparedStatement)
4) Getting the result of the query and Save it to json
5) Display the successive Json data in the browser and then parse the data json data to send back the response to user.
Thanks to all who guided me !!
I think you're looking for REST web service instead of SOAP web service.
You should take a look to this documentation : Building a RESTful Web Service
It's pretty simple (assuming you're having curent NB version)
Create a new project Java Web -> Web Application
In the project: New -> Web Service -> RESTful service
you have multiple options.. you have an empty one, from database, etc..
I am developing banking mobile apps using html5 for client as communicate back-end system they provided soap based xml services.
To make a soap request, i doesn't want to write code in ".js" file because of code complexity and not found request and response logs in production phases.
now i want to make separate project to maintain the web-service request and response business logic using java?
from .js, I want to make a http request to call the web service as a response i want to get json an object?.
Please correct me if i was wrong, Please help me how to separate web service logic into a single project?
Note: I doesn't want to configure my soap request through js file.
Regards,
nag
Write a servlet or httphandler(if IIS) that interacts with SOAP services and parses the information and creates a json response for the JS client.
You JS client interacts with servlet/httphandler and handles when it json response when it receives it.
I have a scenario where I am supposed to contact a RESTFul API which sends me a response in JSON. After I get the response I am suppose to store the data in the DB.
We use BPEL for our development. But, for clean development/deployment I am using Java for contacting the RESTFul API so that I don't have to handle any Java codes in my BPEL. So I wanted to create a web service proxy.
I have created a class which contacts this endpoint and gets me the response (JSON) and converts the response message(JSON) into XML.
Now, I want to create a Web Proxy service which I can host for this Java program that I have created. Is there any way that I can do this?
Thanks!
I got a solution to this. I created an intermediate webservice using java (using json.org library) for consuming the REST API and then giving my BPEL the SOAP response after parsing the JSON response.
My application neeeds to access a third part web service.
Of late, they have introduced a load balancer, which redirects to the server.
Because of this the webservice gets a 302 - Redirect error as response.
In the SOAPUI, I was able to enable a property called "Follow Redirect", and because of this service followed the redirect and served by the server.
Now is there a similar propety that can be turned on in the code, which would make the webservice follow the request?
(The calling code is java and the webservice is in .net)
This needs to be supported by the library implementing the actual call to the web service, and there is not a generic way of setting this.