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 .............................................................................................................................. x 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 ....................................................................................................... 18 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 Eclipse implementation of Jakarta XML Web Services / Metro with Java SE ......... 38 2.6.1. Using Eclipse implementation of Jakarta XML Web Services 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.8. Handlers and MessageContext ............................................................................... 44 2.8.1. Efficient Handlers in Metro ........................................................................ 44 2.9. Deploying Metro with ... ...................................................................................... 44 2.9.1. WebLogic 12 ........................................................................................... 44 2.10. Developing client application with locally packaged WSDL ...................................... 57 iii Metro User Guide 2.10.1. Service API to pass the WSDL information ................................................. 57 2.10.2. Xml Catalog .......................................................................................... 58 2.10.3. Using -wsdlLocation switch ...................................................................... 58 2.11. How to invoke and endpoint by overriding endpoint address in the WSDL ................... 60 2.11.1. BindingProvider.ENDPOINT_ADDRESS_PROPERTY ................................. 60 2.11.2. Create Service using updated WSDL .......................................................... 60 2.12. Maintaining State in Web Services ....................................................................... 60 2.13. FastInfoset ....................................................................................................... 61 2.13.1. Using FastInfoset .................................................................................... 61 2.14. High Availability Support in Metro ...................................................................... 62 3. Compiling WSDL .......................................................................................................... 63 3.1. Compiling multiple WSDLs that share a common schema .......................................... 63 3.2. Dealing with schemas that are not referenced ........................................................... 64 3.3. Customizing XML Schema binding ........................................................................ 64 3.3.1. How to get simple and better typed binding ................................................... 64 3.4. Generating Javadocs from WSDL documentation ...................................................... 65 3.5. Passing Java Compiler options to Wsimport ............................................................ 67 4. SOAP .......................................................................................................................... 69 4.1. SOAP headers .................................................................................................... 69 4.1.1. Adding SOAP headers when sending requests ............................................... 69 4.1.2. Accessing SOAP headers for incoming messages ........................................... 70 4.1.3. Adding SOAP headers when sending replies ................................................. 70 4.1.4. Mapping additional WSDL headers to method parameters ................................ 70 4.2. Schema Validation .............................................................................................. 71 4.2.1. Server Side Schema Validation ................................................................... 72 4.2.2. Client Side Schema Validation .................................................................... 72 5. HTTP .......................................................................................................................... 74 5.1. HTTP headers .................................................................................................... 74 5.1.1. Sending HTTP headers on request ............................................................... 74 5.1.2. Accessing HTTP headers of the response ...................................................... 74 5.2. HTTP compression .............................................................................................. 75 5.3. HTTP cookies .................................................................................................... 75 5.3.1. Enabling cookie support ............................................................................ 75 5.3.2. Accessing HTTP cookies in the response ...................................................... 76 5.3.3. Accessing HTTP cookies on the server ......................................................... 76 5.4. HTTP