Monday, December 14, 2009

WebLogic WebServices, a quick tutorial

JAX-WS = Java API for XML-based Web Services
is replacing JAX-RPC 

it supports SOAP 1.2,
JAXB 2.1(Java Architecture for XML Binding)
attachments with MTOM 
EJB 3.0 
WS-Security WSS 1.1


A Java Web Service (JWS) contains a @WebService annotation
@WebMethod for each method

@WebParam and @WebResult
@SOAPBinding

these annotations belong to the javax.jws package.

You use the jwsc Ant task to compile it




The WS is available at:
http://host:port/HelloWorldImpl/HelloWorldService?WSDL
HelloWorldImpl=contextPath 
HelloWorldService=serviceUri



You can create a Web Service from an existing WSDL file, "the golden WSDL". Use wsdlc to generate the JWS artifacts.

A WSDL is made of:
service has a port, qualified by an address and a 
binding (soap, http) which contains a portType, specifying the input and output parameters

message

all these parameters are expressed in the @WebService tag

ClientGenTask is a Ant task which "generates, from an existing WSDL file, the client component files that client applications use to invoke both WebLogic and non-WebLogic Web Services"
http://download.oracle.com/docs/cd/E13222_01/wls/docs92/webserv/anttasks.html#wp1039270


Different styles of binding are possible:
http://www.ibm.com/developerworks/webservices/library/ws-whichwsdl/

RPC literal, RPC encoded
Document literal, Document encoded


More on how to use annotations:

http://www.oracle.com/technology/tech/java/oc4j/1013/how_to/how-to-ws-annotations/doc/how-to-ws-annotations.html

Some useful tutorials:

http://netbeans.org/kb/trails/web.html

No comments: