can i create java servlet as rest web service - web-services

Can I use Java Servlet as a Rest web service?
And how to request using curl to servlet?
thank

Sure you can use a (raw) servlet to create a REST service. But that is too much work knowing that there exists a standard API for this (JAX-RS JSR-311) and many frameworks implementing it :
http://www.jboss.org/resteasy
http://cxf.apache.org/docs/jax-rs.html
http://jersey.java.net/

Related

how to return RESTFUL response from a JAX-WS WebService

I have a JAX-WS WebService running and I want to add a RESTFUL method in it to return HTTP response, without writing a new service.
Is there any way to do it?
Thanks a lot
JAX-WS is an API for SOAP Webservices, with are based on XML transmission of information, not some data over http - the REST way.
What is your services stack? Metro, axis2?
If you use CXF it provides you the possibility to serve both kinds.
Also you may join the two technologies in the same application.

SOAP-based Web Service in Sencha

How should I call a SOAP based web service using Sencha?
I was able to call my service using JavaScriptSoapClient.
If you're using Ext JS, the SOAP proxy is probably what you want.
http://docs.sencha.com/ext-js/4-1/#!/api/Ext.data.soap.Proxy
Check this out on the Sencha Blog:
http://www.sencha.com/blog/taking-a-look-at-the-new-sencha-soap-data-proxy

How to call ucf web service in node.js using SOAP

I'm new to web service.How can i call ucf web service in node.js using SOAP.
Check this, I think it will do what you need:
https://stackoverflow.com/a/8655534/1366519
Google and StackOverflow search boxes are useful if you type 'soap web services with node.js' or something like that.

What is the difference between a Rest WS and Servlet

How do they differ in action? Servlet print html only?
Servlet :
--is a web component
--it's a powerful java technology
--managed by a container (namely web server such as tomcat) that generates dynamic content
--platform independent java classes (byte code)
--interacts with web clients as request response paradigm
--Request handling methods
****doGet,doPost,doDelete,doPut,doOptions,doHead,doTrace****
Rest WS (Representational State Transfer Web Service)
--A way to achieving service oriented architecture in web application
--it's an architectural concept
--web service resource is uniquely identifiable using URLS
--it has explicit relationship with HTTP methods namely GET,POST,PUT,DELETE
--highly re useable across the platform
A Rest WS is a service which you call, which returns data in a REST format.
A Servlet is a bit of UI that shows information to the user.
They are very different, although a Servlet could get the information that it displays from a Rest web service.

how to invoke a web service in asp.net using SOAP

I have written a web service in asp.net 4.0. Now I need to invoke this web service using SOAP
protocol but not HTTP Post protocol. Can any one suggest to me how can I achieve this?
See http://social.msdn.microsoft.com/Forums/en-MY/asmxandxml/thread/5486c18a-a796-4f70-9e56-ccee572abcaf.
You have to use Windows Communication Foundation
See How to Consume a Web Service.