1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/src/share/jaxws_classes/com/sun/xml/internal/ws/server/package-info.java Tue Mar 06 16:09:35 2012 -0800 1.3 @@ -0,0 +1,148 @@ 1.4 +/* 1.5 + * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. 1.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1.7 + * 1.8 + * This code is free software; you can redistribute it and/or modify it 1.9 + * under the terms of the GNU General Public License version 2 only, as 1.10 + * published by the Free Software Foundation. Oracle designates this 1.11 + * particular file as subject to the "Classpath" exception as provided 1.12 + * by Oracle in the LICENSE file that accompanied this code. 1.13 + * 1.14 + * This code is distributed in the hope that it will be useful, but WITHOUT 1.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 1.16 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 1.17 + * version 2 for more details (a copy is included in the LICENSE file that 1.18 + * accompanied this code). 1.19 + * 1.20 + * You should have received a copy of the GNU General Public License version 1.21 + * 2 along with this work; if not, write to the Free Software Foundation, 1.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 1.23 + * 1.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 1.25 + * or visit www.oracle.com if you need additional information or have any 1.26 + * questions. 1.27 + */ 1.28 + 1.29 +/** 1.30 + * <h1>JAX-WS 2.0.1 Server Runtime</h1> 1.31 + * <P>This document describes the architecture of server side 1.32 + * JAX-WS 2.0.1 runtime. </p> 1.33 + * 1.34 + * <h3>JAX-WS 2.0.1 Server Runtime Sequence Diagram</h3> 1.35 + 1.36 + * <img src='../../../../../jaxws/basic-server.seq.png'> 1.37 + 1.38 + * 1.39 + * 1.40 + * <H3>Message Flow</H3> 1.41 + * <P>A Web Service invocation starts with either the 1.42 + * {@link com.sun.xml.internal.ws.transport.http.servlet.WSServletDelegate WSServletDelegate} 1.43 + * or the {@link com.sun.xml.internal.ws.transport.http.server.ServerConnectionImpl ServerConnectionImpl}. 1.44 + * Both of these classes find the appropriate {@link com.sun.xml.internal.ws.server.RuntimeEndpointInfo RuntimeEndpointInfo} 1.45 + * and invokes the {@link com.sun.xml.internal.ws.server.Tie#handle(com.sun.xml.internal.ws.api.server.WSConnection, 1.46 + * com.sun.xml.internal.ws.spi.runtime.RuntimeEndpointInfo) Tie.handle} 1.47 + * method. This method first creates a {@link com.sun.pept.ept.MessageInfo MessageInfo} 1.48 + * used to gather inforrmation about the message to be received. A 1.49 + * {@link com.sun.xml.internal.ws.server.RuntimeContext RuntimeContext} 1.50 + * is then created with the MessageInfo and the {@link com.sun.xml.internal.ws.api.model.SEIModel RuntimeModel} 1.51 + * retrieved from the RuntimeEndpointInfo. The RuntimeContext is then 1.52 + * stored in the MessageInfo. The {@link com.sun.pept.ept.EPTFactory EPTFactory} 1.53 + * is retrieved from the {@link com.sun.xml.internal.ws.server.EPTFactoryFactoryBase EPTFactoryFactoryBase} 1.54 + * and also placed in the MessagInfo. A {@link com.sun.pept.protocol.MessageDispatcher MessageDispatcher} 1.55 + * is then created and the receive method is invoked. There will be two 1.56 + * types of MessageDispatchers for JAX-WS 2.0.1, SOAPMessageDispatcher 1.57 + * (one for client and one for the server) and an XMLMessageDispatcher 1.58 + * (one for the client and one for the server).</P> 1.59 + * <P>The MessageDispatcher.receive method orchestrates the receiving of 1.60 + * a Message. The SOAPMessageDispatcher first converts the MessageInfo 1.61 + * to a SOAPMessage. The SOAPMessageDispatcher then does mustUnderstand 1.62 + * processing followed by an invocation of any handlers. The SOAPMessage 1.63 + * is then converted to an InternalMessage and stored in the 1.64 + * MessageInfo. The converting of the SOAPMessage to an InternalMessage 1.65 + * is done using the decoder retrieved from the EPTFactory that is 1.66 + * contained in the MessageInfo. Once the SOAPMessage has been converted 1.67 + * to an InternalMessage the endpoint implementation is invoked via 1.68 + * reflection from the Method stored in the MessageInfo. The return 1.69 + * value of the method call is then stored in the InternalMessage. An 1.70 + * internalMessage is then created from the MessageInfo. The SOAPEncoder 1.71 + * is retrieved from the EPTFactory stored in the MessageInfo. The 1.72 + * SOAPEncoder.toSOAPMessage is then invoked to create a SOAPMessage 1.73 + * from the InternalMessage. A WSConnection is then retrieved from the 1.74 + * MessageInfo and the SOAPMessage is returned over that WSConnection.</P> 1.75 + * <P><BR> 1.76 + * </P> 1.77 + * <H3>External Interactions</H3> 1.78 + * <H4>SAAJ API</H4> 1.79 + * <UL> 1.80 + * <LI><P>JAX-WS creates SAAJ javax.xml.soap.SOAPMessage 1.81 + * from the HttpServletRequest. 1.82 + * At present, JAX-WS reads all the bytes from the request stream and 1.83 + * then creates SOAPMessage along with the HTTP headers.</P> 1.84 + * </UL> 1.85 + * <P>javax.xml.soap.MessageFactory(binding).createMessage(MimeHeaders, InputStream)</P> 1.86 + * <UL> 1.87 + * <LI><P>SOAPMessage parses the content from the stream including MIME 1.88 + * data</P> 1.89 + * <LI><P>com.sun.xml.internal.ws.server.SOAPMessageDispatcher::checkHeadersPeekBody()</P> 1.90 + * <P>SOAPMessage.getSOAPHeader() is used for mustUnderstand processing 1.91 + * of headers. It further uses 1.92 + * javax.xml.soap.SOAPHeader.examineMustUnderstandHeaderElements(role)</P> 1.93 + * <P>SOAPMessage.getSOAPBody().getFistChild() is used for guessing the 1.94 + * MEP of the request</P> 1.95 + * <LI><P>com.sun.xml.internal.ws.handler.HandlerChainCaller:insertFaultMessage()</P> 1.96 + * <P>SOAPMessage.getSOAPPart().getEnvelope() and some other SAAJ calls 1.97 + * are made to create a fault in the SOAPMessage</P> 1.98 + * <LI><P>com.sun.xml.internal.ws.handler.LogicalMessageImpl::getPayload() 1.99 + * interacts with SAAJ to get body from SOAPMessage</P> 1.100 + * <LI><P>com.sun.xml.internal.ws.encoding.soap.SOAPEncoder.toSOAPMessage(com.sun.xml.internal.ws.encoding.soap.internal.InternalMessage, 1.101 + * SOAPMessage). There is a scenario where there is SOAPMessage and a 1.102 + * logical handler sets payload as Source. To write to the stream, 1.103 + * SOAPMessage.writeTo() is used but before that the body needs to be 1.104 + * updated with logical handler' Source. Need to verify if this 1.105 + * scenario is still happening since Handler.close() is changed to take 1.106 + * MessageContext.</P> 1.107 + * <LI><P>com.sun.xml.internal.ws.handlerSOAPMessageContextImpl.getHeaders() 1.108 + * uses SAAJ API to get headers.</P> 1.109 + * <LI><P>SOAPMessage.writeTo() is used to write response. At present, 1.110 + * it writes into byte[] and this byte[] is written to 1.111 + * HttpServletResponse.</P> 1.112 + * </UL> 1.113 + * <H4>JAXB API</H4> 1.114 + * <P>JAX-WS RI uses the JAXB API to marshall/unmarshall user created 1.115 + * JAXB objects with user created {@link javax.xml.bind.JAXBContext JAXBContext}. 1.116 + * Handler, Dispatch in JAX-WS API provide ways for the user to specify his/her own 1.117 + * JAXBContext. {@link com.sun.xml.internal.ws.encoding.jaxb.JAXBTypeSerializer JAXBTypeSerializer} class uses all these methods.</P> 1.118 + * <UL> 1.119 + * <LI><p>{@link javax.xml.bind.Marshaller#marshal(Object,XMLStreamWriter) Marshaller.marshal(Object,XMLStreamWriter)}</p> 1.120 + * <LI><P>{@link javax.xml.bind.Marshaller#marshal(Object,Result) Marshaller.marshal(Object, DomResult)}</P> 1.121 + * <LI><P>{@link javax.xml.bind.Unmarshaller#unmarshal(XMLStreamReader) Object Unmarshaller.unmarshal(XMLStreamReader)}</P> 1.122 + * <LI><P>{@link javax.xml.bind.Unmarshaller#unmarshal(Source) Object Unmarshaller.unmarshal(Source)}</P> 1.123 + * </UL> 1.124 + * The following two JAXB classes are implemented by JAX-WS to enable/implement MTOM and XOP 1.125 + * <UL> 1.126 + * <LI><P>{@link javax.xml.bind.attachment.AttachmentMarshaller AttachmentMarshaller}</P> 1.127 + * <LI><P>{@link javax.xml.bind.attachment.AttachmentUnmarshaller AttachmentUnmarshaller}</P> 1.128 + * </UL> 1.129 + * <H4>JAXB Runtime-API (private contract)</H4> 1.130 + * <P>JAX-WS RI uses these private API for serialization/deserialization 1.131 + * purposes. This private API is used to serialize/deserialize method 1.132 + * parameters at the time of JAXBTypeSerializer class uses all 1.133 + * these methods.</P> 1.134 + * <UL> 1.135 + * <LI><P>{@link com.sun.xml.internal.bind.api.Bridge#marshal(BridgeContext, Object, XMLStreamWriter) Bridge.marshal(BridgeContext, Object, XMLStreamWriter)}</P> 1.136 + * <LI><P>{@link com.sun.xml.internal.bind.api.Bridge#marshal(BridgeContext, Object, Node) Bridge.marshal(BridgeContext, Object, Node)}</P> 1.137 + * <LI><P>{@link com.sun.xml.internal.bind.api.Bridge#unmarshal(BridgeContext, XMLStreamReader) Object Bridge.unmarshal(BridgeContext, XMLStreamReader)}</P> 1.138 + * </UL> 1.139 + * 1.140 + * @ArchitectureDocument 1.141 + **/ 1.142 +package com.sun.xml.internal.ws.server; 1.143 + 1.144 +import com.sun.xml.internal.bind.api.BridgeContext; 1.145 + 1.146 +import javax.xml.stream.XMLStreamReader; 1.147 +import javax.xml.stream.XMLStreamWriter; 1.148 +import javax.xml.transform.Source; 1.149 +import javax.xml.transform.Result; 1.150 + 1.151 +import org.w3c.dom.Node;