Fri, 04 Oct 2013 16:21:34 +0100
8025054: Update JAX-WS RI integration to 2.2.9-b130926.1035
Reviewed-by: chegar
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 | package com.sun.tools.internal.ws.wsdl.parser; |
ohair@286 | 27 | |
ohair@286 | 28 | import com.sun.tools.internal.ws.api.wsdl.TWSDLExtensible; |
ohair@286 | 29 | import com.sun.tools.internal.ws.api.wsdl.TWSDLParserContext; |
ohair@286 | 30 | import com.sun.tools.internal.ws.util.xml.XmlUtil; |
ohair@286 | 31 | import com.sun.tools.internal.ws.wsdl.document.soap.*; |
ohair@286 | 32 | import com.sun.tools.internal.ws.wsdl.framework.TWSDLParserContextImpl; |
ohair@286 | 33 | import org.w3c.dom.Element; |
ohair@286 | 34 | import org.xml.sax.Locator; |
ohair@286 | 35 | |
ohair@286 | 36 | import javax.xml.namespace.QName; |
ohair@286 | 37 | import java.util.Iterator; |
ohair@286 | 38 | import java.util.Map; |
ohair@286 | 39 | |
ohair@286 | 40 | /** |
ohair@286 | 41 | * The SOAP extension handler for WSDL. |
ohair@286 | 42 | * |
ohair@286 | 43 | * @author WS Development Team |
ohair@286 | 44 | */ |
ohair@286 | 45 | public class SOAPExtensionHandler extends AbstractExtensionHandler { |
ohair@286 | 46 | |
ohair@286 | 47 | public SOAPExtensionHandler(Map<String, AbstractExtensionHandler> extensionHandlerMap) { |
ohair@286 | 48 | super(extensionHandlerMap); |
ohair@286 | 49 | } |
ohair@286 | 50 | |
ohair@286 | 51 | public String getNamespaceURI() { |
ohair@286 | 52 | return Constants.NS_WSDL_SOAP; |
ohair@286 | 53 | } |
ohair@286 | 54 | |
ohair@286 | 55 | public boolean handleDefinitionsExtension( |
ohair@286 | 56 | TWSDLParserContext context, |
ohair@286 | 57 | TWSDLExtensible parent, |
ohair@286 | 58 | Element e) { |
ohair@286 | 59 | Util.fail( |
ohair@286 | 60 | "parsing.invalidExtensionElement", |
ohair@286 | 61 | e.getTagName(), |
ohair@286 | 62 | e.getNamespaceURI()); |
ohair@286 | 63 | return false; // keep compiler happy |
ohair@286 | 64 | } |
ohair@286 | 65 | |
ohair@286 | 66 | public boolean handleTypesExtension( |
ohair@286 | 67 | com.sun.tools.internal.ws.api.wsdl.TWSDLParserContext context, |
ohair@286 | 68 | TWSDLExtensible parent, |
ohair@286 | 69 | Element e) { |
ohair@286 | 70 | Util.fail( |
ohair@286 | 71 | "parsing.invalidExtensionElement", |
ohair@286 | 72 | e.getTagName(), |
ohair@286 | 73 | e.getNamespaceURI()); |
ohair@286 | 74 | return false; // keep compiler happy |
ohair@286 | 75 | } |
ohair@286 | 76 | |
ohair@286 | 77 | protected SOAPBinding getSOAPBinding(Locator location){ |
ohair@286 | 78 | return new SOAPBinding(location); |
ohair@286 | 79 | } |
ohair@286 | 80 | |
ohair@286 | 81 | public boolean handleBindingExtension( |
ohair@286 | 82 | TWSDLParserContext context, |
ohair@286 | 83 | TWSDLExtensible parent, |
ohair@286 | 84 | Element e) { |
ohair@286 | 85 | if (XmlUtil.matchesTagNS(e, getBindingQName())) { |
ohair@286 | 86 | context.push(); |
ohair@286 | 87 | context.registerNamespaces(e); |
ohair@286 | 88 | |
ohair@286 | 89 | SOAPBinding binding = getSOAPBinding(context.getLocation(e)); |
ohair@286 | 90 | |
ohair@286 | 91 | // NOTE - the "transport" attribute is required according to section 3.3 of the WSDL 1.1 spec, |
ohair@286 | 92 | // but optional according to the schema in appendix A 4.2 of the same document! |
ohair@286 | 93 | String transport = |
ohair@286 | 94 | Util.getRequiredAttribute(e, Constants.ATTR_TRANSPORT); |
ohair@286 | 95 | binding.setTransport(transport); |
ohair@286 | 96 | |
ohair@286 | 97 | String style = XmlUtil.getAttributeOrNull(e, Constants.ATTR_STYLE); |
ohair@286 | 98 | if (style != null) { |
ohair@286 | 99 | if (style.equals(Constants.ATTRVALUE_RPC)) { |
ohair@286 | 100 | binding.setStyle(SOAPStyle.RPC); |
ohair@286 | 101 | } else if (style.equals(Constants.ATTRVALUE_DOCUMENT)) { |
ohair@286 | 102 | binding.setStyle(SOAPStyle.DOCUMENT); |
ohair@286 | 103 | } else { |
ohair@286 | 104 | Util.fail( |
ohair@286 | 105 | "parsing.invalidAttributeValue", |
ohair@286 | 106 | Constants.ATTR_STYLE, |
ohair@286 | 107 | style); |
ohair@286 | 108 | } |
ohair@286 | 109 | } |
ohair@286 | 110 | parent.addExtension(binding); |
ohair@286 | 111 | context.pop(); |
ohair@286 | 112 | // context.fireDoneParsingEntity(getBindingQName(), binding); |
ohair@286 | 113 | return true; |
ohair@286 | 114 | } else { |
ohair@286 | 115 | Util.fail( |
ohair@286 | 116 | "parsing.invalidExtensionElement", |
ohair@286 | 117 | e.getTagName(), |
ohair@286 | 118 | e.getNamespaceURI()); |
ohair@286 | 119 | return false; // keep compiler happy |
ohair@286 | 120 | } |
ohair@286 | 121 | } |
ohair@286 | 122 | |
ohair@286 | 123 | public boolean handleOperationExtension( |
ohair@286 | 124 | TWSDLParserContext context, |
ohair@286 | 125 | TWSDLExtensible parent, |
ohair@286 | 126 | Element e) { |
ohair@286 | 127 | if (XmlUtil.matchesTagNS(e, getOperationQName())) { |
ohair@286 | 128 | context.push(); |
ohair@286 | 129 | context.registerNamespaces(e); |
ohair@286 | 130 | |
ohair@286 | 131 | SOAPOperation operation = new SOAPOperation(context.getLocation(e)); |
ohair@286 | 132 | |
ohair@286 | 133 | String soapAction = |
ohair@286 | 134 | XmlUtil.getAttributeOrNull(e, Constants.ATTR_SOAP_ACTION); |
ohair@286 | 135 | if (soapAction != null) { |
ohair@286 | 136 | operation.setSOAPAction(soapAction); |
ohair@286 | 137 | } |
ohair@286 | 138 | |
ohair@286 | 139 | String style = XmlUtil.getAttributeOrNull(e, Constants.ATTR_STYLE); |
ohair@286 | 140 | if (style != null) { |
ohair@286 | 141 | if (style.equals(Constants.ATTRVALUE_RPC)) { |
ohair@286 | 142 | operation.setStyle(SOAPStyle.RPC); |
ohair@286 | 143 | } else if (style.equals(Constants.ATTRVALUE_DOCUMENT)) { |
ohair@286 | 144 | operation.setStyle(SOAPStyle.DOCUMENT); |
ohair@286 | 145 | } else { |
ohair@286 | 146 | Util.fail( |
ohair@286 | 147 | "parsing.invalidAttributeValue", |
ohair@286 | 148 | Constants.ATTR_STYLE, |
ohair@286 | 149 | style); |
ohair@286 | 150 | } |
ohair@286 | 151 | } |
ohair@286 | 152 | parent.addExtension(operation); |
ohair@286 | 153 | context.pop(); |
ohair@286 | 154 | // context.fireDoneParsingEntity( |
ohair@286 | 155 | // getOperationQName(), |
ohair@286 | 156 | // operation); |
ohair@286 | 157 | return true; |
ohair@286 | 158 | } else { |
ohair@286 | 159 | Util.fail( |
ohair@286 | 160 | "parsing.invalidExtensionElement", |
ohair@286 | 161 | e.getTagName(), |
ohair@286 | 162 | e.getNamespaceURI()); |
ohair@286 | 163 | return false; // keep compiler happy |
ohair@286 | 164 | } |
ohair@286 | 165 | } |
ohair@286 | 166 | |
ohair@286 | 167 | public boolean handleInputExtension( |
ohair@286 | 168 | TWSDLParserContext context, |
ohair@286 | 169 | TWSDLExtensible parent, |
ohair@286 | 170 | Element e) { |
ohair@286 | 171 | return handleInputOutputExtension(context, parent, e); |
ohair@286 | 172 | } |
ohair@286 | 173 | public boolean handleOutputExtension( |
ohair@286 | 174 | TWSDLParserContext context, |
ohair@286 | 175 | TWSDLExtensible parent, |
ohair@286 | 176 | Element e) { |
ohair@286 | 177 | return handleInputOutputExtension(context, parent, e); |
ohair@286 | 178 | } |
ohair@286 | 179 | |
ohair@286 | 180 | @Override |
ohair@286 | 181 | protected boolean handleMIMEPartExtension( |
ohair@286 | 182 | TWSDLParserContext context, |
ohair@286 | 183 | TWSDLExtensible parent, |
ohair@286 | 184 | Element e) { |
ohair@286 | 185 | return handleInputOutputExtension(context, parent, e); |
ohair@286 | 186 | } |
ohair@286 | 187 | |
ohair@286 | 188 | protected boolean handleInputOutputExtension( |
ohair@286 | 189 | TWSDLParserContext contextif, |
ohair@286 | 190 | TWSDLExtensible parent, |
ohair@286 | 191 | Element e) { |
ohair@286 | 192 | TWSDLParserContextImpl context = (TWSDLParserContextImpl)contextif; |
ohair@286 | 193 | if (XmlUtil.matchesTagNS(e, getBodyQName())) { |
ohair@286 | 194 | context.push(); |
ohair@286 | 195 | context.registerNamespaces(e); |
ohair@286 | 196 | |
ohair@286 | 197 | SOAPBody body = new SOAPBody(context.getLocation(e)); |
ohair@286 | 198 | |
ohair@286 | 199 | String use = XmlUtil.getAttributeOrNull(e, Constants.ATTR_USE); |
ohair@286 | 200 | if (use != null) { |
ohair@286 | 201 | if (use.equals(Constants.ATTRVALUE_LITERAL)) { |
ohair@286 | 202 | body.setUse(SOAPUse.LITERAL); |
ohair@286 | 203 | } else if (use.equals(Constants.ATTRVALUE_ENCODED)) { |
ohair@286 | 204 | body.setUse(SOAPUse.ENCODED); |
ohair@286 | 205 | } else { |
ohair@286 | 206 | Util.fail( |
ohair@286 | 207 | "parsing.invalidAttributeValue", |
ohair@286 | 208 | Constants.ATTR_USE, |
ohair@286 | 209 | use); |
ohair@286 | 210 | } |
ohair@286 | 211 | } |
ohair@286 | 212 | |
ohair@286 | 213 | String namespace = |
ohair@286 | 214 | XmlUtil.getAttributeOrNull(e, Constants.ATTR_NAMESPACE); |
ohair@286 | 215 | if (namespace != null) { |
ohair@286 | 216 | body.setNamespace(namespace); |
ohair@286 | 217 | } |
ohair@286 | 218 | |
ohair@286 | 219 | String encodingStyle = |
ohair@286 | 220 | XmlUtil.getAttributeOrNull(e, Constants.ATTR_ENCODING_STYLE); |
ohair@286 | 221 | if (encodingStyle != null) { |
ohair@286 | 222 | body.setEncodingStyle(encodingStyle); |
ohair@286 | 223 | } |
ohair@286 | 224 | |
ohair@286 | 225 | String parts = XmlUtil.getAttributeOrNull(e, Constants.ATTR_PARTS); |
ohair@286 | 226 | if (parts != null) { |
ohair@286 | 227 | body.setParts(parts); |
ohair@286 | 228 | } |
ohair@286 | 229 | |
ohair@286 | 230 | parent.addExtension(body); |
ohair@286 | 231 | context.pop(); |
ohair@286 | 232 | // context.fireDoneParsingEntity(getBodyQName(), body); |
ohair@286 | 233 | return true; |
ohair@286 | 234 | } else if (XmlUtil.matchesTagNS(e, getHeaderQName())) { |
alanb@368 | 235 | return handleHeaderElement(parent, e, context); |
ohair@286 | 236 | } else { |
alanb@368 | 237 | Util.fail("parsing.invalidExtensionElement", e.getTagName(), e.getNamespaceURI()); |
ohair@286 | 238 | return false; // keep compiler happy |
ohair@286 | 239 | } |
ohair@286 | 240 | } |
ohair@286 | 241 | |
alanb@368 | 242 | private boolean handleHeaderElement(TWSDLExtensible parent, Element e, TWSDLParserContextImpl context) { |
alanb@368 | 243 | context.push(); |
alanb@368 | 244 | context.registerNamespaces(e); |
alanb@368 | 245 | |
alanb@368 | 246 | SOAPHeader header = new SOAPHeader(context.getLocation(e)); |
alanb@368 | 247 | |
alanb@368 | 248 | String use = XmlUtil.getAttributeOrNull(e, Constants.ATTR_USE); |
alanb@368 | 249 | if (use != null) { |
alanb@368 | 250 | if (use.equals(Constants.ATTRVALUE_LITERAL)) { |
alanb@368 | 251 | header.setUse(SOAPUse.LITERAL); |
alanb@368 | 252 | } else if (use.equals(Constants.ATTRVALUE_ENCODED)) { |
alanb@368 | 253 | header.setUse(SOAPUse.ENCODED); |
alanb@368 | 254 | } else { |
alanb@368 | 255 | Util.fail("parsing.invalidAttributeValue", Constants.ATTR_USE, use); |
alanb@368 | 256 | } |
alanb@368 | 257 | } |
alanb@368 | 258 | |
alanb@368 | 259 | String namespace = XmlUtil.getAttributeOrNull(e, Constants.ATTR_NAMESPACE); |
alanb@368 | 260 | if (namespace != null) { |
alanb@368 | 261 | header.setNamespace(namespace); |
alanb@368 | 262 | } |
alanb@368 | 263 | |
alanb@368 | 264 | String encodingStyle = XmlUtil.getAttributeOrNull(e, Constants.ATTR_ENCODING_STYLE); |
alanb@368 | 265 | if (encodingStyle != null) { |
alanb@368 | 266 | header.setEncodingStyle(encodingStyle); |
alanb@368 | 267 | } |
alanb@368 | 268 | |
alanb@368 | 269 | String part = XmlUtil.getAttributeOrNull(e, Constants.ATTR_PART); |
alanb@368 | 270 | if (part != null) { |
alanb@368 | 271 | header.setPart(part); |
alanb@368 | 272 | } |
alanb@368 | 273 | |
alanb@368 | 274 | String messageAttr = XmlUtil.getAttributeOrNull(e, Constants.ATTR_MESSAGE); |
alanb@368 | 275 | if (messageAttr != null) { |
alanb@368 | 276 | header.setMessage(context.translateQualifiedName(context.getLocation(e), messageAttr)); |
alanb@368 | 277 | } |
alanb@368 | 278 | |
alanb@368 | 279 | for (Iterator iter = XmlUtil.getAllChildren(e); iter.hasNext();) { |
alanb@368 | 280 | Element e2 = Util.nextElement(iter); |
alanb@368 | 281 | if (e2 == null) |
alanb@368 | 282 | break; |
alanb@368 | 283 | |
alanb@368 | 284 | if (XmlUtil.matchesTagNS(e2, getHeaderfaultQName())) { |
alanb@368 | 285 | handleHeaderFaultElement(e, context, header, use, e2); |
alanb@368 | 286 | } else { |
alanb@368 | 287 | Util.fail("parsing.invalidElement", e2.getTagName(), e2.getNamespaceURI()); |
alanb@368 | 288 | } |
alanb@368 | 289 | } |
alanb@368 | 290 | |
alanb@368 | 291 | parent.addExtension(header); |
alanb@368 | 292 | context.pop(); |
alanb@368 | 293 | context.fireDoneParsingEntity(getHeaderQName(), header); |
alanb@368 | 294 | return true; |
alanb@368 | 295 | } |
alanb@368 | 296 | |
alanb@368 | 297 | private void handleHeaderFaultElement(Element e, TWSDLParserContextImpl context, SOAPHeader header, String use, Element e2) { |
alanb@368 | 298 | context.push(); |
alanb@368 | 299 | context.registerNamespaces(e); |
alanb@368 | 300 | |
alanb@368 | 301 | SOAPHeaderFault headerfault = new SOAPHeaderFault(context.getLocation(e)); |
alanb@368 | 302 | |
alanb@368 | 303 | String use2 = XmlUtil.getAttributeOrNull(e2, Constants.ATTR_USE); |
alanb@368 | 304 | if (use2 != null) { |
alanb@368 | 305 | if (use2.equals(Constants.ATTRVALUE_LITERAL)) { |
alanb@368 | 306 | headerfault.setUse(SOAPUse.LITERAL); |
alanb@368 | 307 | } else if (use.equals(Constants.ATTRVALUE_ENCODED)) { |
alanb@368 | 308 | headerfault.setUse(SOAPUse.ENCODED); |
alanb@368 | 309 | } else { |
alanb@368 | 310 | Util.fail("parsing.invalidAttributeValue", Constants.ATTR_USE, use2); |
alanb@368 | 311 | } |
alanb@368 | 312 | } |
alanb@368 | 313 | |
alanb@368 | 314 | String namespace2 = XmlUtil.getAttributeOrNull(e2, Constants.ATTR_NAMESPACE); |
alanb@368 | 315 | if (namespace2 != null) { |
alanb@368 | 316 | headerfault.setNamespace(namespace2); |
alanb@368 | 317 | } |
alanb@368 | 318 | |
alanb@368 | 319 | String encodingStyle2 = XmlUtil.getAttributeOrNull(e2, Constants.ATTR_ENCODING_STYLE); |
alanb@368 | 320 | if (encodingStyle2 != null) { |
alanb@368 | 321 | headerfault.setEncodingStyle(encodingStyle2); |
alanb@368 | 322 | } |
alanb@368 | 323 | |
alanb@368 | 324 | String part2 = XmlUtil.getAttributeOrNull(e2, Constants.ATTR_PART); |
alanb@368 | 325 | if (part2 != null) { |
alanb@368 | 326 | headerfault.setPart(part2); |
alanb@368 | 327 | } |
alanb@368 | 328 | |
alanb@368 | 329 | String messageAttr2 = XmlUtil.getAttributeOrNull(e2, Constants.ATTR_MESSAGE); |
alanb@368 | 330 | if (messageAttr2 != null) { |
alanb@368 | 331 | headerfault.setMessage( |
alanb@368 | 332 | context.translateQualifiedName(context.getLocation(e2), messageAttr2)); |
alanb@368 | 333 | } |
alanb@368 | 334 | |
alanb@368 | 335 | header.add(headerfault); |
alanb@368 | 336 | context.pop(); |
alanb@368 | 337 | } |
alanb@368 | 338 | |
ohair@286 | 339 | public boolean handleFaultExtension( |
ohair@286 | 340 | TWSDLParserContext context, |
ohair@286 | 341 | TWSDLExtensible parent, |
ohair@286 | 342 | Element e) { |
ohair@286 | 343 | if (XmlUtil.matchesTagNS(e, getFaultQName())) { |
ohair@286 | 344 | context.push(); |
ohair@286 | 345 | context.registerNamespaces(e); |
ohair@286 | 346 | |
ohair@286 | 347 | SOAPFault fault = new SOAPFault(context.getLocation(e)); |
ohair@286 | 348 | |
ohair@286 | 349 | String name = XmlUtil.getAttributeOrNull(e, Constants.ATTR_NAME); |
ohair@286 | 350 | if (name != null) { |
ohair@286 | 351 | fault.setName(name); |
ohair@286 | 352 | } |
ohair@286 | 353 | |
ohair@286 | 354 | String use = XmlUtil.getAttributeOrNull(e, Constants.ATTR_USE); |
ohair@286 | 355 | if (use != null) { |
ohair@286 | 356 | if (use.equals(Constants.ATTRVALUE_LITERAL)) { |
ohair@286 | 357 | fault.setUse(SOAPUse.LITERAL); |
ohair@286 | 358 | } else if (use.equals(Constants.ATTRVALUE_ENCODED)) { |
ohair@286 | 359 | fault.setUse(SOAPUse.ENCODED); |
ohair@286 | 360 | } else { |
ohair@286 | 361 | Util.fail( |
ohair@286 | 362 | "parsing.invalidAttributeValue", |
ohair@286 | 363 | Constants.ATTR_USE, |
ohair@286 | 364 | use); |
ohair@286 | 365 | } |
ohair@286 | 366 | } |
ohair@286 | 367 | |
ohair@286 | 368 | String namespace = |
ohair@286 | 369 | XmlUtil.getAttributeOrNull(e, Constants.ATTR_NAMESPACE); |
ohair@286 | 370 | if (namespace != null) { |
ohair@286 | 371 | fault.setNamespace(namespace); |
ohair@286 | 372 | } |
ohair@286 | 373 | |
ohair@286 | 374 | String encodingStyle = |
ohair@286 | 375 | XmlUtil.getAttributeOrNull(e, Constants.ATTR_ENCODING_STYLE); |
ohair@286 | 376 | if (encodingStyle != null) { |
ohair@286 | 377 | fault.setEncodingStyle(encodingStyle); |
ohair@286 | 378 | } |
ohair@286 | 379 | |
ohair@286 | 380 | parent.addExtension(fault); |
ohair@286 | 381 | context.pop(); |
ohair@286 | 382 | // context.fireDoneParsingEntity(getFaultQName(), fault); |
ohair@286 | 383 | return true; |
alanb@368 | 384 | } else if (XmlUtil.matchesTagNS(e, getHeaderQName())) { |
alanb@368 | 385 | // although SOAP spec doesn't define meaning of this extension; it is allowed |
alanb@368 | 386 | // to be here, so we have to accept it, not fail (bug 13576977) |
alanb@368 | 387 | return handleHeaderElement(parent, e, (TWSDLParserContextImpl) context); |
ohair@286 | 388 | } else { |
ohair@286 | 389 | Util.fail( |
ohair@286 | 390 | "parsing.invalidExtensionElement", |
ohair@286 | 391 | e.getTagName(), |
ohair@286 | 392 | e.getNamespaceURI()); |
ohair@286 | 393 | return false; // keep compiler happy |
ohair@286 | 394 | } |
ohair@286 | 395 | } |
ohair@286 | 396 | |
ohair@286 | 397 | public boolean handleServiceExtension( |
ohair@286 | 398 | TWSDLParserContext context, |
ohair@286 | 399 | TWSDLExtensible parent, |
ohair@286 | 400 | Element e) { |
ohair@286 | 401 | Util.fail( |
ohair@286 | 402 | "parsing.invalidExtensionElement", |
ohair@286 | 403 | e.getTagName(), |
ohair@286 | 404 | e.getNamespaceURI()); |
ohair@286 | 405 | return false; // keep compiler happy |
ohair@286 | 406 | } |
ohair@286 | 407 | |
ohair@286 | 408 | @Override |
ohair@286 | 409 | public boolean handlePortExtension( |
ohair@286 | 410 | TWSDLParserContext context, |
ohair@286 | 411 | TWSDLExtensible parent, |
ohair@286 | 412 | Element e) { |
ohair@286 | 413 | if (XmlUtil.matchesTagNS(e, getAddressQName())) { |
ohair@286 | 414 | context.push(); |
ohair@286 | 415 | context.registerNamespaces(e); |
ohair@286 | 416 | |
ohair@286 | 417 | SOAPAddress address = new SOAPAddress(context.getLocation(e)); |
ohair@286 | 418 | |
ohair@286 | 419 | String location = |
ohair@286 | 420 | Util.getRequiredAttribute(e, Constants.ATTR_LOCATION); |
ohair@286 | 421 | address.setLocation(location); |
ohair@286 | 422 | |
ohair@286 | 423 | parent.addExtension(address); |
ohair@286 | 424 | context.pop(); |
ohair@286 | 425 | // context.fireDoneParsingEntity(getAddressQName(), address); |
ohair@286 | 426 | return true; |
ohair@286 | 427 | } else { |
ohair@286 | 428 | Util.fail( |
ohair@286 | 429 | "parsing.invalidExtensionElement", |
ohair@286 | 430 | e.getTagName(), |
ohair@286 | 431 | e.getNamespaceURI()); |
ohair@286 | 432 | return false; // keep compiler happy |
ohair@286 | 433 | } |
ohair@286 | 434 | } |
ohair@286 | 435 | |
ohair@286 | 436 | public boolean handlePortTypeExtension(TWSDLParserContext context, TWSDLExtensible parent, Element e) { |
ohair@286 | 437 | Util.fail( |
ohair@286 | 438 | "parsing.invalidExtensionElement", |
ohair@286 | 439 | e.getTagName(), |
ohair@286 | 440 | e.getNamespaceURI()); |
ohair@286 | 441 | return false; // keep compiler happy |
ohair@286 | 442 | } |
ohair@286 | 443 | |
ohair@286 | 444 | protected QName getBodyQName(){ |
ohair@286 | 445 | return SOAPConstants.QNAME_BODY; |
ohair@286 | 446 | } |
ohair@286 | 447 | |
ohair@286 | 448 | protected QName getHeaderQName(){ |
ohair@286 | 449 | return SOAPConstants.QNAME_HEADER; |
ohair@286 | 450 | } |
ohair@286 | 451 | |
ohair@286 | 452 | protected QName getHeaderfaultQName(){ |
ohair@286 | 453 | return SOAPConstants.QNAME_HEADERFAULT; |
ohair@286 | 454 | } |
ohair@286 | 455 | |
ohair@286 | 456 | protected QName getOperationQName(){ |
ohair@286 | 457 | return SOAPConstants.QNAME_OPERATION; |
ohair@286 | 458 | } |
ohair@286 | 459 | |
ohair@286 | 460 | protected QName getFaultQName(){ |
ohair@286 | 461 | return SOAPConstants.QNAME_FAULT; |
ohair@286 | 462 | } |
ohair@286 | 463 | |
ohair@286 | 464 | protected QName getAddressQName(){ |
ohair@286 | 465 | return SOAPConstants.QNAME_ADDRESS; |
ohair@286 | 466 | } |
ohair@286 | 467 | |
ohair@286 | 468 | protected QName getBindingQName(){ |
ohair@286 | 469 | return SOAPConstants.QNAME_BINDING; |
ohair@286 | 470 | } |
ohair@286 | 471 | } |