Difference between message-oriented and RPC oriented web services - java

JAX-WS allows developers to write message-oriented as well as Remote Procedure Call-oriented (RPC-oriented) web services
I am new to JAX-WS. I want to know what is the difference between message-oriented and remote procedure call-oriented web service.

In RPC based the methods in a Web service are called through a RPC, i.e. in a synchronous way through a specific port and protocol.
But message-oriented is Message based Web Services the methods are called through an HTTP request using SOAP.
Read this excellent article.

Related

How do I expose the service written in Java for all platforms?

I have an "AutoComplete" server written in java. Its a http(s) server which accepts protobuf . Currently I have a written a thick desktop client which uses this service to populate its textbox with autosuggestions. I intend to make this service generic, so that it can be used by other platforms. How do i go about it ? If i release proto definitions it will probably tie it up to 3-4 languages only. If I release a client jar , it will restrict it to Java. Any suggestion from API/system designers is much appreciated.
You can expose it as a Webservice.
From the Wikipedia page:
A Web service is a method of communication between two electronic devices over a network. It is a software function provided at a network address over the Web with the service always on as in the concept of utility computing. The W3C defines a Web service generally as
a software system designed to support interoperable machine-to-machine interaction over a network.
There are two types of Webservices:
1- SOAP Webservices.
2- REST Webservices.
All programming languages provide methods for Creating and Consuming Websevices.
This Stackoverflow thread provides good explanation of Webservices.
A web service is a collection of open protocols and standards used for exchanging data between applications or systems. Software applications written in various programming languages and running on various platforms can use web services to exchange data over computer networks like the Internet in a manner similar to inter-process communication on a single computer. This interoperability (e.g., between Java and Python, or Windows and Linux applications) is due to the use of open standards.(Reference)
REST stands for Representational State Transfer, which is an architectural style for networked hypermedia applications, it is primarily used to build Web services that are lightweight, maintainable, and scalable. A service based on REST is called a RESTful service. REST is not dependent on any protocol, but almost every RESTful service uses HTTP as its underlying protocol.
For complete tutorial have a look at RESTful Web Services
For SOAP based services have a look at SOAP webservice

Is it using RMI for invoking the web service

I am new to web services and studing Jax-WS web services these days. I created a little web service and host it in tomcat server and created a java web service client for accessing the service as well. But I am having a little confusion in the web service client, because in the client we generate a stub for accessing the service.
Here is it using RMI for invoking the web service???
According to my knowledge tomcat is a web container and it is not supporting for RMI.
I searched this through the internet and I was unable to find the clear answer. Can anybody please simply explain me how does it happen.
If the tomcat is not supporting to RMI how does it invoke the web service. I have this confusion since it uses the stub that we generated using wsimport command.
thanks a lot
Here is it using RMI for invoking the web service???
Http. The web service client would create a http request (just like how a browser does when you request a url), convert your request object to an xml payload and invoke your service end point. Different vendors of JAX-WS may use different implementations, but it is usually some form of HttpURLConnection
HttpClient is a popular package to create Http connections from a java program.

Exposing CORBA Services as Web Services with Apache CXF?

With Axis2 you can expose a CORBA Service as Web Service as described in the docs:
http://axis.apache.org/axis2/java/core/docs/corba-deployer.html
Is this possible with CXF, too? There are Corba samples, but as I understand, they are a Web Service clients that internally go to a Corba Server, which is never exposed as Web Service, is it?
http://svn.apache.org/repos/asf/cxf/trunk/distribution/src/main/release/samples/corba/

Web Services Interoperability

I have few fundamental questions
Question#1
With WCF you can expose a service as HTTP/TCP/MSMQ binding
Similar to this do we have any equivalent solution in Java platform for exposing service with different bindings
Question #2
i have worked on .NET 2.0 ASMX service and consumed the same using .NET client
What are interoperability aspects that we need to consider if I need to consume this service with Java client
Question #1:
WCF can expose service on multiple transports but only HTTP(S) is interoperable
Java APIs also can expose SOAP service over different transport. For example SOAP services can be exposed over JMS. JAX-WS has extensibility points to provide custom transports. It is all about APIs because SOAP is independent on the transport (in contrast to REST which works only over HTTP).
Question #2:
ASMX services can conform to WS-I Basic Profile 1.1 which is considered as interoperability minimum. I guess all Java SOAP APIs can consume these services.

JAX-WS servlet filter exceptions

I have a client/server application that communicates via SOAP. The server-side application is a Java EE app that exposes web services using JAX-WS. I have a servlet filter setup to perform certain checks before a service is invoked.
This is all working pretty well, except for exception handling. If I throw an exception from the filter, it gets returned to the client as a generic server exception. I need to find a way to propagate a custom exception containing a specific message, so the client can display the message to the user.
Any insight?
A servlet filter isn't really the right tool if you want to send the exception in a SOAP response and I would consider using a JAX-WS handler for the verification of incoming messages instead (JAX-WS handlers are somehow to JAX-WS services what Filters are to Servlets).
Frmo Working with Headers in JAX-WS SOAPHandlers:
JAX-WS Handlers
In addition to support for web
services development, the JAX-WS
framework (the latest Java programming
language API for creating SOAP-based
web services and web service
consumers) also provides a handler
framework. Handlers provide a means
to inspect and manipulate incoming or
outgoing SOAP messages (on both the
client as well as server side). They
act as powerful message interceptors
that can perform an array of functions
such as message transformation,
content filtering, tracking, etc. In
fact, handlers are often used in
runtime environments to implement web
service and SOAP specifications such
as WS-Security, WS-ReliableMessaging,
etc. JAX-WS handlers are similar to
EJB interceptors or servlet filters.
Handlers, like interceptors and
filters, encourage developers to
follow the chain of responsibility
pattern.
Resources
Writing a Handler in JAX-WS (start here)
Handler example using JAXWS 2.0
References
Java API for XML-Based Web Services (JAX-WS) 2.0 specification
APIs
javax.xml.ws.handler.Handler
javax.xml.ws.handler.LogicalHandler
javax.xml.ws.handler.soap.SOAPHandler

Categories

Resources