Thu, 31 Aug 2017 15:18:52 +0800
merge
1 /*
2 * Copyright (c) 1997, 2012, 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 */
26 package com.sun.xml.internal.ws.api.model.soap;
28 import com.sun.xml.internal.ws.api.SOAPVersion;
29 import com.sun.xml.internal.ws.api.model.JavaMethod;
31 import javax.jws.soap.SOAPBinding.Style;
32 import javax.jws.soap.SOAPBinding.Use;
33 import javax.jws.WebMethod;
35 /**
36 * Models soap:binding in a WSDL document or a {@link javax.jws.soap.SOAPBinding} annotation. This
37 * can be the return of {@link JavaMethod#getBinding()}.
38 *
39 * @author Vivek Pandey
40 */
41 abstract public class SOAPBinding {
42 protected Use use = Use.LITERAL;
43 protected Style style = Style.DOCUMENT;
44 protected SOAPVersion soapVersion = SOAPVersion.SOAP_11;
45 protected String soapAction = "";
47 /**
48 * Get {@link Use} such as <code>literal</code> or <code>encoded</code>.
49 */
50 public Use getUse() {
51 return use;
52 }
54 /**
55 * Get {@link Style} - such as <code>document</code> or <code>rpc</code>.
56 */
57 public Style getStyle() {
58 return style;
59 }
61 /**
62 * Get the {@link SOAPVersion}
63 */
64 public SOAPVersion getSOAPVersion() {
65 return soapVersion;
66 }
68 /**
69 * Returns true if its document/literal
70 */
71 public boolean isDocLit() {
72 return style == Style.DOCUMENT && use == Use.LITERAL;
73 }
75 /**
76 * Returns true if this is a rpc/literal binding
77 */
78 public boolean isRpcLit() {
79 return style == Style.RPC && use == Use.LITERAL;
80 }
82 /**
83 * Value of <code>wsdl:binding/wsdl:operation/soap:operation@soapAction</code> attribute or
84 * {@link WebMethod#action()} annotation.
85 * <pre>
86 * For example:
87 * <wsdl:binding name="HelloBinding" type="tns:Hello">
88 * <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
89 * <wsdl:operation name="echoData">
90 * <soap12:operation soapAction=""/>
91 * ...
92 * </pre>
93 * It's always non-null. soap message serializer needs to generated SOAPAction HTTP header with
94 * the return of this method enclosed in quotes("").
95 *
96 * @see com.sun.xml.internal.ws.api.message.Packet#soapAction
97 */
98 public String getSOAPAction() {
99 return soapAction;
100 }
101 }