325N/A * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. 325N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 325N/A * This code is free software; you can redistribute it and/or modify it 325N/A * under the terms of the GNU General Public License version 2 only, as 325N/A * published by the Free Software Foundation. Oracle designates this 325N/A * particular file as subject to the "Classpath" exception as provided 325N/A * by Oracle in the LICENSE file that accompanied this code. 325N/A * This code is distributed in the hope that it will be useful, but WITHOUT 325N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 325N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 325N/A * version 2 for more details (a copy is included in the LICENSE file that 325N/A * accompanied this code). 325N/A * You should have received a copy of the GNU General Public License version 325N/A * 2 along with this work; if not, write to the Free Software Foundation, 325N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 325N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 325N/A * or visit www.oracle.com if you need additional information or have any 325N/A * <h1>JAX-WS 2.0.1 Server Runtime</h1> 325N/A * <P>This document describes the architecture of server side 325N/A * JAX-WS 2.0.1 runtime. </p> 325N/A * <h3>JAX-WS 2.0.1 Server Runtime Sequence Diagram</h3> 325N/A * <H3>Message Flow</H3> 325N/A * <P>A Web Service invocation starts with either the 325N/A * {@link com.sun.xml.internal.ws.transport.http.servlet.WSServletDelegate WSServletDelegate} 325N/A * or the {@link com.sun.xml.internal.ws.transport.http.server.ServerConnectionImpl ServerConnectionImpl}. 325N/A * Both of these classes find the appropriate {@link com.sun.xml.internal.ws.server.RuntimeEndpointInfo RuntimeEndpointInfo} 325N/A * method. This method first creates a {@link com.sun.pept.ept.MessageInfo MessageInfo} 325N/A * used to gather inforrmation about the message to be received. A 325N/A * is then created with the MessageInfo and the {@link com.sun.xml.internal.ws.api.model.SEIModel RuntimeModel} 325N/A * retrieved from the RuntimeEndpointInfo. The RuntimeContext is then 325N/A * stored in the MessageInfo. The {@link com.sun.pept.ept.EPTFactory EPTFactory} 325N/A * is retrieved from the {@link com.sun.xml.internal.ws.server.EPTFactoryFactoryBase EPTFactoryFactoryBase} 325N/A * and also placed in the MessagInfo. A {@link com.sun.pept.protocol.MessageDispatcher MessageDispatcher} 325N/A * is then created and the receive method is invoked. There will be two 325N/A * types of MessageDispatchers for JAX-WS 2.0.1, SOAPMessageDispatcher 325N/A * (one for client and one for the server) and an XMLMessageDispatcher 325N/A * (one for the client and one for the server).</P> 325N/A * <P>The MessageDispatcher.receive method orchestrates the receiving of 325N/A * a Message. The SOAPMessageDispatcher first converts the MessageInfo 325N/A * to a SOAPMessage. The SOAPMessageDispatcher then does mustUnderstand 325N/A * processing followed by an invocation of any handlers. The SOAPMessage 325N/A * is then converted to an InternalMessage and stored in the 325N/A * MessageInfo. The converting of the SOAPMessage to an InternalMessage 325N/A * is done using the decoder retrieved from the EPTFactory that is 325N/A * contained in the MessageInfo. Once the SOAPMessage has been converted 325N/A * to an InternalMessage the endpoint implementation is invoked via 325N/A * reflection from the Method stored in the MessageInfo. The return 325N/A * value of the method call is then stored in the InternalMessage. An 325N/A * internalMessage is then created from the MessageInfo. The SOAPEncoder 325N/A * is retrieved from the EPTFactory stored in the MessageInfo. The 325N/A * SOAPEncoder.toSOAPMessage is then invoked to create a SOAPMessage 325N/A * from the InternalMessage. A WSConnection is then retrieved from the 325N/A * MessageInfo and the SOAPMessage is returned over that WSConnection.</P> 325N/A * <H3>External Interactions</H3> 325N/A * from the HttpServletRequest. 325N/A * At present, JAX-WS reads all the bytes from the request stream and 325N/A * then creates SOAPMessage along with the HTTP headers.</P> 325N/A * <P>javax.xml.soap.MessageFactory(binding).createMessage(MimeHeaders, InputStream)</P> 325N/A * <LI><P>SOAPMessage parses the content from the stream including MIME 325N/A * <LI><P>com.sun.xml.internal.ws.server.SOAPMessageDispatcher::checkHeadersPeekBody()</P> 325N/A * <P>SOAPMessage.getSOAPHeader() is used for mustUnderstand processing 325N/A * of headers. It further uses 325N/A * javax.xml.soap.SOAPHeader.examineMustUnderstandHeaderElements(role)</P> 325N/A * <P>SOAPMessage.getSOAPBody().getFistChild() is used for guessing the 325N/A * MEP of the request</P> 325N/A * <LI><P>com.sun.xml.internal.ws.handler.HandlerChainCaller:insertFaultMessage()</P> 325N/A * <P>SOAPMessage.getSOAPPart().getEnvelope() and some other SAAJ calls 325N/A * are made to create a fault in the SOAPMessage</P> 325N/A * interacts with SAAJ to get body from SOAPMessage</P> 325N/A * <LI><P>com.sun.xml.internal.ws.encoding.soap.SOAPEncoder.toSOAPMessage(com.sun.xml.internal.ws.encoding.soap.internal.InternalMessage, 325N/A * SOAPMessage). There is a scenario where there is SOAPMessage and a 325N/A * logical handler sets payload as Source. To write to the stream, 325N/A * SOAPMessage.writeTo() is used but before that the body needs to be 325N/A * updated with logical handler' Source. Need to verify if this 325N/A * scenario is still happening since Handler.close() is changed to take 325N/A * uses SAAJ API to get headers.</P> 325N/A * <LI><P>SOAPMessage.writeTo() is used to write response. At present, 325N/A * it writes into byte[] and this byte[] is written to 325N/A * HttpServletResponse.</P> 325N/A * JAXB objects with user created {@link javax.xml.bind.JAXBContext JAXBContext}. 325N/A * Handler, Dispatch in JAX-WS API provide ways for the user to specify his/her own 325N/A * JAXBContext. {@link com.sun.xml.internal.ws.encoding.jaxb.JAXBTypeSerializer JAXBTypeSerializer} class uses all these methods.</P> 325N/A * <LI><p>{@link javax.xml.bind.Marshaller#marshal(Object,XMLStreamWriter) Marshaller.marshal(Object,XMLStreamWriter)}</p> 325N/A * <LI><P>{@link javax.xml.bind.Marshaller#marshal(Object,Result) Marshaller.marshal(Object, DomResult)}</P> 325N/A * <LI><P>{@link javax.xml.bind.Unmarshaller#unmarshal(XMLStreamReader) Object Unmarshaller.unmarshal(XMLStreamReader)}</P> 325N/A * <LI><P>{@link javax.xml.bind.Unmarshaller#unmarshal(Source) Object Unmarshaller.unmarshal(Source)}</P> 325N/A * <LI><P>{@link javax.xml.bind.attachment.AttachmentMarshaller AttachmentMarshaller}</P> 325N/A * <LI><P>{@link javax.xml.bind.attachment.AttachmentUnmarshaller AttachmentUnmarshaller}</P> 325N/A * <H4>JAXB Runtime-API (private contract)</H4> 325N/A * parameters at the time of JAXBTypeSerializer class uses all 325N/A * <LI><P>{@link com.sun.xml.internal.bind.api.Bridge#marshal(BridgeContext, Object, XMLStreamWriter) Bridge.marshal(BridgeContext, Object, XMLStreamWriter)}</P> 325N/A * <LI><P>{@link com.sun.xml.internal.bind.api.Bridge#marshal(BridgeContext, Object, Node) Bridge.marshal(BridgeContext, Object, Node)}</P> 325N/A * <LI><P>{@link com.sun.xml.internal.bind.api.Bridge#unmarshal(BridgeContext, XMLStreamReader) Object Bridge.unmarshal(BridgeContext, XMLStreamReader)}</P> 325N/A * @ArchitectureDocument