Web Services Interoperability - java

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.

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

Difference between message-oriented and RPC oriented web services

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.

what actually JAX-WS is?

I need to work on webservice project. So going through book to cover the basics of webservice project. But these are questions I am struggling with:-
1.Java API for XML Web Services(JAX-WS):- JAX-WS is nothing but just a java programming language API for creating web services which is now a part of core java starting from version 6 (though originally developed as part of Java Web Services Development Pack). Is it right?
2.All other webservices framework whether it is metro, jersey, glassfish uses the JAX-WS internally. Is it correct?
Q: 1.Java API for XML Web Services(JAX-WS):- JAX-WS is nothing but just a java programming language API for creating web services which is now a
part of core java starting from version 6 (though originally developed
as part of Java Web Services Development Pack). Is it right?
It is correct, JAX-WS is an application programming interfaces (API). That API, together with the JAX-WS reference implementation (JAX-WS RI, RI = reference implementation) is a part of JDK since version 6. To extend a little bit, JAX-WS 2.0 is included in JDK 6 from the beginning, JAX-WS 2.1 comes with JDK 6u4, and you will find JAX-WS 2.2 in JDK 7 (see this link).
Q: 2.All other webservices framework whether it is metro, jersey, glassfish uses the JAX-WS internally. Is it correct?
Strictly speaking, Metro doesn't "use" JAX-WS, but includes already mentioned JAX-WS reference implementation. Jersey included JAX-RS implementation, and Glassfish is not a Web-service framework, but an application server. Glassfish comes with the complete Metro distribution.
JAX-WS is a Web Services framework that provides tools and infrastructure to develop Web Services solutions for the end users and middleware developersJAX-WS stands for Java API for XML Web Services. JAX-WS is a technology for building web services and clients that communicate using XML. JAX-WS allows developers to write message-oriented as well as RPC-oriented web services.
In JAX-WS, a web service operation invocation is represented by an XML-based protocol such as SOAP. The SOAP specification defines the envelope structure, encoding rules, and conventions for representing web service invocations and responses. These calls and responses are transmitted as SOAP messages (XML files) over HTTP.
There is another type of web-service, which is called RESTful.RESTful web services are built to work best on the Web. Representational State Transfer (REST) is an architectural style that specifies constraints, such as the uniform interface, that if applied to a web service induce desirable properties, such as performance, scalability, and modifiability, that enable services to work best on the Web. In the REST architectural style, data and functionality are considered resources and are accessed using Uniform Resource Identifiers (URIs), typically links on the Web. The resources are acted upon by using a set of simple, well-defined operations. The REST architectural style constrains an architecture to a client/server architecture and is designed to use a stateless communication protocol, typically HTTP. In the REST architecture style, clients and servers exchange representations of resources by using a standardized interface and protocol.
Genrally JAX-RS is used for developing RESTful web services. JAX-RS is a Java programming language API designed to make it easy to develop applications that use the REST architecture. The JAX-RS API uses Java programming language annotations to simplify the development of RESTful web services. Developers decorate Java programming language class files with JAX-RS annotations to define resources and the actions that can be performed on those resources. JAX-RS annotations are runtime annotations; therefore, runtime reflection will generate the helper classes and artifacts for the resource. A Java EE application archive containing JAX-RS resource classes will have the resources configured, the helper classes and artifacts generated, and the resource exposed to clients by deploying the archive to a Java EE server.
Different frameworks uses either JAX-WS or JAX-RS. Jersey uses JAX-RS and Metro uses JAXWS.

WCF and Java interoperability

What is supported out of the box with a Java Client talking to WCF service version 4.0.
What protocols, bindings and security features are not supported (limitations if any).
It all depends on the capabilities of the Java SOAP toolkit you are using (Metro, etc). As long as the Java side support SOAP you should be able to use BasicHttpBinding no problem - you will be able to use Transport security and maybe TransportWithMessageCredential
If the Java toolkit supports WS-Security then you should be able to use WSHTTPBinding with message security.
There are not many toolkits that support WS-ReliableMessaging and WS-AtomicTransaction so you are unlikely to be able to use these
WCF can be used to expose a RESTful service and all Java needs then is the ability to use HTTP and XML/Json. For this you would use webHttpBinding
WCF is a .NET framework for providing standards-compliant web services. If your WCF service is exposed over Http as SOAP or REST then, as far as your Java code is concerned, it's just a regular web service.

Feedback/Patterns on creating a protocol adaptor

I have a backend system that currently returns a domain object. I want to build a REST & SOAP front end using mule. To create responses that are REST or SOAP based, and ensure that the backend is protocol agnostic, I am thinking about creating two protocol adapters (REST and SOAP). It is unclear to me if it is better to create a mule translator for the service, which understands the protocol and delegates to generate an appropriate response, or just create two class interfaces (using JAX-RS/JAX-WS annotations) to the service.
I'm not finding much literature, best practices, or design patterns on the subject. Can someone point me to some useful material or provide their opinions?
Writing transformers for message formatting would be a waste of time.
You should write service classes with JAX-RS/JAX-WS annotations, transports exist for both.
For a REST service you can use the Jersey transport:
http://www.mulesoft.org/documentation/display/JERSEY/User's+Guide
For SOAP service you can use the CXF transport (also supports JAX-RS):
http://www.mulesoft.org/documentation/display/CXF/Building+a+web+service
Note: You don't need mule for this at all, both Jersey and CXF run in a servlet container like tomcat.

Categories

Resources