Class WSDLParserExtension
- java.lang.Object
-
- com.sun.xml.ws.api.wsdl.parser.WSDLParserExtension
-
- Direct Known Subclasses:
PolicyWSDLParserExtension,W3CAddressingWSDLParserExtension
public abstract class WSDLParserExtension extends Object
Extends the WSDL parsing process.This interface is implemented by components that build on top of the JAX-WS RI, to participate in the WSDL parsing process that happens in the runtime. This allows such components to retrieve information from WSDL extension elements, and use that later to, for example, configure
Tubes.How it works?
Each method on this interface denotes one extension point in WSDL (the place where foreign elements/attributes can be added.) A
RuntimeWSDLParserstarts parsing WSDL with a fixed set ofWSDLParserExtensions, and as it finds extension elements/attributes, it calls appropriate callback methods to provide a chance forWSDLParserExtensionto parse such an extension element.There are two kinds of callbacks.
Attribute callbacks
One is for attributes, which ends with the name
Attributes. This callback is invoked withXMLStreamReaderthat points to the start tag of the WSDL element.The callback method can read interesting attributes on it. The method must return without advancing the parser to the next token.
Element callbacks
The other callback is for extension elements, which ends with the name
Elements. When a callback is invoked,XMLStreamReaderpoints to the start tag of the extension element. The callback method can do one of the following:- Return
falsewithout movingXMLStreamReader, to indicate that the extension element isn't recognized. This allows the nextWSDLParserExtensionto see this extension element. - Parse the whole subtree rooted at the element,
move the cursor to the
XMLStreamConstants.END_ELEMENTstate, and returntrue, indicating that the extension element is consumed. No otherWSDLParserExtensions are notified of this extension.
Parsing in callback
For each callback, the corresponding WSDL model object is passed in, so that
WSDLParserExtensioncan relate what it's parsing to theWSDLModel. Most likely, extensions can parse their data into anWSDLExtension-derived classes, then useWSDLExtensibleinterface to hook them intoWSDLModel.Note that since the
WSDLModelitself is being built,WSDLParserExtensionmay not invoke any of the query methods on the WSDL model. Those references are passed just so thatWSDLParserExtensioncan hold on to those references, or putWSDLExtensibleobjects into the model, not to query it.If
WSDLParserExtensionneeds to queryWSDLModel, defer that processing untilfinished(WSDLParserExtensionContext), when it's safe to useWSDLModelcan be used safely.Also note that
WSDLParserExtensions are called in no particular order. This interface is not designed for having multipleWSDLParserExtensions parse the same extension element.Error Handling
For usability,
WSDLParserExtensions are expected to check possible errors in the extension elements that it parses. When an error is found, it may throw aWebServiceExceptionto abort the parsing of the WSDL. This exception will be propagated to the user, so it should have detailed error messages pointing at the problem.Discovery
The JAX-WS RI locates the implementation of
WSDLParserExtensions by using the standard service look up mechanism, in particular looking forMETA-INF/services/com.sun.xml.ws.api.wsdl.parser.WSDLParserExtensionTODO
As it's designed today, extensions cannot access to any of the environmental information before the parsing begins (such as what
WSServicethis WSDL is being parsed for, etc.) We might need to reconsider this aspect. The JAX-WS team waits for feedback on this topic.- Author:
- Kohsuke Kawaguchi
-
-
Constructor Summary
Constructors Constructor Description WSDLParserExtension()
-
Method Summary
-
-
-
Method Detail
-
start
public void start(WSDLParserExtensionContext context)
-
serviceAttributes
public void serviceAttributes(EditableWSDLService service, XMLStreamReader reader)
-
serviceElements
public boolean serviceElements(EditableWSDLService service, XMLStreamReader reader)
-
portAttributes
public void portAttributes(EditableWSDLPort port, XMLStreamReader reader)
-
portElements
public boolean portElements(EditableWSDLPort port, XMLStreamReader reader)
-
portTypeOperationInput
public boolean portTypeOperationInput(EditableWSDLOperation op, XMLStreamReader reader)
-
portTypeOperationOutput
public boolean portTypeOperationOutput(EditableWSDLOperation op, XMLStreamReader reader)
-
portTypeOperationFault
public boolean portTypeOperationFault(EditableWSDLOperation op, XMLStreamReader reader)
-
definitionsElements
public boolean definitionsElements(XMLStreamReader reader)
-
bindingElements
public boolean bindingElements(EditableWSDLBoundPortType binding, XMLStreamReader reader)
-
bindingAttributes
public void bindingAttributes(EditableWSDLBoundPortType binding, XMLStreamReader reader)
-
portTypeElements
public boolean portTypeElements(EditableWSDLPortType portType, XMLStreamReader reader)
-
portTypeAttributes
public void portTypeAttributes(EditableWSDLPortType portType, XMLStreamReader reader)
-
portTypeOperationElements
public boolean portTypeOperationElements(EditableWSDLOperation operation, XMLStreamReader reader)
-
portTypeOperationAttributes
public void portTypeOperationAttributes(EditableWSDLOperation operation, XMLStreamReader reader)
-
bindingOperationElements
public boolean bindingOperationElements(EditableWSDLBoundOperation operation, XMLStreamReader reader)
-
bindingOperationAttributes
public void bindingOperationAttributes(EditableWSDLBoundOperation operation, XMLStreamReader reader)
-
messageElements
public boolean messageElements(EditableWSDLMessage msg, XMLStreamReader reader)
-
messageAttributes
public void messageAttributes(EditableWSDLMessage msg, XMLStreamReader reader)
-
portTypeOperationInputElements
public boolean portTypeOperationInputElements(EditableWSDLInput input, XMLStreamReader reader)
-
portTypeOperationInputAttributes
public void portTypeOperationInputAttributes(EditableWSDLInput input, XMLStreamReader reader)
-
portTypeOperationOutputElements
public boolean portTypeOperationOutputElements(EditableWSDLOutput output, XMLStreamReader reader)
-
portTypeOperationOutputAttributes
public void portTypeOperationOutputAttributes(EditableWSDLOutput output, XMLStreamReader reader)
-
portTypeOperationFaultElements
public boolean portTypeOperationFaultElements(EditableWSDLFault fault, XMLStreamReader reader)
-
portTypeOperationFaultAttributes
public void portTypeOperationFaultAttributes(EditableWSDLFault fault, XMLStreamReader reader)
-
bindingOperationInputElements
public boolean bindingOperationInputElements(EditableWSDLBoundOperation operation, XMLStreamReader reader)
-
bindingOperationInputAttributes
public void bindingOperationInputAttributes(EditableWSDLBoundOperation operation, XMLStreamReader reader)
-
bindingOperationOutputElements
public boolean bindingOperationOutputElements(EditableWSDLBoundOperation operation, XMLStreamReader reader)
-
bindingOperationOutputAttributes
public void bindingOperationOutputAttributes(EditableWSDLBoundOperation operation, XMLStreamReader reader)
-
bindingOperationFaultElements
public boolean bindingOperationFaultElements(EditableWSDLBoundFault fault, XMLStreamReader reader)
-
bindingOperationFaultAttributes
public void bindingOperationFaultAttributes(EditableWSDLBoundFault fault, XMLStreamReader reader)
-
finished
public void finished(WSDLParserExtensionContext context)
Called when the parsing of a set of WSDL documents are all done.This is the opportunity to do any post-processing of the parsing you've done.
- Parameters:
context-WSDLParserExtensionContextgives fully parsedWSDLModel.
-
postFinished
public void postFinished(WSDLParserExtensionContext context)
-
-