001 /*
002 * Licensed to the Apache Software Foundation (ASF) under one or more
003 * contributor license agreements. See the NOTICE file distributed with
004 * this work for additional information regarding copyright ownership.
005 * The ASF licenses this file to You under the Apache License, Version 2.0
006 * (the "License"); you may not use this file except in compliance with
007 * the License. You may obtain a copy of the License at
008 *
009 * http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the License for the specific language governing permissions and
015 * limitations under the License.
016 */
017 package org.apache.servicemix.soap.bindings.soap;
018
019 import javax.xml.namespace.QName;
020
021 /**
022 * Represents the SOAP 1.2 version
023 *
024 * @version $Revision: 437862 $
025 */
026 public class Soap12 implements SoapVersion {
027
028 public static final String SOAP_NAMESPACE = SoapConstants.SOAP_12_URI;
029
030 public static final String SOAP_DEFAULT_PREFIX = "soap";
031
032 private static final Soap12 INSTANCE = new Soap12(SOAP_DEFAULT_PREFIX);
033
034 private final double version = 1.2;
035
036 private final String namespace = SOAP_NAMESPACE;
037
038 private final String prefix;
039
040 private final String noneRole = namespace + "/role/none";
041
042 private final String ultimateReceiverRole = namespace + "/role/ultimateReceiver";
043
044 private final String nextRole = namespace + "/role/next";
045
046
047 private final String soapEncodingStyle = "http://www.w3.org/2003/05/soap-encoding";
048
049 private final QName envelope;
050
051 private final QName header;
052
053 private final QName body;
054
055 private final QName fault;
056
057 public static Soap12 getInstance() {
058 return INSTANCE;
059 }
060
061 public Soap12(String prefix) {
062 this.prefix = prefix;
063 envelope = new QName(namespace, "Envelope", prefix);
064 header = new QName(namespace, "Header", prefix);
065 body = new QName(namespace, "Body", prefix);
066 fault = new QName(namespace, "Fault", prefix);
067 }
068
069 public String getSoapMimeType() {
070 return "application/soap+xml; charset=utf-8";
071 }
072
073 public double getVersion() {
074 return version;
075 }
076
077 public String getNamespace() {
078 return namespace;
079 }
080
081 public String getPrefix() {
082 return prefix;
083 }
084
085 public QName getEnvelope() {
086 return envelope;
087 }
088
089 public QName getHeader() {
090 return header;
091 }
092
093 public QName getBody() {
094 return body;
095 }
096
097 public QName getFault() {
098 return fault;
099 }
100
101 public String getSoapEncodingStyle() {
102 return soapEncodingStyle;
103 }
104
105 // Role URIs
106 // -------------------------------------------------------------------------
107 public String getNoneRole() {
108 return noneRole;
109 }
110
111 public String getUltimateReceiverRole() {
112 return ultimateReceiverRole;
113 }
114
115 public String getNextRole() {
116 return nextRole;
117 }
118
119 public String getAttrNameRole() {
120 return "role";
121 }
122
123 public String getAttrNameMustUnderstand() {
124 return "mustUnderstand";
125 }
126
127 public SoapVersion getDerivedVersion(String prefix) {
128 return new Soap12(prefix);
129 }
130
131 }