JSONP web service client - rest

Can anybody give me an example/link to build a JSONP web service client? I am trying to create a client to access a third party API to get some data which is working fine making a JSONP ajax call on the front end. I would like to move it to a servlet on the backend. Any help would be appreciated.
Thanks

Related

How to make get request from ktor to 3rd party?

I need to make get requests from my Ktor server to another 3rd party rest api,
and from my app i will make request to my Ktor server.
How can i do that?
You need the ktor client for that.
The ktor client allows you to make requests and handle responses.
For more information and for an example you can look at ktor's documetation.

Should I be using REST or SOAP UI for testing?

I am testing a new webservice that is receiving messages from an application and responding with messages with specific information. The webservice then uses this information to create new messages for downstream systems. I need to know the best way I can test this using the Ready API tool, we just got a pro license. Is it SOAP or REST I need to use. Ideally I want to simply copy my application messages in to the tool, call the webservice and get the response, which I can then check is the correct response for the test
To find your web-service is SOAP or REST.
Please check whether your web service has WSDL to verify it has SOAP web-service, you can get your web-service's WSDL by post-fixing WSDL with your web service url.
Eg: http://{yourservice-url/path1}?WSDL
If your service don't provide WSDL from the above URL, then your web-service is REST.

Integrating back end to front end

Our organization has a data collection on their servers. A soap API has been implemented and the data can be accessed using the WSDL on SOAP UI. I am a front-end developer and when I make a POST request using XMLHttpRequest to get the query result, it throws CORS error: "Response to the preflight request doesn't pass access control". It is NOT possible to enable CORS on the data collection servers. I am using Liferay for the website front end and the back end.
Any suggestions how I can get the query results from the front end without enabling CORS on database servers(this is different than the Liferay backend server)? Or I can use a website backend to interact with the database? Or use third-party services like Kinvey?
I have had similar issues in the past. Like you, I wanted to create a basic webpage on my machine and that contained some Javascript to call an API. With this approach, I got the CORS issue you are seeing.
I then hosted my page on a web-server and I still got the CORS issue.
To resolve, I had to create a web app, which I wrote in Java. This back-end contained its own API. One of the resources in 'my' API was a simple wrapper to call the API of interest. I then modified the webpage I wrote (now all hosted in the same web app), to call my API, which in turn calls the API of interest.

soap header between c#.net client and php server

i have a web service written in php, i added it as web reference to my asp.net web site (asp,c#)
i knew how to call web service's method from c#.net client,
but the problem i still have: i want to send a soap header with web service call (from c#.net client to php server)
i did this but in php client, by using $client->setHeaders, and parsed the sending header in $server,
but how to do it in c#.net client,
note: i don't have a header class in server.php , ant it works fine with php
please help
Use WCF custom headers to fill in extra information to pass along to php.
http://cisforcoder.wordpress.com/2010/12/01/how-to-implement-basic-http-authentication-in-wcf-on-windows-phone-7/
This example in the link passes along the header for Authorization
If you make a web reference to the php service, then I can point to the person who already asked it before here on the forum.
Adding SOAP headers to ASMX service requests
If you are using nuSoap, you can go the library, you'll find the code where packet response is been generated. There you can add your own attributes and headers as per your requirement.

What is the benefit of RESTful Web Service Vs Using Just a simple Servlet?

Regardless of whether I create a RESTful Web service to be consumed by Ajax in my own pages, or by any user, I can provide the same functionality (data) to the application or user using a simple servlet.
I mean the user or application don't see any different between response provided by a simple servlet or respone provided by a RESTful web service. So, I'm guessing that the benefit is on the server side and to the developers. Can someone please tell me what are the benefits of using RESTful web services.
I appreciate any respone
By definition a webservice is intended to be consumed by any client granted access. If the client you are developing is the only application that you will ever need or want to access the resource then there is little benefit to creating a webservice. However, if you want to make the resource available as a service endpoint for more than just this application in a way that is implementation agnostic then a Restful webservice is a great way of doing it.