Metro User Guide Metro User Guide Table of Contents
Total Page:16
File Type:pdf, Size:1020Kb
Metro User Guide Metro User Guide Table of Contents Preface ............................................................................................................................ xii 1. Introduction to Metro ...................................................................................................... 1 1.1. Required Software ................................................................................................ 1 1.2. What is WSIT? .................................................................................................... 1 1.2.1. Bootstrapping and Configuration ................................................................... 2 1.2.2. Message Optimization Technology ................................................................ 3 1.2.3. Reliable Messaging Technology ................................................................... 4 1.2.4. Security Technology ................................................................................... 4 1.3. How Metro Relates to .NET Windows Communication Foundation (WCF) ...................... 5 1.4. Metro Specifications ............................................................................................. 5 1.4.1. Bootstrapping and Configuration Specifications ............................................... 7 1.4.2. Message Optimization Specifications ............................................................. 8 1.4.3. Reliable Messaging Specifications ............................................................... 10 1.4.4. Security Specifications .............................................................................. 11 1.5. How the Metro Technologies Work ....................................................................... 12 1.5.1. How Message Optimization Works .............................................................. 12 1.5.2. How Reliable Messaging Works ................................................................. 13 1.5.3. How Security Works ................................................................................. 14 2. Using Metro ................................................................................................................. 18 2.1. Metro Tools ....................................................................................................... 19 2.1.1. Useful tools for your toolbox ...................................................................... 19 2.2. Using Mavenized Metro Binaries ........................................................................... 19 2.2.1. Using Metro in a Maven project ................................................................. 19 2.2.2. Using Metro in a non-Maven project ............................................................ 20 2.3. Developing with NetBeans ................................................................................... 21 2.3.1. Registering GlassFish with the IDE ............................................................. 21 2.3.2. Creating a Web Service ............................................................................. 21 2.3.3. Configuring Metro's WSIT Features in the Web Service .................................. 23 2.3.4. Deploying and Testing a Web Service .......................................................... 25 2.3.5. Creating a Client to Consume a WSIT-Enabled Web Service ............................ 25 2.4. Developing with Eclipse ...................................................................................... 28 2.4.1. Setup ..................................................................................................... 28 2.4.2. Create a Metro Web Services Endpoint ........................................................ 29 2.4.3. Creating Web Service Client using Wsimport CLI .......................................... 29 2.4.4. Creating Web Service Client using Wsimport Ant Task ................................... 30 2.4.5. Creating Web Service Client using SOAP UI Plugin ....................................... 30 2.5. Logging ............................................................................................................ 33 2.5.1. Dynamic tube-based message logging .......................................................... 33 2.5.2. Dumping SOAP messages on client ............................................................. 36 2.5.3. Dumping SOAP messages on server ............................................................ 38 2.6. Using JAX-WS / Metro with Java SE ..................................................................... 38 2.6.1. Using JAX-WS with Java SE ..................................................................... 38 2.6.2. Using Metro with Java SE ......................................................................... 39 2.7. Deploying Metro endpoint .................................................................................... 39 2.7.1. The WAR Contents .................................................................................. 40 2.7.2. Using sun-jaxws.xml ................................................................................. 40 2.7.3. Using 109 Deployment Descriptor ............................................................... 44 2.7.4. Using Spring ........................................................................................... 44 2.8. Handlers and MessageContext ............................................................................... 45 2.8.1. MessageContext in JAX-WS ...................................................................... 45 2.8.2. Handlers in JAX-WS ................................................................................ 45 iii Metro User Guide 2.8.3. Efficient Handlers in JAX-WS RI ............................................................... 45 2.9. Deploying Metro with ... ...................................................................................... 45 2.9.1. WebLogic 12 ........................................................................................... 45 2.10. Developing client application with locally packaged WSDL ...................................... 51 2.10.1. Service API to pass the WSDL information ................................................. 51 2.10.2. Xml Catalog .......................................................................................... 51 2.10.3. Using -wsdlLocation switch ...................................................................... 52 2.11. How to invoke and endpoint by overriding endpoint address in the WSDL ................... 53 2.11.1. BindingProvider.ENDPOINT_ADDRESS_PROPERTY ................................. 53 2.11.2. Create Service using updated WSDL .......................................................... 54 2.12. Maintaining State in Web Services ....................................................................... 54 2.13. FastInfoset ....................................................................................................... 54 2.13.1. Using FastInfoset .................................................................................... 55 2.14. High Availability Support in Metro ...................................................................... 55 3. Compiling WSDL ......................................................................................................... 57 3.1. Compiling multiple WSDLs that share a common schema .......................................... 57 3.2. Dealing with schemas that are not referenced ........................................................... 58 3.3. Customizing XML Schema binding ........................................................................ 58 3.3.1. How to get simple and better typed binding ................................................... 58 3.4. Generating Javadocs from WSDL documentation ...................................................... 59 3.5. Passing Java Compiler options to Wsimport ............................................................ 61 4. SOAP ......................................................................................................................... 63 4.1. SOAP headers .................................................................................................... 63 4.1.1. Adding SOAP headers when sending requests ............................................... 63 4.1.2. Accessing SOAP headers for incoming messages ........................................... 64 4.1.3. Adding SOAP headers when sending replies ................................................. 64 4.1.4. Mapping additional WSDL headers to method parameters ................................ 64 4.2. Schema Validation .............................................................................................. 65 4.2.1. Server Side Schema Validation ................................................................... 65 4.2.2. Client Side Schema Validation .................................................................... 66 5. HTTP .......................................................................................................................... 68 5.1. HTTP headers .................................................................................................... 68 5.1.1. Sending HTTP headers on request ............................................................... 68 5.1.2. Accessing HTTP headers of the response ...................................................... 68 5.2. HTTP compression ............................................................................................. 69