Tue, 09 Apr 2013 14:51:13 +0100
8010393: Update JAX-WS RI to 2.2.9-b12941
Reviewed-by: alanb, erikj
Contributed-by: miroslav.kos@oracle.com, martin.grebac@oracle.com
ohair@286 | 1 | /* |
alanb@368 | 2 | * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. |
ohair@286 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
ohair@286 | 4 | * |
ohair@286 | 5 | * This code is free software; you can redistribute it and/or modify it |
ohair@286 | 6 | * under the terms of the GNU General Public License version 2 only, as |
ohair@286 | 7 | * published by the Free Software Foundation. Oracle designates this |
ohair@286 | 8 | * particular file as subject to the "Classpath" exception as provided |
ohair@286 | 9 | * by Oracle in the LICENSE file that accompanied this code. |
ohair@286 | 10 | * |
ohair@286 | 11 | * This code is distributed in the hope that it will be useful, but WITHOUT |
ohair@286 | 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
ohair@286 | 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
ohair@286 | 14 | * version 2 for more details (a copy is included in the LICENSE file that |
ohair@286 | 15 | * accompanied this code). |
ohair@286 | 16 | * |
ohair@286 | 17 | * You should have received a copy of the GNU General Public License version |
ohair@286 | 18 | * 2 along with this work; if not, write to the Free Software Foundation, |
ohair@286 | 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
ohair@286 | 20 | * |
ohair@286 | 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
ohair@286 | 22 | * or visit www.oracle.com if you need additional information or have any |
ohair@286 | 23 | * questions. |
ohair@286 | 24 | */ |
ohair@286 | 25 | |
ohair@286 | 26 | /** |
ohair@286 | 27 | * <h1>JAX-WS 2.0.1 Server Runtime</h1> |
ohair@286 | 28 | * <P>This document describes the architecture of server side |
ohair@286 | 29 | * JAX-WS 2.0.1 runtime. </p> |
ohair@286 | 30 | * |
ohair@286 | 31 | * <h3>JAX-WS 2.0.1 Server Runtime Sequence Diagram</h3> |
ohair@286 | 32 | |
ohair@286 | 33 | * <img src='../../../../../jaxws/basic-server.seq.png'> |
ohair@286 | 34 | |
ohair@286 | 35 | * |
ohair@286 | 36 | * |
ohair@286 | 37 | * <H3>Message Flow</H3> |
ohair@286 | 38 | * <P>A Web Service invocation starts with either the |
ohair@286 | 39 | * {@link com.sun.xml.internal.ws.transport.http.servlet.WSServletDelegate WSServletDelegate} |
ohair@286 | 40 | * or the {@link com.sun.xml.internal.ws.transport.http.server.ServerConnectionImpl ServerConnectionImpl}. |
ohair@286 | 41 | * Both of these classes find the appropriate {@link com.sun.xml.internal.ws.server.RuntimeEndpointInfo RuntimeEndpointInfo} |
ohair@286 | 42 | * and invokes the {@link com.sun.xml.internal.ws.server.Tie#handle(com.sun.xml.internal.ws.api.server.WSConnection, |
ohair@286 | 43 | * com.sun.xml.internal.ws.spi.runtime.RuntimeEndpointInfo) Tie.handle} |
ohair@286 | 44 | * method. This method first creates a {@link com.sun.pept.ept.MessageInfo MessageInfo} |
ohair@286 | 45 | * used to gather inforrmation about the message to be received. A |
ohair@286 | 46 | * {@link com.sun.xml.internal.ws.server.RuntimeContext RuntimeContext} |
ohair@286 | 47 | * is then created with the MessageInfo and the {@link com.sun.xml.internal.ws.api.model.SEIModel RuntimeModel} |
ohair@286 | 48 | * retrieved from the RuntimeEndpointInfo. The RuntimeContext is then |
ohair@286 | 49 | * stored in the MessageInfo. The {@link com.sun.pept.ept.EPTFactory EPTFactory} |
ohair@286 | 50 | * is retrieved from the {@link com.sun.xml.internal.ws.server.EPTFactoryFactoryBase EPTFactoryFactoryBase} |
ohair@286 | 51 | * and also placed in the MessagInfo. A {@link com.sun.pept.protocol.MessageDispatcher MessageDispatcher} |
ohair@286 | 52 | * is then created and the receive method is invoked. There will be two |
ohair@286 | 53 | * types of MessageDispatchers for JAX-WS 2.0.1, SOAPMessageDispatcher |
ohair@286 | 54 | * (one for client and one for the server) and an XMLMessageDispatcher |
ohair@286 | 55 | * (one for the client and one for the server).</P> |
ohair@286 | 56 | * <P>The MessageDispatcher.receive method orchestrates the receiving of |
ohair@286 | 57 | * a Message. The SOAPMessageDispatcher first converts the MessageInfo |
ohair@286 | 58 | * to a SOAPMessage. The SOAPMessageDispatcher then does mustUnderstand |
ohair@286 | 59 | * processing followed by an invocation of any handlers. The SOAPMessage |
ohair@286 | 60 | * is then converted to an InternalMessage and stored in the |
ohair@286 | 61 | * MessageInfo. The converting of the SOAPMessage to an InternalMessage |
ohair@286 | 62 | * is done using the decoder retrieved from the EPTFactory that is |
ohair@286 | 63 | * contained in the MessageInfo. Once the SOAPMessage has been converted |
ohair@286 | 64 | * to an InternalMessage the endpoint implementation is invoked via |
ohair@286 | 65 | * reflection from the Method stored in the MessageInfo. The return |
ohair@286 | 66 | * value of the method call is then stored in the InternalMessage. An |
ohair@286 | 67 | * internalMessage is then created from the MessageInfo. The SOAPEncoder |
ohair@286 | 68 | * is retrieved from the EPTFactory stored in the MessageInfo. The |
ohair@286 | 69 | * SOAPEncoder.toSOAPMessage is then invoked to create a SOAPMessage |
ohair@286 | 70 | * from the InternalMessage. A WSConnection is then retrieved from the |
ohair@286 | 71 | * MessageInfo and the SOAPMessage is returned over that WSConnection.</P> |
ohair@286 | 72 | * <P><BR> |
ohair@286 | 73 | * </P> |
ohair@286 | 74 | * <H3>External Interactions</H3> |
ohair@286 | 75 | * <H4>SAAJ API</H4> |
ohair@286 | 76 | * <UL> |
ohair@286 | 77 | * <LI><P>JAX-WS creates SAAJ javax.xml.soap.SOAPMessage |
ohair@286 | 78 | * from the HttpServletRequest. |
ohair@286 | 79 | * At present, JAX-WS reads all the bytes from the request stream and |
ohair@286 | 80 | * then creates SOAPMessage along with the HTTP headers.</P> |
ohair@286 | 81 | * </UL> |
ohair@286 | 82 | * <P>javax.xml.soap.MessageFactory(binding).createMessage(MimeHeaders, InputStream)</P> |
ohair@286 | 83 | * <UL> |
ohair@286 | 84 | * <LI><P>SOAPMessage parses the content from the stream including MIME |
ohair@286 | 85 | * data</P> |
ohair@286 | 86 | * <LI><P>com.sun.xml.internal.ws.server.SOAPMessageDispatcher::checkHeadersPeekBody()</P> |
ohair@286 | 87 | * <P>SOAPMessage.getSOAPHeader() is used for mustUnderstand processing |
ohair@286 | 88 | * of headers. It further uses |
ohair@286 | 89 | * javax.xml.soap.SOAPHeader.examineMustUnderstandHeaderElements(role)</P> |
ohair@286 | 90 | * <P>SOAPMessage.getSOAPBody().getFistChild() is used for guessing the |
ohair@286 | 91 | * MEP of the request</P> |
ohair@286 | 92 | * <LI><P>com.sun.xml.internal.ws.handler.HandlerChainCaller:insertFaultMessage()</P> |
ohair@286 | 93 | * <P>SOAPMessage.getSOAPPart().getEnvelope() and some other SAAJ calls |
ohair@286 | 94 | * are made to create a fault in the SOAPMessage</P> |
ohair@286 | 95 | * <LI><P>com.sun.xml.internal.ws.handler.LogicalMessageImpl::getPayload() |
ohair@286 | 96 | * interacts with SAAJ to get body from SOAPMessage</P> |
ohair@286 | 97 | * <LI><P>com.sun.xml.internal.ws.encoding.soap.SOAPEncoder.toSOAPMessage(com.sun.xml.internal.ws.encoding.soap.internal.InternalMessage, |
ohair@286 | 98 | * SOAPMessage). There is a scenario where there is SOAPMessage and a |
ohair@286 | 99 | * logical handler sets payload as Source. To write to the stream, |
ohair@286 | 100 | * SOAPMessage.writeTo() is used but before that the body needs to be |
ohair@286 | 101 | * updated with logical handler' Source. Need to verify if this |
ohair@286 | 102 | * scenario is still happening since Handler.close() is changed to take |
ohair@286 | 103 | * MessageContext.</P> |
ohair@286 | 104 | * <LI><P>com.sun.xml.internal.ws.handlerSOAPMessageContextImpl.getHeaders() |
ohair@286 | 105 | * uses SAAJ API to get headers.</P> |
ohair@286 | 106 | * <LI><P>SOAPMessage.writeTo() is used to write response. At present, |
ohair@286 | 107 | * it writes into byte[] and this byte[] is written to |
ohair@286 | 108 | * HttpServletResponse.</P> |
ohair@286 | 109 | * </UL> |
ohair@286 | 110 | * <H4>JAXB API</H4> |
ohair@286 | 111 | * <P>JAX-WS RI uses the JAXB API to marshall/unmarshall user created |
ohair@286 | 112 | * JAXB objects with user created {@link javax.xml.bind.JAXBContext JAXBContext}. |
ohair@286 | 113 | * Handler, Dispatch in JAX-WS API provide ways for the user to specify his/her own |
ohair@286 | 114 | * JAXBContext. {@link com.sun.xml.internal.ws.encoding.jaxb.JAXBTypeSerializer JAXBTypeSerializer} class uses all these methods.</P> |
ohair@286 | 115 | * <UL> |
ohair@286 | 116 | * <LI><p>{@link javax.xml.bind.Marshaller#marshal(Object,XMLStreamWriter) Marshaller.marshal(Object,XMLStreamWriter)}</p> |
ohair@286 | 117 | * <LI><P>{@link javax.xml.bind.Marshaller#marshal(Object,Result) Marshaller.marshal(Object, DomResult)}</P> |
ohair@286 | 118 | * <LI><P>{@link javax.xml.bind.Unmarshaller#unmarshal(XMLStreamReader) Object Unmarshaller.unmarshal(XMLStreamReader)}</P> |
ohair@286 | 119 | * <LI><P>{@link javax.xml.bind.Unmarshaller#unmarshal(Source) Object Unmarshaller.unmarshal(Source)}</P> |
ohair@286 | 120 | * </UL> |
ohair@286 | 121 | * The following two JAXB classes are implemented by JAX-WS to enable/implement MTOM and XOP |
ohair@286 | 122 | * <UL> |
ohair@286 | 123 | * <LI><P>{@link javax.xml.bind.attachment.AttachmentMarshaller AttachmentMarshaller}</P> |
ohair@286 | 124 | * <LI><P>{@link javax.xml.bind.attachment.AttachmentUnmarshaller AttachmentUnmarshaller}</P> |
ohair@286 | 125 | * </UL> |
ohair@286 | 126 | * <H4>JAXB Runtime-API (private contract)</H4> |
ohair@286 | 127 | * <P>JAX-WS RI uses these private API for serialization/deserialization |
ohair@286 | 128 | * purposes. This private API is used to serialize/deserialize method |
ohair@286 | 129 | * parameters at the time of JAXBTypeSerializer class uses all |
ohair@286 | 130 | * these methods.</P> |
ohair@286 | 131 | * <UL> |
ohair@286 | 132 | * <LI><P>{@link com.sun.xml.internal.bind.api.Bridge#marshal(BridgeContext, Object, XMLStreamWriter) Bridge.marshal(BridgeContext, Object, XMLStreamWriter)}</P> |
ohair@286 | 133 | * <LI><P>{@link com.sun.xml.internal.bind.api.Bridge#marshal(BridgeContext, Object, Node) Bridge.marshal(BridgeContext, Object, Node)}</P> |
ohair@286 | 134 | * <LI><P>{@link com.sun.xml.internal.bind.api.Bridge#unmarshal(BridgeContext, XMLStreamReader) Object Bridge.unmarshal(BridgeContext, XMLStreamReader)}</P> |
ohair@286 | 135 | * </UL> |
ohair@286 | 136 | * |
ohair@286 | 137 | * @ArchitectureDocument |
ohair@286 | 138 | **/ |
ohair@286 | 139 | package com.sun.xml.internal.ws.server; |
ohair@286 | 140 | |
ohair@286 | 141 | import com.sun.xml.internal.bind.api.BridgeContext; |
ohair@286 | 142 | |
ohair@286 | 143 | import javax.xml.stream.XMLStreamReader; |
ohair@286 | 144 | import javax.xml.stream.XMLStreamWriter; |
ohair@286 | 145 | import javax.xml.transform.Source; |
ohair@286 | 146 | import javax.xml.transform.Result; |
ohair@286 | 147 | |
ohair@286 | 148 | import org.w3c.dom.Node; |