View Javadoc
1   /*
2    * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
3    * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4    *
5    * This code is free software; you can redistribute it and/or modify it
6    * under the terms of the GNU General Public License version 2 only, as
7    * published by the Free Software Foundation.  Oracle designates this
8    * particular file as subject to the "Classpath" exception as provided
9    * by Oracle in the LICENSE file that accompanied this code.
10   *
11   * This code is distributed in the hope that it will be useful, but WITHOUT
12   * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13   * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
14   * version 2 for more details (a copy is included in the LICENSE file that
15   * accompanied this code).
16   *
17   * You should have received a copy of the GNU General Public License version
18   * 2 along with this work; if not, write to the Free Software Foundation,
19   * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20   *
21   * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22   * or visit www.oracle.com if you need additional information or have any
23   * questions.
24   */
25  
26  package com.sun.xml.internal.ws.api.model.wsdl;
27  
28  import com.sun.istack.internal.NotNull;
29  import com.sun.istack.internal.Nullable;
30  import com.sun.xml.internal.ws.api.BindingID;
31  import com.sun.xml.internal.ws.api.message.Message;
32  import com.sun.xml.internal.ws.api.model.ParameterBinding;
33  
34  import javax.jws.WebParam.Mode;
35  import javax.jws.soap.SOAPBinding;
36  import javax.xml.namespace.QName;
37  
38  /**
39   * {@link WSDLPortType} bound with a specific binding.
40   *
41   * @author Vivek Pandey
42   */
43  public interface WSDLBoundPortType extends WSDLFeaturedObject, WSDLExtensible {
44      /**
45       * Gets the name of the wsdl:binding@name attribute value as local name and wsdl:definitions@targetNamespace
46       * as the namespace uri.
47       */
48      QName getName();
49  
50      /**
51       * Gets the {@link WSDLModel} that owns this port type.
52       */
53      @NotNull WSDLModel getOwner();
54  
55      /**
56       * Gets the {@link WSDLBoundOperation} for a given operation name
57       *
58       * @param operationName non-null operationName
59       * @return null if a {@link WSDLBoundOperation} is not found
60       */
61      public WSDLBoundOperation get(QName operationName);
62  
63      /**
64       * Gets the wsdl:binding@type value, same as {@link WSDLPortType#getName()}
65       */
66      QName getPortTypeName();
67  
68      /**
69       * Gets the {@link WSDLPortType} associated with the wsdl:binding
70       */
71      WSDLPortType getPortType();
72  
73      /**
74       * Gets the {@link WSDLBoundOperation}s
75       */
76      Iterable<? extends WSDLBoundOperation> getBindingOperations();
77  
78      /**
79       * Is this a document style or RPC style?
80       *
81       * Since we only support literal and not encoding, this means
82       * either doc/lit or rpc/lit.
83       */
84      @NotNull SOAPBinding.Style getStyle();
85  
86      /**
87       * Returns the binding ID.
88       * This would typically determined by the binding extension elements in wsdl:binding.
89       */
90      BindingID getBindingId();
91  
92      /**
93       * Gets the bound operation in this port for a tag name. Here the operation would be the one whose
94       * input part descriptor bound to soap:body is same as the tag name except for rpclit where the tag
95       * name would be {@link WSDLBoundOperation#getName()}.
96       *
97       * <p>
98       * If you have a {@link Message} and trying to figure out which operation it belongs to,
99       * always use {@link Message#getOperation}, as that performs better.
100      *
101      * <p>
102      * For example this can be used in the case when a message receipient can get the
103      * {@link WSDLBoundOperation} from the payload tag name.
104      *
105      * <p>
106      * namespaceUri and the local name both can be null to get the WSDLBoundOperation that has empty body -
107      * there is no payload. According to BP 1.1 in a port there can be at MOST one operation with empty body.
108      * Its an error to have namespace URI non-null but local name as null.
109      *
110      * @param namespaceUri namespace of the payload element.
111      * @param localName local name of the payload
112      * @throws NullPointerException if localName is null and namespaceUri is not.
113      * @return
114      *      null if no operation with the given tag name is found.
115      */
116     @Nullable WSDLBoundOperation getOperation(String namespaceUri, String localName);
117 
118     /**
119      * Gets the {@link ParameterBinding} for a given operation, part name and the direction - IN/OUT
120      *
121      * @param operation wsdl:operation@name value. Must be non-null.
122      * @param part      wsdl:part@name such as value of soap:header@part. Must be non-null.
123      * @param mode      {@link Mode#IN} or {@link Mode#OUT}. Must be non-null.
124      * @return null if the binding could not be resolved for the part.
125      */
126     ParameterBinding getBinding(QName operation, String part, Mode mode);
127 }