src/share/jaxws_classes/com/sun/xml/internal/ws/client/package-info.java

Fri, 14 Feb 2014 11:13:45 +0100

author
mkos
date
Fri, 14 Feb 2014 11:13:45 +0100
changeset 515
6cd506508147
parent 368
0989ad8c0860
child 637
9c07ef4934dd
permissions
-rw-r--r--

8026188: Enhance envelope factory
Summary: Avoiding caching data initialized via TCCL in static context; fix also reviewed by Alexander Fomin
Reviewed-by: ahgross, mgrebac, skoivu

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 Client Runtime</h1>
ohair@286 28 * <P>This document describes the architecture of client side
ohair@286 29 * JAX-WS 2.0.1 runtime.
ohair@286 30 *
ohair@286 31 * <h3>JAX-WS 2.0.1 Client Sequence Diagram</h3>
ohair@286 32 * <img src='../../../../../jaxws/basic-client.seq.png'>
ohair@286 33 * <h3>JAX-WS 2.0.1 Asynchronous Invocation Sequence Diagram</h3>
ohair@286 34 * <img src='../../../../../jaxws/client-async.seq.png'>
ohair@286 35 * <h3>JAX-WS 2.0.1 Dispatch Invocation Sequence Diagram</h3>
ohair@286 36 * <img src='../../../../../jaxws/dispatch.seq.png'>
ohair@286 37
ohair@286 38 * <H3>Message Flow</H3>
ohair@286 39 * {@link com.sun.xml.internal.ws.client.WebService} provides client view of a Web service.
ohair@286 40 * WebService.getPort returns an instance of {@link com.sun.xml.internal.ws.client.EndpointIFInvocationHandler}
ohair@286 41 * with {@link com.sun.pept.ept.ContactInfoList} and {@link com.sun.pept.Delegate}
ohair@286 42 * initialized. A method invocation on the port, obtained from WebService, invokes
ohair@286 43 * {@link com.sun.xml.internal.ws.client.EndpointIFInvocationHandler#invoke}. This method
ohair@286 44 * then creates a {@link com.sun.pept.ept.MessageInfo} and populates the data
ohair@286 45 * (parameters specified by the user) and metadata such as RuntimeContext, RequestContext,
ohair@286 46 * Message Exchange Pattern into this MessageInfo. This method then invokes
ohair@286 47 * {@link com.sun.pept.Delegate#send} and returns the response.
ohair@286 48 * <P></P>
ohair@286 49 * The Delegate.send method iterates through the ContactInfoList and picks up the
ohair@286 50 * correct {@link com.sun.pept.ept.ContactInfo} based upon the binding id of
ohair@286 51 * {@link javax.xml.ws.BindingProvider} and sets it on the MessageInfo. After the
ohair@286 52 * Delegate obtains a specific ContactInfo it uses that ContactInfo to obtain a
ohair@286 53 * protocol-specific {@link com.sun.pept.protocol.MessageDispatcher}. There will be
ohair@286 54 * two types of client-side MessageDispatchers for JAX-WS 2.0.1,
ohair@286 55 * {@link com.sun.xml.internal.ws.protocol.soap.client.SOAPMessageDispatcher} and
ohair@286 56 * {@link com.sun.xml.internal.ws.protocol.xml.client.XMLMessageDispatcher}. The Delegate
ohair@286 57 * then invokes {@link com.sun.pept.protocol.MessageDispatcher#send}. The
ohair@286 58 * MessageDispatcher.send method makes a decision about the synchronous and
ohair@286 59 * asynchronous nature of the message exchange pattern and invokes separate methods
ohair@286 60 * accordingly.
ohair@286 61 * <p></P>
ohair@286 62 * The MessageDispatcher uses ContactInfo to obtain
ohair@286 63 * a {@link com.sun.xml.internal.ws.encoding.soap.client.SOAPXMLEncoder} which converts
ohair@286 64 * the MessageInfo to {@link com.sun.xml.internal.ws.encoding.soap.internal.InternalMessage}.
ohair@286 65 * There will be two types of client-side SOAPXMLEncoder for JAX-WS 2.0.1,
ohair@286 66 * SOAPXMEncoder for SOAP 1.1 and {@link com.sun.xml.internal.ws.encoding.soap.client.SOAP12XMLEncoder}
ohair@286 67 * for SOAP 1.2. The MessageDispatcher invokes configured handlers and use the
ohair@286 68 * codec to convert the InternalMessage to a {@link javax.xml.soap.SOAPMessage}.
ohair@286 69 * The metadata from the MessageInfo is classified into {@link javax.xml.soap.MimeHeaders}
ohair@286 70 * of this SOAPMessage and context information for {@link com.sun.xml.internal.ws.api.server.WSConnection}.
ohair@286 71 * The SOAPMessge is then written to the output stream of the WSConnection
ohair@286 72 * obtained from MessageInfo.
ohair@286 73 *<P></P>
ohair@286 74 * The MessageDispatcher.receive method handles the response. The
ohair@286 75 * SOAPMessageDispatcher extracts the SOAPMessage from the input stream of
ohair@286 76 * WSConnection and performs the mustUnderstand processing followed by invocation
ohair@286 77 * of any handlers. The MessageDispatcher uses ContactInfo to obtain a
ohair@286 78 * {@link com.sun.xml.internal.ws.encoding.soap.client.SOAPXMLDecoder} which converts the SOAPMessage
ohair@286 79 * to InternalMessage and then InternalMessage to MessageInfo. There will be two types of
ohair@286 80 * client-side SOAPXMLDecoder for JAX-WS 2.0.1, SOAPXMLDencoder for SOAP 1.1 and
ohair@286 81 * {@link com.sun.xml.internal.ws.encoding.soap.client.SOAP12XMLDecoder} for SOAP 1.2. The
ohair@286 82 * response is returned back to the client code via Delegate.
ohair@286 83 *
ohair@286 84 * <H3>External Interactions</H3>
ohair@286 85 * <H4>SAAJ API</H4>
ohair@286 86 * <UL>
ohair@286 87 * <LI><P>JAX-WS creates SAAJ SOAPMessage from the HttpServletRequest.
ohair@286 88 * At present, JAX-WS reads all the bytes from the request stream and
ohair@286 89 * then creates SOAPMessage along with the HTTP headers.</P>
ohair@286 90 * </UL>
ohair@286 91 * <P>MessageFactory(binding).createMessage(MimeHeaders, InputStream)</P>
ohair@286 92 * <UL>
ohair@286 93 * <LI><P>SOAPMessage parses the content from the stream including MIME
ohair@286 94 * data</P>
ohair@286 95 * <LI><P>com.sun.xml.internal.ws.server.SOAPMessageDispatcher::checkHeadersPeekBody()</P>
ohair@286 96 * <P>SOAPMessage.getSOAPHeader() is used for mustUnderstand processing
ohair@286 97 * of headers. It further uses
ohair@286 98 * SOAPHeader.examineMustUnderstandHeaderElements(role)</P>
ohair@286 99 * <P>SOAPMessage.getSOAPBody().getFistChild() is used for guessing the
ohair@286 100 * MEP of the request</P>
ohair@286 101 * <LI><P>com.sun.xml.internal.ws.handler.HandlerChainCaller:insertFaultMessage()</P>
ohair@286 102 * <P>SOAPMessage.getSOAPPart().getEnvelope() and some other SAAJ calls
ohair@286 103 * are made to create a fault in the SOAPMessage</P>
ohair@286 104 * <LI><P>com.sun.xml.internal.ws.handler.LogicalMessageImpl::getPayload()
ohair@286 105 * interacts with SAAJ to get body from SOAPMessage</P>
ohair@286 106 * <LI><P>com.sun.xml.internal.ws.encoding.soap.SOAPEncoder.toSOAPMessage(com.sun.xml.internal.ws.encoding.soap.internal.InternalMessage,
ohair@286 107 * SOAPMessage). There is a scenario where there is SOAPMessage and a
ohair@286 108 * logical handler sets payload as Source. To write to the stream,
ohair@286 109 * SOAPMessage.writeTo() is used but before that the body needs to be
ohair@286 110 * updated with logical handler' Source. Need to verify if this
ohair@286 111 * scenario is still happening since Handler.close() is changed to take
ohair@286 112 * MessageContext.</P>
ohair@286 113 * <LI><P>com.sun.xml.internal.ws.handlerSOAPMessageContextImpl.getHeaders()
ohair@286 114 * uses SAAJ API to get headers.</P>
ohair@286 115 * <LI><P>SOAPMessage.writeTo() is used to write response. At present,
ohair@286 116 * it writes into byte[] and this byte[] is written to
ohair@286 117 * HttpServletResponse.</P>
ohair@286 118 * </UL>
ohair@286 119 * <H4>JAXB API</H4>
ohair@286 120 * <P>JAX-WS RI uses the JAXB API to marshall/unmarshall user created
ohair@286 121 * JAXB objects with user created {@link javax.xml.bind.JAXBContext JAXBContext}.
ohair@286 122 * Handler, Dispatch in JAX-WS API provide ways for the user to specify his/her own
ohair@286 123 * JAXBContext. {@link com.sun.xml.internal.ws.encoding.jaxb.JAXBTypeSerializer JAXBTypeSerializer} class uses all these methods.</P>
ohair@286 124 * <UL>
ohair@286 125 * <LI><p>{@link javax.xml.bind.Marshaller#marshal(Object,XMLStreamWriter) Marshaller.marshal(Object,XMLStreamWriter)}</p>
ohair@286 126 * <LI><P>{@link javax.xml.bind.Marshaller#marshal(Object,Result) Marshaller.marshal(Object, DomResult)}</P>
ohair@286 127 * <LI><P>{@link javax.xml.bind.Unmarshaller#unmarshal(XMLStreamReader) Object Unmarshaller.unmarshal(XMLStreamReader)}</P>
ohair@286 128 * <LI><P>{@link javax.xml.bind.Unmarshaller#unmarshal(Source) Object Unmarshaller.unmarshal(Source)}</P>
ohair@286 129 * </UL>
ohair@286 130 * The following two JAXB classes are implemented by JAX-WS to enable/implement MTOM and XOP
ohair@286 131 * <UL>
ohair@286 132 * <LI><P>{@link javax.xml.bind.attachment.AttachmentMarshaller AttachmentMarshaller}</P>
ohair@286 133 * <LI><P>{@link javax.xml.bind.attachment.AttachmentUnmarshaller AttachmentUnmarshaller}</P>
ohair@286 134 * </UL>
ohair@286 135 * <H4>JAXB Runtime-API (private contract)</H4>
ohair@286 136 * <P>JAX-WS RI uses these private API for serialization/deserialization
ohair@286 137 * purposes. This private API is used to serialize/deserialize method
ohair@286 138 * parameters at the time of JAXBTypeSerializer class uses all
ohair@286 139 * these methods.</P>
ohair@286 140 * <UL>
ohair@286 141 * <LI><P>{@link com.sun.xml.internal.bind.api.Bridge#marshal(BridgeContext, Object, XMLStreamWriter) Bridge.marshal(BridgeContext, Object, XMLStreamWriter)}</P>
ohair@286 142 * <LI><P>{@link com.sun.xml.internal.bind.api.Bridge#marshal(BridgeContext, Object, Node) Bridge.marshal(BridgeContext, Object, Node)}</P>
ohair@286 143 * <LI><P>{@link com.sun.xml.internal.bind.api.Bridge#unmarshal(BridgeContext, XMLStreamReader) Object Bridge.unmarshal(BridgeContext, XMLStreamReader)}</P>
ohair@286 144 * </UL>
ohair@286 145 *
ohair@286 146 * @ArchitectureDocument
ohair@286 147 **/
ohair@286 148 package com.sun.xml.internal.ws.client;
ohair@286 149
ohair@286 150 import com.sun.xml.internal.bind.api.BridgeContext;
ohair@286 151
ohair@286 152 import javax.xml.transform.Result;
ohair@286 153 import javax.xml.transform.Source;
ohair@286 154 import javax.xml.stream.XMLStreamReader;
ohair@286 155 import javax.xml.stream.XMLStreamWriter;
ohair@286 156
ohair@286 157 import org.w3c.dom.Node;

mercurial