wsdl 2.0 and apache woden
DESCRIPTION
Move on to WSDL 2.0 and Apache Woden and how to use WSDL 2.0 in Apache Axis2TRANSCRIPT
![Page 1: WSDL 2.0 and Apache Woden](https://reader034.vdocument.in/reader034/viewer/2022052214/5481491fb4795941578b485c/html5/thumbnails/1.jpg)
Move on to WSDL 2.0 and Apache Woden
Sagara Gunathunga Apache Committer
![Page 2: WSDL 2.0 and Apache Woden](https://reader034.vdocument.in/reader034/viewer/2022052214/5481491fb4795941578b485c/html5/thumbnails/2.jpg)
Who am I ?
• Apache Woden Committer• Also contribute to Apache Axis2 and
Apache Camel .
![Page 3: WSDL 2.0 and Apache Woden](https://reader034.vdocument.in/reader034/viewer/2022052214/5481491fb4795941578b485c/html5/thumbnails/3.jpg)
Outline• Introduction to SDLs• Today’s SDLs• Introduction to WSDL 2.0• WSDL 2.0 and REST• Introduction to Apache Woden • Hands-on Apache Woden • Apache Woden tools• What is new in Apache Woden 0.9• WSDL 2.0 based WS development in Axis2
![Page 4: WSDL 2.0 and Apache Woden](https://reader034.vdocument.in/reader034/viewer/2022052214/5481491fb4795941578b485c/html5/thumbnails/4.jpg)
Outline• Introduction to SDLs• Today’s SDLs• Introduction to WSDL 2.0• WSDL 2.0 and REST• Introduction to Apache Woden • Hands-on Apache Woden • Apache Woden tools• What is new in Apache Woden 0.9 • WSDL 2.0 based WS development in Axis2
![Page 5: WSDL 2.0 and Apache Woden](https://reader034.vdocument.in/reader034/viewer/2022052214/5481491fb4795941578b485c/html5/thumbnails/5.jpg)
What is a contract in real world ?
![Page 6: WSDL 2.0 and Apache Woden](https://reader034.vdocument.in/reader034/viewer/2022052214/5481491fb4795941578b485c/html5/thumbnails/6.jpg)
Contract in Web services
WHAT ? HOW ?
WHERE ?
![Page 7: WSDL 2.0 and Apache Woden](https://reader034.vdocument.in/reader034/viewer/2022052214/5481491fb4795941578b485c/html5/thumbnails/7.jpg)
WHAT it does ?• Define the purpose and function of its operations. • Define the messages that need to be exchanged in
order to engage the operations.
• Define data models used to define the structure of the messages.
• Define a set of conditions under which the operations are provided.
• Define information about how and where the service can be accessed.
![Page 8: WSDL 2.0 and Apache Woden](https://reader034.vdocument.in/reader034/viewer/2022052214/5481491fb4795941578b485c/html5/thumbnails/8.jpg)
Outline• Introduction to SDLs• Today’s SDLs• Introduction to WSDL 2.0• WSDL 2.0 and REST• Introduction to Apache Woden • Hands-on Apache Woden • Apache Woden tools• What is new in Apache Woden 0.9 • WSDL 2.0 based WS development in Axis2
![Page 9: WSDL 2.0 and Apache Woden](https://reader034.vdocument.in/reader034/viewer/2022052214/5481491fb4795941578b485c/html5/thumbnails/9.jpg)
Today’s SDLs
• WSDL 1.1 ( Web Service Description Language 1.1)
• WADL ( Web Application Description Language)
• SSDL (SOAP Service Description Language)
![Page 10: WSDL 2.0 and Apache Woden](https://reader034.vdocument.in/reader034/viewer/2022052214/5481491fb4795941578b485c/html5/thumbnails/10.jpg)
WSDL 1.1WSDL 1.1WSDL is an XML-based language used to define Web Services and describe how to access them.
WSDL is an XML format for describing network services as a set of endpoints operating on messages containing either document-oriented or procedure-oriented style.
WSDL 1.0 was Jointly developed by IBM, Microsoft and many others in 2000.
WSDL 1.1 released in 2001.
Compliant with WSDL Basic profile 1.0
![Page 11: WSDL 2.0 and Apache Woden](https://reader034.vdocument.in/reader034/viewer/2022052214/5481491fb4795941578b485c/html5/thumbnails/11.jpg)
WSDL 1.1ProsPros
• Proven and Widely used in industry for last few years.• Compliant with WS-I basic profile 1.0 • Many projects available - WSDL4J , WOM• Code generation tools available –
Axis2 /CXF WSDL2Java ,wsimport
Cons• Really complex language.• Hard learning curve.• Not fit with REST services.
![Page 12: WSDL 2.0 and Apache Woden](https://reader034.vdocument.in/reader034/viewer/2022052214/5481491fb4795941578b485c/html5/thumbnails/12.jpg)
WADLWADL is a description language for HTTP-based Web applications, such as applications which follow the REST architectural style.
Written by Marc Hadley at Sun somewhere around 2006.
From August 2009 WADL is a W3C Member Submission.
![Page 13: WSDL 2.0 and Apache Woden](https://reader034.vdocument.in/reader034/viewer/2022052214/5481491fb4795941578b485c/html5/thumbnails/13.jpg)
Pros• Works well with REST services.• Automation tools available -
WADL2JAVA , Google REST compiler• Some projects available - Jersey
Cons• Still not widely used as WSDL 1.1• Doesn't support for SOAP based web services.
![Page 14: WSDL 2.0 and Apache Woden](https://reader034.vdocument.in/reader034/viewer/2022052214/5481491fb4795941578b485c/html5/thumbnails/14.jpg)
SSDLThe SOAP Service Description Language (SSDL) is a SOAP-centric contract description language for Web Services
![Page 15: WSDL 2.0 and Apache Woden](https://reader034.vdocument.in/reader034/viewer/2022052214/5481491fb4795941578b485c/html5/thumbnails/15.jpg)
Pros• Works well with SOAP based web services. • Project available - Soya for C#
Cons
• Not widely used in neither industry nor academic purposes.• Only support for SOAP. • No automation tools available . • No project for java.
![Page 16: WSDL 2.0 and Apache Woden](https://reader034.vdocument.in/reader034/viewer/2022052214/5481491fb4795941578b485c/html5/thumbnails/16.jpg)
Outline• Introduction to SDLs• Today’s SDLs• Introduction to WSDL 2.0• Introduction to Apache Woden • WSDL 2.0 and REST• Hands-on Apache Woden • Apache Woden tools• What is new in Apache Woden 0.9 • WSDL 2.0 based WS development in Axis2
![Page 17: WSDL 2.0 and Apache Woden](https://reader034.vdocument.in/reader034/viewer/2022052214/5481491fb4795941578b485c/html5/thumbnails/17.jpg)
WSDL 2.0• Improved version of WSDL 1.1
• Simple and no ambiguities unlike WSDL 1.1 and easy learning curve.
• Fully supports for both SOAP based and RESTful web services.
• Removal of message constructs. These are specified using the XML schema type system.
• Possibility to define QoS – features and properties
![Page 18: WSDL 2.0 and Apache Woden](https://reader034.vdocument.in/reader034/viewer/2022052214/5481491fb4795941578b485c/html5/thumbnails/18.jpg)
WSDL 2.0• Well defined Message Exchange Patterns (MEP)
• Some WS engines already supports and provide automation tools
- Axis2 and WSDL2Java
![Page 19: WSDL 2.0 and Apache Woden](https://reader034.vdocument.in/reader034/viewer/2022052214/5481491fb4795941578b485c/html5/thumbnails/19.jpg)
Wsdl1.1/2.0 Comparison
Within <operation><message><endpoint><port><service><service><types><types><binding><binding><interface><portType><description><definition> WSDL 2.0 WSDL 1.1
![Page 20: WSDL 2.0 and Apache Woden](https://reader034.vdocument.in/reader034/viewer/2022052214/5481491fb4795941578b485c/html5/thumbnails/20.jpg)
WSDL 2.0 component model
Description is container for 2 types of top-level components.
(1) WSDL Component (interface , binding , services)
(2) Type system component
(ElementDeclaration,typeDefinition)
![Page 21: WSDL 2.0 and Apache Woden](https://reader034.vdocument.in/reader034/viewer/2022052214/5481491fb4795941578b485c/html5/thumbnails/21.jpg)
WSDL 2.0 nested component model
![Page 22: WSDL 2.0 and Apache Woden](https://reader034.vdocument.in/reader034/viewer/2022052214/5481491fb4795941578b485c/html5/thumbnails/22.jpg)
Feature & property Provides additional processing information for a component
example – reliability , correlation
![Page 23: WSDL 2.0 and Apache Woden](https://reader034.vdocument.in/reader034/viewer/2022052214/5481491fb4795941578b485c/html5/thumbnails/23.jpg)
MEP – Message Exchange patterns
MEP defines a contract between service and clientWSDL 2.0 defines 8 MEPs
• In-Only• Robust In-Only• In-Out• In-Optional-Out• Out-Only• Robust Out-Only• Out-In• Out-Optional-In
![Page 24: WSDL 2.0 and Apache Woden](https://reader034.vdocument.in/reader034/viewer/2022052214/5481491fb4795941578b485c/html5/thumbnails/24.jpg)
Outline• Introduction to SDLs• Today’s SDLs• Introduction to WSDL 2.0• WSDL 2.0 and REST• Introduction to Apache Woden • Hands-on Apache Woden • Apache Woden tools• What is new in Apache Woden 0.9 • WSDL 2.0 based WS development in Axis2
![Page 25: WSDL 2.0 and Apache Woden](https://reader034.vdocument.in/reader034/viewer/2022052214/5481491fb4795941578b485c/html5/thumbnails/25.jpg)
WSDL 2.0 and REST The "WSDL 2.0 Part 2: Adjuncts" provides the specifics ofHTTP, SOAP 1.2, and MEP usage with WSDL 2.0. WSDL2.0 HTTP Binding can be used to define REST servicessuccessfully.
Following HTTP methods can be used.7. GET8. POST9. PUT10.DELETE
![Page 26: WSDL 2.0 and Apache Woden](https://reader034.vdocument.in/reader034/viewer/2022052214/5481491fb4795941578b485c/html5/thumbnails/26.jpg)
WSDL 2.0/ HTTP Binding Binding type should be http://www.w3.org/2006/01/wsdl/http
<binding name="xs:NCName" interface="xs:QName"? type="http://www.w3.org/ns/wsdl/http" whttp:methodDefault="xs:string"?
whttp:queryParameterSeparator Default="xs:string"? whttp:cookies="xs:boolean"? whttp:contentEncodingDefault="xs:string"? >
![Page 27: WSDL 2.0 and Apache Woden](https://reader034.vdocument.in/reader034/viewer/2022052214/5481491fb4795941578b485c/html5/thumbnails/27.jpg)
WSDL 2.0/ HTTP Binding
<operation ref="xs:QName" whttp:location="xs:anyURI"? whttp:method="xs:string"? whttp:inputSerialization="xs:string"? whttp:outputSerialization="xs:string"? whttp:faultSerialization="xs:string"? whttp:queryParameterSeparator="xs:string"? whttp:contentEncodingDefault="xs:string"? whttp:ignoreUncited="xs:boolean"? >
In most cases “location” and “method” attributes are sufficient .
![Page 28: WSDL 2.0 and Apache Woden](https://reader034.vdocument.in/reader034/viewer/2022052214/5481491fb4795941578b485c/html5/thumbnails/28.jpg)
Example
<wsdl2:binding name="DemoServiceHttpBinding" interface="tns:DemoServiceInterface" type=http://www.w3.org/ns/wsdl/http >
<wsdl2:operation ref="tns:demo" whttp:method="POST" whttp:location="demo“ /></wsdl2:binding>
![Page 29: WSDL 2.0 and Apache Woden](https://reader034.vdocument.in/reader034/viewer/2022052214/5481491fb4795941578b485c/html5/thumbnails/29.jpg)
Input and Output Serialization Formats
Input format - {http input serialization}
Output format - {http output serialization}
application/xmlapplication/x-www- form-urlencoded
DELETE
application/xmlapplication/xmlPUT
application/xmlapplication/xmlPOST
application/xmlapplication/x-www- form-urlencoded
GET
Default Output Serialization
Default Input Serialization
HTTP Method
![Page 30: WSDL 2.0 and Apache Woden](https://reader034.vdocument.in/reader034/viewer/2022052214/5481491fb4795941578b485c/html5/thumbnails/30.jpg)
Example
![Page 31: WSDL 2.0 and Apache Woden](https://reader034.vdocument.in/reader034/viewer/2022052214/5481491fb4795941578b485c/html5/thumbnails/31.jpg)
Outline• Introduction to SDLs• Today’s SDLs• Introduction to WSDL 2.0• WSDL 2.0 and REST• Introduction to Apache Woden • Hands-on Apache Woden • Apache Woden tools• What is new in Apache Woden 0.9 • WSDL 2.0 based WS development in Axis2
![Page 32: WSDL 2.0 and Apache Woden](https://reader034.vdocument.in/reader034/viewer/2022052214/5481491fb4795941578b485c/html5/thumbnails/32.jpg)
Apache Woden
Apache Web Services Project to develop a Java class library for reading, manipulating, creating and writing WSDL documents, initially to support WSDL 2.0 but with the longer term aim of supporting past, present and future versions of WSDL.
Who uses Woden
- Apache Axis2
- Apache ServiceMix
![Page 33: WSDL 2.0 and Apache Woden](https://reader034.vdocument.in/reader034/viewer/2022052214/5481491fb4795941578b485c/html5/thumbnails/33.jpg)
Main deliverables 1. Woden API for WSDL 2.0 2. DOM based implementation. 3. OM (Axiom) based implementation.4. WSDL 2.0 validator tool5. WSDL1.1 to 2.0 Converter tool.6. Maven plug-ins and Ant Tasks for above tools
![Page 34: WSDL 2.0 and Apache Woden](https://reader034.vdocument.in/reader034/viewer/2022052214/5481491fb4795941578b485c/html5/thumbnails/34.jpg)
Two APIs
Component model API•Mirror the component model of WSDL 2.0
•One root Description object representing a merge of all .wsdl files imported and included
Element level APIMirror the XML representation of WSDL 2.0
Represent the physical Xml file representation
![Page 35: WSDL 2.0 and Apache Woden](https://reader034.vdocument.in/reader034/viewer/2022052214/5481491fb4795941578b485c/html5/thumbnails/35.jpg)
Outline• Introduction to SDLs• Today’s SDLs• Introduction to WSDL 2.0• WSDL 2.0 and REST• Introduction to Apache Woden • Hands-on Apache Woden • Apache Woden tools• What is new in Apache Woden 0.9 • WSDL 2.0 based WS development in Axis2
![Page 36: WSDL 2.0 and Apache Woden](https://reader034.vdocument.in/reader034/viewer/2022052214/5481491fb4795941578b485c/html5/thumbnails/36.jpg)
Component level – Element level
To Component model To Element modelaComponent.toElement()aElement.toComponent()
Example
DescriptionElement descElement; Description descComponent; descComponent=descElement.toComponent(); descElement=descComponent.toElement();
![Page 37: WSDL 2.0 and Apache Woden](https://reader034.vdocument.in/reader034/viewer/2022052214/5481491fb4795941578b485c/html5/thumbnails/37.jpg)
Define the implementation DOM or OM
Using WSDLFactory you can specify the implementation.Default implementation is based on DOM
For DOM implementation
For OM implementation
WSDLFactory FWSDLFactory=WSDLFactory.newInstance(); OR WSDLFactory FWSDLFactory= WSDLFactory.newInstance(“org.apache.woden.internal.DOMWSDLFactory”);
WSDLFactory FWSDLFactory= WSDLFactory.newInstance(“org.apache.woden.internal.OMWSDLFactory”);
![Page 38: WSDL 2.0 and Apache Woden](https://reader034.vdocument.in/reader034/viewer/2022052214/5481491fb4795941578b485c/html5/thumbnails/38.jpg)
Reading WSDL 2.0 documents
// create WSDL factory instance. WSDLFactory FWSDLFactory=WSDLFactory.newInstance();
//create WSDL reader instance WSDLReader reader=FWSDLFactory.newWSDLReader();
//set validation reader.setFeature(WSDLReader.FEATURE_VALIDATION, true);
//read the WSDL file in to a DescriptionElement DescriptionElement descElem = reader.readWSDL(wsdlurl);
![Page 39: WSDL 2.0 and Apache Woden](https://reader034.vdocument.in/reader034/viewer/2022052214/5481491fb4795941578b485c/html5/thumbnails/39.jpg)
Writing WSDL 2.0 document // create WSDL factory instance. WSDLFactory FWSDLFactory=WSDLFactory.newInstance();
//create WSDL writer instance WSDLWriter writer=FWSDLFactory.newWSDLWriter()
//Write WSDL in to the console writer.writeWSDL(descElem, System.out )
//write WSDL as a file writer.writeWSDL(descElem, new FileOutputStream("test.wsdl") )
![Page 40: WSDL 2.0 and Apache Woden](https://reader034.vdocument.in/reader034/viewer/2022052214/5481491fb4795941578b485c/html5/thumbnails/40.jpg)
create WSDL document
WSDLFactory wsdlFactory=WSDLFactory.newInstance();
DescriptionElement descElement=wsdlFactory.newDescription(); descElement.setTargetNamespace(new URI("http://my.com") );
InterfaceElement interElement=descElement.addInterfaceElement(); InterfaceOperationElement iOpElement=interElement.addInterfaceOperationElement();
BindingElement bindingElement=descElement.addBindingElement(); BindingOperationElement bOpElement=bindingElement.addBindingOperationElement();
At the moment only support for Element level API
![Page 41: WSDL 2.0 and Apache Woden](https://reader034.vdocument.in/reader034/viewer/2022052214/5481491fb4795941578b485c/html5/thumbnails/41.jpg)
Outline• Introduction to SDLs• Today’s SDLs• Introduction to WSDL 2.0• WSDL 2.0 and REST• Introduction to Apache Woden • Hands-on Apache Woden • Apache Woden tools• What is new in Apache Woden 0.9 • WSDL 2.0 based WS development in Axis2
![Page 42: WSDL 2.0 and Apache Woden](https://reader034.vdocument.in/reader034/viewer/2022052214/5481491fb4795941578b485c/html5/thumbnails/42.jpg)
Woden tools - validation• Schema validations done by the XML parsers.
• Semantic validations done by Woden validator. - on the WSDL object model assertions are checked
against the model.
• All errors are reported in one pass. Woden does not stop-on-first-error like WSDL4J.
![Page 43: WSDL 2.0 and Apache Woden](https://reader034.vdocument.in/reader034/viewer/2022052214/5481491fb4795941578b485c/html5/thumbnails/43.jpg)
Woden tools - Validation
Validation is ‘off’ by default.Enable validation before reading the WSDL
reader.setFeature(WSDLReader.FEATURE_VALIDATION, true);
Example
![Page 44: WSDL 2.0 and Apache Woden](https://reader034.vdocument.in/reader034/viewer/2022052214/5481491fb4795941578b485c/html5/thumbnails/44.jpg)
Woden tools - WSDL Converter
• Perform WSDL 1.1 to 2.0 conversion.• Another great feature. • Based on XSLT style sheet. • Available as a Standalone tool, as a Maven plug-in or an
Ant Task
![Page 45: WSDL 2.0 and Apache Woden](https://reader034.vdocument.in/reader034/viewer/2022052214/5481491fb4795941578b485c/html5/thumbnails/45.jpg)
Woden tools - WSDL Converter
In command line
java -Djava.ext.dirs=/home/sagara/woden org.apache.woden.tool.converter.Convert -wsdl /home/sagara/test/converter/Echo.wsdl
programmatically Convert convert = new Convert(); try { convertFile = convert.convertFile(newTargetNS,wsdlDoc, targetDir,verbose,overwrite); System.out.println(convertFile); } catch (Exception e) { e.printStackTrace(); }
![Page 46: WSDL 2.0 and Apache Woden](https://reader034.vdocument.in/reader034/viewer/2022052214/5481491fb4795941578b485c/html5/thumbnails/46.jpg)
Outline• Introduction to SDLs• Today’s SDLs• Introduction to WSDL 2.0• WSDL 2.0 and REST• Introduction to Apache Woden • Hands-on Apache Woden • Apache Woden tools• What is new in Apache Woden 0.9• WSDL 2.0 based WS development in Axis2
![Page 47: WSDL 2.0 and Apache Woden](https://reader034.vdocument.in/reader034/viewer/2022052214/5481491fb4795941578b485c/html5/thumbnails/47.jpg)
What is new in Woden 0.9 • Woden Serialization - WSDLWriter based on DOM and
OM.
• Split QName into a different package to resolve conflicts in OSGI environments.
• Remove dependency on Xereces , now Woden(dom) work with any JAXP implementation
• Component level equals method.
• Logging framework based on Commons-logging API.
• WSDL Converter Maven plug-in and Ant Task
• Code base refactored for more Maven friendly manner .
![Page 48: WSDL 2.0 and Apache Woden](https://reader034.vdocument.in/reader034/viewer/2022052214/5481491fb4795941578b485c/html5/thumbnails/48.jpg)
Outline• Introduction to SDLs• Today’s SDLs• Introduction to WSDL 2.0• WSDL 2.0 and REST• Introduction to Apache Woden • Hands-on Apache Woden • Apache Woden tools• What is new in Apache Woden 0.9• WSDL 2.0 based WS development in Axis2
![Page 49: WSDL 2.0 and Apache Woden](https://reader034.vdocument.in/reader034/viewer/2022052214/5481491fb4795941578b485c/html5/thumbnails/49.jpg)
WSDL 2.0 based WS development in Axis2
Axs2 supports for WSDL 2.0 1.) Contract first Web services. 2.) Code first services
![Page 50: WSDL 2.0 and Apache Woden](https://reader034.vdocument.in/reader034/viewer/2022052214/5481491fb4795941578b485c/html5/thumbnails/50.jpg)
WSDL 2.0 based WS development in Axis2
In Contract first WS development you can use Axis2 WSDL2JAVA tool to generate source codes from your WSDL 2.0 documents.
Both WSDL2JAVA Ant Task and Maven Plug-in supports for WSDL 2.0
In WSDL2JAVA Command line tool use -wv 2 or -wv 2.0 options. With Maven Plug-in use wsdlVersion option.
Example :
wsdl2java -wv 2 OR wsdl2java -wv 2 .0
![Page 51: WSDL 2.0 and Apache Woden](https://reader034.vdocument.in/reader034/viewer/2022052214/5481491fb4795941578b485c/html5/thumbnails/51.jpg)
WSDL 2.0 based WS development in Axis2
In code first approach, to generate WSDL 2.0 document use ?wsdl2 instead of ?wsdl .
http://localhost:8080/services/SimpleService?wsdl2
Example :
![Page 53: WSDL 2.0 and Apache Woden](https://reader034.vdocument.in/reader034/viewer/2022052214/5481491fb4795941578b485c/html5/thumbnails/53.jpg)
Thank You