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