Xem mẫu

The Java™ Web Services Tutorial For Java Web Services Developer’s Pack, v1.6 June 14, 2005 Copyright © 2005 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, California 95054, U.S.A. All rights reserved.U.S. Government Rights - Commercial software. Government users are subject to the Sun Microsystems, Inc. standard license agreement and applicable provisions of the FAR and its supple-ments. This distribution may include materials developed by third parties. Sun, Sun Microsystems, the Sun logo, Java, J2EE, JavaServer Pages, Enterprise JavaBeans, Java Naming and Directory Interface, EJB, JSP, J2EE, J2SE and the Java Coffee Cup logo are trademarks or registered trademarks of Sun Microsystems, Inc. in the U.S. and other countries. Unless otherwise licensed, software code in all technical materials herein (including articles, FAQs, sam-ples) is provided under this License. Products covered by and information contained in this service manual are controlled by U.S. Export Con-trol laws and may be subject to the export or import laws in other countries. Nuclear, missile, chemical biological weapons or nuclear maritime end uses or end users, whether direct or indirect, are strictly pro-hibited. Export or reexport to countries subject to U.S. embargo or to entities identified on U.S. export exclusion lists, including, but not limited to, the denied persons and specially designated nationals lists is strictly prohibited. DOCUMENTATION IS PROVIDED "AS IS" AND ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING ANY IMPLIED WARRANTY OF MER-CHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE DISCLAIMED, EXCEPT TO THE EXTENT THAT SUCH DISCLAIMERS ARE HELD TO BE LEGALLY INVALID. Copyright © 2005 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, California 95054, États-Unis. Tous droits réservés. Droits du gouvernement américain, utlisateurs gouvernmentaux - logiciel commercial. Les utilisateurs gouvernmentaux sont soumis au contrat de licence standard de Sun Microsystems, Inc., ainsi qu aux dis-positions en vigueur de la FAR [ (Federal Acquisition Regulations) et des suppléments à celles-ci. Cette distribution peut comprendre des composants développés pardes tierces parties. Sun, Sun Microsystems, le logo Sun, Java, JavaServer Pages, Enterprise JavaBeans, Java Naming and Directory Interface, EJB, JSP, J2EE, J2SE et le logo Java Coffee Cup sont des marques de fabrique ou des marques déposées de Sun Microsystems, Inc. aux États-Unis et dans d’autres pays. A moins qu’autrement autorisé, le code de logiciel en tous les matériaux techniques dans le présent (arti-cles y compris, FAQs, échantillons) est fourni sous ce permis. Les produits qui font l’objet de ce manuel d’entretien et les informations qu’il contient sont régis par la législation américaine en matière de contrôle des exportations et peuvent être soumis au droit d’autres pays dans le domaine des exportations et importations. Les utilisations finales, ou utilisateurs finaux, pour des armes nucléaires, des missiles, des armes biologiques et chimiques ou du nucléaire maritime, directe-ment ou indirectement, sont strictement interdites. Les exportations ou réexportations vers des pays sous embargo des États-Unis, ou vers des entités figurant sur les listes d’exclusion d’exportation américaines, y compris, mais de manière non exclusive, la liste de personnes qui font objet d’un ordre de ne pas partic-iper, d’une façon directe ou indirecte, aux exportations des produits ou des services qui sont régi par la législation américaine en matière de contrôle des exportations ("U .S. Commerce Department’s Table of Denial Orders "et la liste de ressortissants spécifiquement désignés ("U.S. Treasury Department of Spe-cially Designated Nationals and Blocked Persons "),, sont rigoureusement interdites. LA DOCUMENTATION EST FOURNIE "EN L’ÉTAT" ET TOUTES AUTRES CONDITIONS, DEC-LARATIONS ET GARANTIES EXPRESSES OU TACITES SONT FORMELLEMENT EXCLUES, DANS LA MESURE AUTORISEE PAR LA LOI APPLICABLE, Y COMPRIS NOTAMMENT TOUTE GARANTIE IMPLICITE RELATIVE A LA QUALITE MARCHANDE, A L’APTITUDE A UNE UTILISATION PARTICULIERE OU A L’ABSENCE DE CONTREFAÇON. Contents About This Tutorial. . . . . . . . . . . . . . . . . . . . . . . . . . . .xi Who Should Use This Tutorial xi Prerequisites xi How to Use This Tutorial xii About the Examples xiii Required Software xiv Building the Examples xiv Further Information xv How to Print This Tutorial xv Typographical Conventions xvi Feedback xvi Chapter 1: Binding XML Schema to Java Classes with JAXB . . 1 JAXB Architecture 2 Architectural Overview 2 The JAXB Binding Process 5 JAXB Binding Framework 6 More About javax.xml.bind 7 More About Unmarshalling 8 More About Marshalling 9 More About Validation 11 XML Schemas 13 Representing XML Content 17 Binding XML Names to Java Identifiers 17 Java Representation of XML Schema 17 Binding XML Schemas 18 Simple Type Definitions 18 Default Data Type Bindings 19 Default Binding Rules Summary 20 iii iv CONTENTS Customizing JAXB Bindings 21 Scope 22 Scope Inheritance 22 What is Not Supported 23 JAXB APIs and Tools 23 Chapter 2: Using JAXB. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .25 General Usage Instructions 26 Description 26 Using the Examples 28 Configuring and Running the Samples 28 JAXB Compiler Options 30 About the Schema-to-Java Bindings 32 Schema-Derived JAXB Classes 35 Basic Examples 43 Unmarshal Read Example 43 Modify Marshal Example 45 Create Marshal Example 47 Unmarshal Validate Example 51 Validate-On-Demand Example 52 Customizing JAXB Bindings 54 Why Customize? 55 Customization Overview 56 Customize Inline Example 69 Datatype Converter Example 74 External Customize Example 75 Fix Collides Example 79 Bind Choice Example 83 Chapter 3: Streaming API for XML . . . . . . . . . . . . . . . . . . . . . . .87 Why StAX? 87 Streaming Versus DOM 88 Pull Parsing Versus Push Parsing 89 StAX Use Cases 89 Comparing StAX to Other JAXP APIs 90 StAX API 91 Cursor API 91 Iterator API 92 Choosing Between Cursor and Iterator APIs 97 CONTENTS v Using StAX 99 StAX Factory Classes 99 Resources, Namespaces, and Errors 101 Reading XML Streams 102 Writing XML Streams 105 Sun’s Streaming Parser Implementation 107 SJSXP JAR Files 107 Reporting CDATA Events 108 SJSXP Factories Implementation 108 Sample Code 109 Configuring Your Environment for Running the Samples 109 Running the Samples 110 Sample XML Document 111 CursorParse.java 112 CursorApproachEventObject.java 114 EventParse.java 115 CursorWriter.java 118 MyStreamFilter.java 119 EventProducerConsumer.java 122 Further Information 125 Chapter 4: Introduction to XML and Web Services Security. 127 Overview 128 Does XWS-Security Implement Any Specifications? 130 On Which Technologies Is XWS-Security Based? 132 Interoperability with Other Web Services 133 What is the XWS-Security Framework? 134 Configuring Security Configuration Files 135 Understanding Security Configuration Files 135 XWS-Security Configuration File Schema 139 Semantics of Security Configuration File Elements 145 How Do I Specify the Security Configuration for the Build Files? 171 Are There Any Sample Applications Demonstrating XWS-Security?174 Writing SecurityEnvironmentHandlers 177 Using the SubjectAccessor API 196 Useful XWS-Security Command-Line Tools 197 pkcs12import 197 keyexport 199 wscompile 200 Troubleshooting XWS-Security Applications 200 ... - tailieumienphi.vn
nguon tai.lieu . vn