1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/src/share/jaxws_classes/com/sun/xml/internal/ws/client/package-info.java Wed Apr 27 01:27:09 2016 +0800 1.3 @@ -0,0 +1,157 @@ 1.4 +/* 1.5 + * Copyright (c) 1997, 2012, 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 Client Runtime</h1> 1.31 + * <P>This document describes the architecture of client side 1.32 + * JAX-WS 2.0.1 runtime. 1.33 + * 1.34 + * <h3>JAX-WS 2.0.1 Client Sequence Diagram</h3> 1.35 + * <img src='../../../../../jaxws/basic-client.seq.png'> 1.36 + * <h3>JAX-WS 2.0.1 Asynchronous Invocation Sequence Diagram</h3> 1.37 + * <img src='../../../../../jaxws/client-async.seq.png'> 1.38 + * <h3>JAX-WS 2.0.1 Dispatch Invocation Sequence Diagram</h3> 1.39 + * <img src='../../../../../jaxws/dispatch.seq.png'> 1.40 + 1.41 + * <H3>Message Flow</H3> 1.42 + * {@link com.sun.xml.internal.ws.client.WebService} provides client view of a Web service. 1.43 + * WebService.getPort returns an instance of {@link com.sun.xml.internal.ws.client.EndpointIFInvocationHandler} 1.44 + * with {@link com.sun.pept.ept.ContactInfoList} and {@link com.sun.pept.Delegate} 1.45 + * initialized. A method invocation on the port, obtained from WebService, invokes 1.46 + * {@link com.sun.xml.internal.ws.client.EndpointIFInvocationHandler#invoke}. This method 1.47 + * then creates a {@link com.sun.pept.ept.MessageInfo} and populates the data 1.48 + * (parameters specified by the user) and metadata such as RuntimeContext, RequestContext, 1.49 + * Message Exchange Pattern into this MessageInfo. This method then invokes 1.50 + * {@link com.sun.pept.Delegate#send} and returns the response. 1.51 + * <P></P> 1.52 + * The Delegate.send method iterates through the ContactInfoList and picks up the 1.53 + * correct {@link com.sun.pept.ept.ContactInfo} based upon the binding id of 1.54 + * {@link javax.xml.ws.BindingProvider} and sets it on the MessageInfo. After the 1.55 + * Delegate obtains a specific ContactInfo it uses that ContactInfo to obtain a 1.56 + * protocol-specific {@link com.sun.pept.protocol.MessageDispatcher}. There will be 1.57 + * two types of client-side MessageDispatchers for JAX-WS 2.0.1, 1.58 + * {@link com.sun.xml.internal.ws.protocol.soap.client.SOAPMessageDispatcher} and 1.59 + * {@link com.sun.xml.internal.ws.protocol.xml.client.XMLMessageDispatcher}. The Delegate 1.60 + * then invokes {@link com.sun.pept.protocol.MessageDispatcher#send}. The 1.61 + * MessageDispatcher.send method makes a decision about the synchronous and 1.62 + * asynchronous nature of the message exchange pattern and invokes separate methods 1.63 + * accordingly. 1.64 + * <p></P> 1.65 + * The MessageDispatcher uses ContactInfo to obtain 1.66 + * a {@link com.sun.xml.internal.ws.encoding.soap.client.SOAPXMLEncoder} which converts 1.67 + * the MessageInfo to {@link com.sun.xml.internal.ws.encoding.soap.internal.InternalMessage}. 1.68 + * There will be two types of client-side SOAPXMLEncoder for JAX-WS 2.0.1, 1.69 + * SOAPXMEncoder for SOAP 1.1 and {@link com.sun.xml.internal.ws.encoding.soap.client.SOAP12XMLEncoder} 1.70 + * for SOAP 1.2. The MessageDispatcher invokes configured handlers and use the 1.71 + * codec to convert the InternalMessage to a {@link javax.xml.soap.SOAPMessage}. 1.72 + * The metadata from the MessageInfo is classified into {@link javax.xml.soap.MimeHeaders} 1.73 + * of this SOAPMessage and context information for {@link com.sun.xml.internal.ws.api.server.WSConnection}. 1.74 + * The SOAPMessge is then written to the output stream of the WSConnection 1.75 + * obtained from MessageInfo. 1.76 + *<P></P> 1.77 + * The MessageDispatcher.receive method handles the response. The 1.78 + * SOAPMessageDispatcher extracts the SOAPMessage from the input stream of 1.79 + * WSConnection and performs the mustUnderstand processing followed by invocation 1.80 + * of any handlers. The MessageDispatcher uses ContactInfo to obtain a 1.81 + * {@link com.sun.xml.internal.ws.encoding.soap.client.SOAPXMLDecoder} which converts the SOAPMessage 1.82 + * to InternalMessage and then InternalMessage to MessageInfo. There will be two types of 1.83 + * client-side SOAPXMLDecoder for JAX-WS 2.0.1, SOAPXMLDencoder for SOAP 1.1 and 1.84 + * {@link com.sun.xml.internal.ws.encoding.soap.client.SOAP12XMLDecoder} for SOAP 1.2. The 1.85 + * response is returned back to the client code via Delegate. 1.86 + * 1.87 + * <H3>External Interactions</H3> 1.88 + * <H4>SAAJ API</H4> 1.89 + * <UL> 1.90 + * <LI><P>JAX-WS creates SAAJ SOAPMessage from the HttpServletRequest. 1.91 + * At present, JAX-WS reads all the bytes from the request stream and 1.92 + * then creates SOAPMessage along with the HTTP headers.</P> 1.93 + * </UL> 1.94 + * <P>MessageFactory(binding).createMessage(MimeHeaders, InputStream)</P> 1.95 + * <UL> 1.96 + * <LI><P>SOAPMessage parses the content from the stream including MIME 1.97 + * data</P> 1.98 + * <LI><P>com.sun.xml.internal.ws.server.SOAPMessageDispatcher::checkHeadersPeekBody()</P> 1.99 + * <P>SOAPMessage.getSOAPHeader() is used for mustUnderstand processing 1.100 + * of headers. It further uses 1.101 + * SOAPHeader.examineMustUnderstandHeaderElements(role)</P> 1.102 + * <P>SOAPMessage.getSOAPBody().getFistChild() is used for guessing the 1.103 + * MEP of the request</P> 1.104 + * <LI><P>com.sun.xml.internal.ws.handler.HandlerChainCaller:insertFaultMessage()</P> 1.105 + * <P>SOAPMessage.getSOAPPart().getEnvelope() and some other SAAJ calls 1.106 + * are made to create a fault in the SOAPMessage</P> 1.107 + * <LI><P>com.sun.xml.internal.ws.handler.LogicalMessageImpl::getPayload() 1.108 + * interacts with SAAJ to get body from SOAPMessage</P> 1.109 + * <LI><P>com.sun.xml.internal.ws.encoding.soap.SOAPEncoder.toSOAPMessage(com.sun.xml.internal.ws.encoding.soap.internal.InternalMessage, 1.110 + * SOAPMessage). There is a scenario where there is SOAPMessage and a 1.111 + * logical handler sets payload as Source. To write to the stream, 1.112 + * SOAPMessage.writeTo() is used but before that the body needs to be 1.113 + * updated with logical handler' Source. Need to verify if this 1.114 + * scenario is still happening since Handler.close() is changed to take 1.115 + * MessageContext.</P> 1.116 + * <LI><P>com.sun.xml.internal.ws.handlerSOAPMessageContextImpl.getHeaders() 1.117 + * uses SAAJ API to get headers.</P> 1.118 + * <LI><P>SOAPMessage.writeTo() is used to write response. At present, 1.119 + * it writes into byte[] and this byte[] is written to 1.120 + * HttpServletResponse.</P> 1.121 + * </UL> 1.122 + * <H4>JAXB API</H4> 1.123 + * <P>JAX-WS RI uses the JAXB API to marshall/unmarshall user created 1.124 + * JAXB objects with user created {@link javax.xml.bind.JAXBContext JAXBContext}. 1.125 + * Handler, Dispatch in JAX-WS API provide ways for the user to specify his/her own 1.126 + * JAXBContext. {@link com.sun.xml.internal.ws.encoding.jaxb.JAXBTypeSerializer JAXBTypeSerializer} class uses all these methods.</P> 1.127 + * <UL> 1.128 + * <LI><p>{@link javax.xml.bind.Marshaller#marshal(Object,XMLStreamWriter) Marshaller.marshal(Object,XMLStreamWriter)}</p> 1.129 + * <LI><P>{@link javax.xml.bind.Marshaller#marshal(Object,Result) Marshaller.marshal(Object, DomResult)}</P> 1.130 + * <LI><P>{@link javax.xml.bind.Unmarshaller#unmarshal(XMLStreamReader) Object Unmarshaller.unmarshal(XMLStreamReader)}</P> 1.131 + * <LI><P>{@link javax.xml.bind.Unmarshaller#unmarshal(Source) Object Unmarshaller.unmarshal(Source)}</P> 1.132 + * </UL> 1.133 + * The following two JAXB classes are implemented by JAX-WS to enable/implement MTOM and XOP 1.134 + * <UL> 1.135 + * <LI><P>{@link javax.xml.bind.attachment.AttachmentMarshaller AttachmentMarshaller}</P> 1.136 + * <LI><P>{@link javax.xml.bind.attachment.AttachmentUnmarshaller AttachmentUnmarshaller}</P> 1.137 + * </UL> 1.138 + * <H4>JAXB Runtime-API (private contract)</H4> 1.139 + * <P>JAX-WS RI uses these private API for serialization/deserialization 1.140 + * purposes. This private API is used to serialize/deserialize method 1.141 + * parameters at the time of JAXBTypeSerializer class uses all 1.142 + * these methods.</P> 1.143 + * <UL> 1.144 + * <LI><P>{@link com.sun.xml.internal.bind.api.Bridge#marshal(BridgeContext, Object, XMLStreamWriter) Bridge.marshal(BridgeContext, Object, XMLStreamWriter)}</P> 1.145 + * <LI><P>{@link com.sun.xml.internal.bind.api.Bridge#marshal(BridgeContext, Object, Node) Bridge.marshal(BridgeContext, Object, Node)}</P> 1.146 + * <LI><P>{@link com.sun.xml.internal.bind.api.Bridge#unmarshal(BridgeContext, XMLStreamReader) Object Bridge.unmarshal(BridgeContext, XMLStreamReader)}</P> 1.147 + * </UL> 1.148 + * 1.149 + * @ArchitectureDocument 1.150 + **/ 1.151 +package com.sun.xml.internal.ws.client; 1.152 + 1.153 +import com.sun.xml.internal.bind.api.BridgeContext; 1.154 + 1.155 +import javax.xml.transform.Result; 1.156 +import javax.xml.transform.Source; 1.157 +import javax.xml.stream.XMLStreamReader; 1.158 +import javax.xml.stream.XMLStreamWriter; 1.159 + 1.160 +import org.w3c.dom.Node;