Wednesday, September 22, 2010

JAX-RPC vs JAX-WS

Comparison between JAX-RPC and JAX-WS



FunctionlityJAX-RPCJAX-WS
SOAP 1.2JAX-RPC and JAX-WS support SOAP 1.1JAX-WS also supports SOAP 1.2.
HTTP BindingJAX-RPC ignored the HTTP binding. The WSDL 1.1 specification defined an HTTP binding, which is a means by which you can send XML messages over HTTP without SOAP. JAX-WS adds support for it.
WS-I's Basic ProfilesJAX-RPC supports WS-I's Basic Profile (BP) version 1.0.JAX-WS supports BP 1.1. (WS-I is the web services interoperability organization.)
New Java featuresJAX-RPC maps to Java 1.4.JAX-WS maps to Java 5.0. JAX-WS relies on many of the features new in Java 5.0.
Annotation SupportsJAX-RPC does not support annotation.JAX-WS features a collection of annotations to be used to define Web Service endpoints and Web Service clients.This simplifies development a lot, since the developer adds annotations to the implementation classes instead of writing a lot of descriptors.
The data mapping modelJAX-RPC has its own data mapping model, which covers about 90% of all schema types. Those that it does not cover are mapped to javax.xml.soap.SOAPElement.JAX-WS's data mapping model is JAXB. JAXB promises mappings for all XML schemas
The interface mapping modelJAX-WS's basic interface mapping model is not extensively different from JAX-RPC'sJAX-WS's model introduces asynchronous functionality.
The dynamic programming modelJAX-RPC does not have dynamic server model.It introduces message-oriented and dynamic asynchronous functionalities. JAX-WS also adds a dynamic server model
MTOM (Message Transmission Optimization Mechanism)JAX-RPC does not support MTOMJAX-WS, via JAXB, adds support for MTOM. MTOM can send and receive binary data optimally without incurring the cost of data encoding to ensure the data is included in the XML document.
The handler modelJAX-RPC handlers rely on SAAJ 1.2.JAX-WS handlers rely on the new SAAJ 1.3 specification.

Tuesday, September 21, 2010

SOAP vs REST

Comparison between SOAP and REST

FunctionlityRESTSOAP
API Flexibility & SimplicityREST methodology is to write Web services using an interface that is already well known and widely used: the URI.SOAP, on the other hand, requires specific knowledge of a new XML specification, and most developers will need a SOAP toolkit to form requests and parse the results.
Bandwidth UsageIn RESTful interface requests and responses can be short.SOAP requires an XML wrapper around every request and response.
SecurityREST calls also go over HTTP or HTTPS, but with REST the administrator (or firewall) can discern the intent of each message by analyzing the HTTP command used in the request.

No Security related API available, only security related stuff is handling the data over https.
A typical SOAP request, on the other hand, will use POST to communicate with a given service.

Has WS-Security api to extend security and encrypt the flow of data to and from the webservice.
Data TransferData that needs to be secure should never be sent as parameters in URIs. And large amounts of data, like that in detailed purchase orders (POs), can quickly become cumbersome or even out of bounds within a URI.SOAP can transport your all text and BINaries without a glitch.
Type HandlingIncase of HTTP based APIs the return value needs to be de-serialized from XML, and then type-casted. SOAP provides relatively stronger typing since it has a fixed set of supported data types. It therefore guarantees that a return value will be available directly in the corresponding native type in a particular platform.
CachingSince HTTP based / Rest-ful APIs can be consumed using simple GET requests, intermediate proxy servers / reverse-proxies can cache their response very easily.On the other hand, SOAP requests use POST and require a complex XML request to be created which makes response-caching difficult.
TransactionsRest doesn't support trasaction.SOAP and WS-* supports transaction.
MetadataThere is no direct way in REST to generating client from server-side-generated metadata. In SOAP with WSDL we can generate the client proxies.
effort and understanding while HTTP based or REST based APIs require greater implementation effort on the server side.it requires greater implementation effort and understanding on the client side
Handle RequestUses the existing Get and Post to handle client requests.Uses standard WSDL to handle client requests.
Protocol UsedREST works on HTTP/SSL only.SOAP/WSDL is the gateway technology to enable interoperability, works both over HTTP and other protocols.
Communication TypeREST communication style is synchronous.SOAP communication style is, synchronous and asynchronous, bulk transfer and reliable message delivery.
Schema supportChallenging to identify and locate resources.Predefined xml schema definition.
Javascript SupportJavascript or any other technology that understands HTTP can be used to invoke Rest webservice.We cannot invoke soap webservice using javascript.
Parsing of DataClient needs to write some additional code to parse the incoming Java object, since there is no WSDL that can be used to readily parse the incoming object.Parsing of data is handled based on WSDL that is exposed to the client.
Data FlowREST is a free form of data flow.SOAP is a standard data flow, which has a predefined standard that can be used by different languages or different kind of clients.
PerformanceBetter performance when compared to SOAP.SOAP has little less performance than REST since it has to parse XML data. But, it mainly depends on the app server’s speed to parse the data and not solely on technology.
SummaryRest should be used only if the webservice is handling simple input and output like sending user and password to login a user and there is no Java object that has multiple fields.SOAP is used when there are complex objects like payments object to be exposed, because client stubs can be built easily using WSDL and there is no need of human readable documentation.

Thursday, June 24, 2010

Difference between request scopes

<%= request.getAttribute("method") %> - 12
coz. request object will call the getAttribute method and get the exact value.

${requestScope.method } - 12
request scope same as above, it will get the value from the requestScope map.

${pageContext.request.method} - POST/GET
page context will give the request object and .method will define wht sort of request is it.

Wednesday, July 15, 2009

This is very usefull post....thnx

Friday, July 3, 2009

Struts & Spring Integration

1. We need to add all struts & spring jar in the project lib. specifically struts2-spring-plugin.jar needs to be added.
2. Inside the struts.xml the following lines need to added.

3. then applicationContext.xml files should be there inside WEB-INF folder. If we want the xml file in any other location we can explicitly define it in web.xml.
4. Now project is ready to react to both struts & spring. we can add the specific name inside the struts.xml and it will find out the name related class inside the applicationContext.xml

Friday, April 17, 2009