Java Code Examples for com.sun.xml.internal.ws.streaming.XMLStreamReaderUtil#skipElement()

The following examples show how to use com.sun.xml.internal.ws.streaming.XMLStreamReaderUtil#skipElement() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: EndpointArgumentsBuilder.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
protected void readWrappedRequest(Message msg, Object[] args) throws JAXBException, XMLStreamException {
    if (!msg.hasPayload()) {
        throw new WebServiceException("No payload. Expecting payload with "+wrapperName+" element");
    }
    XMLStreamReader reader = msg.readPayload();
    XMLStreamReaderUtil.verifyTag(reader,wrapperName);
    reader.nextTag();
    while(reader.getEventType()==XMLStreamReader.START_ELEMENT) {
        // TODO: QName has a performance issue
        QName name = reader.getName();
        WrappedPartBuilder part = wrappedParts.get(name);
        if(part==null) {
            // no corresponding part found. ignore
            XMLStreamReaderUtil.skipElement(reader);
            reader.nextTag();
        } else {
            part.readRequest(args,reader, msg.getAttachments());
        }
        XMLStreamReaderUtil.toNextTag(reader, name);
    }

    // we are done with the body
    reader.close();
    XMLStreamReaderFactory.recycle(reader);
}
 
Example 2
Source File: EndpointArgumentsBuilder.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
protected void readWrappedRequest(Message msg, Object[] args) throws JAXBException, XMLStreamException {
    if (!msg.hasPayload()) {
        throw new WebServiceException("No payload. Expecting payload with "+wrapperName+" element");
    }
    XMLStreamReader reader = msg.readPayload();
    XMLStreamReaderUtil.verifyTag(reader,wrapperName);
    reader.nextTag();
    while(reader.getEventType()==XMLStreamReader.START_ELEMENT) {
        // TODO: QName has a performance issue
        QName name = reader.getName();
        WrappedPartBuilder part = wrappedParts.get(name);
        if(part==null) {
            // no corresponding part found. ignore
            XMLStreamReaderUtil.skipElement(reader);
            reader.nextTag();
        } else {
            part.readRequest(args,reader, msg.getAttachments());
        }
        XMLStreamReaderUtil.toNextTag(reader, name);
    }

    // we are done with the body
    reader.close();
    XMLStreamReaderFactory.recycle(reader);
}
 
Example 3
Source File: RuntimeWSDLParser.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
private void parsePortType(XMLStreamReader reader) {
    String portTypeName = ParserUtil.getMandatoryNonEmptyAttribute(reader, WSDLConstants.ATTR_NAME);
    if (portTypeName == null) {
        //TODO: throw exception?
        //skip wsdl:portType element for now
        XMLStreamReaderUtil.skipElement(reader);
        return;
    }
    EditableWSDLPortType portType = new WSDLPortTypeImpl(reader,wsdlDoc, new QName(targetNamespace, portTypeName));
    extensionFacade.portTypeAttributes(portType, reader);
    wsdlDoc.addPortType(portType);
    while (XMLStreamReaderUtil.nextElementContent(reader) != XMLStreamConstants.END_ELEMENT) {
        QName name = reader.getName();
        if (WSDLConstants.QNAME_OPERATION.equals(name)) {
            parsePortTypeOperation(reader, portType);
        } else {
            extensionFacade.portTypeElements(portType, reader);
        }
    }
}
 
Example 4
Source File: RuntimeWSDLParser.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
private static void parseMIMEPart(XMLStreamReader reader, EditableWSDLBoundOperation op, BindingMode mode) {
    boolean bodyFound = false;
    Map<String, ParameterBinding> parts = null;
    if (mode == BindingMode.INPUT) {
        parts = op.getInputParts();
    } else if (mode == BindingMode.OUTPUT) {
        parts = op.getOutputParts();
    } else if (mode == BindingMode.FAULT) {
        parts = op.getFaultParts();
    }
    while (XMLStreamReaderUtil.nextElementContent(reader) != XMLStreamConstants.END_ELEMENT) {
        QName name = reader.getName();
        if (SOAPConstants.QNAME_BODY.equals(name) && !bodyFound) {
            bodyFound = true;
            parseSOAPBodyBinding(reader, op, mode);
            XMLStreamReaderUtil.next(reader);
        } else if (SOAPConstants.QNAME_HEADER.equals(name)) {
            bodyFound = true;
            parseSOAPHeaderBinding(reader, parts);
            XMLStreamReaderUtil.next(reader);
        } else if (MIMEConstants.QNAME_CONTENT.equals(name)) {
            String part = reader.getAttributeValue(null, "part");
            String type = reader.getAttributeValue(null, "type");
            if ((part == null) || (type == null)) {
                XMLStreamReaderUtil.skipElement(reader);
                continue;
            }
            ParameterBinding sb = ParameterBinding.createAttachment(type);
            if (parts != null && sb != null && part != null)
                parts.put(part, sb);
            XMLStreamReaderUtil.next(reader);
        } else {
            XMLStreamReaderUtil.skipElement(reader);
        }
    }
}
 
Example 5
Source File: WSDLParserExtensionFacade.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public boolean portTypeOperationInputElements(EditableWSDLInput input, XMLStreamReader reader) {
    for (WSDLParserExtension e : extensions) {
        if (e.portTypeOperationInputElements(input, reader)) {
            return true;
        }
    }
    XMLStreamReaderUtil.skipElement(reader);
    return true;
}
 
Example 6
Source File: MemberSubmissionAddressingWSDLParserExtension.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
private boolean addressibleElement(XMLStreamReader reader, WSDLFeaturedObject binding) {
    QName ua = reader.getName();
    if (ua.equals(AddressingVersion.MEMBER.wsdlExtensionTag)) {
        String required = reader.getAttributeValue(WSDLConstants.NS_WSDL, "required");
        binding.addFeature(new MemberSubmissionAddressingFeature(Boolean.parseBoolean(required)));
        XMLStreamReaderUtil.skipElement(reader);
        return true;        // UsingAddressing is consumed
    }

    return false;
}
 
Example 7
Source File: W3CAddressingWSDLParserExtension.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
private boolean addressibleElement(XMLStreamReader reader, WSDLFeaturedObject binding) {
    QName ua = reader.getName();
    if (ua.equals(AddressingVersion.W3C.wsdlExtensionTag)) {
        String required = reader.getAttributeValue(WSDLConstants.NS_WSDL, "required");
        binding.addFeature(new AddressingFeature(true, Boolean.parseBoolean(required)));
        XMLStreamReaderUtil.skipElement(reader);
        return true;        // UsingAddressing is consumed
    }

    return false;
}
 
Example 8
Source File: RuntimeWSDLParser.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
private static void parseMIMEPart(XMLStreamReader reader, EditableWSDLBoundOperation op, BindingMode mode) {
    boolean bodyFound = false;
    Map<String, ParameterBinding> parts = null;
    if (mode == BindingMode.INPUT) {
        parts = op.getInputParts();
    } else if (mode == BindingMode.OUTPUT) {
        parts = op.getOutputParts();
    } else if (mode == BindingMode.FAULT) {
        parts = op.getFaultParts();
    }
    while (XMLStreamReaderUtil.nextElementContent(reader) != XMLStreamConstants.END_ELEMENT) {
        QName name = reader.getName();
        if (SOAPConstants.QNAME_BODY.equals(name) && !bodyFound) {
            bodyFound = true;
            parseSOAPBodyBinding(reader, op, mode);
            XMLStreamReaderUtil.next(reader);
        } else if (SOAPConstants.QNAME_HEADER.equals(name)) {
            bodyFound = true;
            parseSOAPHeaderBinding(reader, parts);
            XMLStreamReaderUtil.next(reader);
        } else if (MIMEConstants.QNAME_CONTENT.equals(name)) {
            String part = reader.getAttributeValue(null, "part");
            String type = reader.getAttributeValue(null, "type");
            if ((part == null) || (type == null)) {
                XMLStreamReaderUtil.skipElement(reader);
                continue;
            }
            ParameterBinding sb = ParameterBinding.createAttachment(type);
            if (parts != null && sb != null && part != null)
                parts.put(part, sb);
            XMLStreamReaderUtil.next(reader);
        } else {
            XMLStreamReaderUtil.skipElement(reader);
        }
    }
}
 
Example 9
Source File: MemberSubmissionAddressingWSDLParserExtension.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private boolean addressibleElement(XMLStreamReader reader, WSDLFeaturedObject binding) {
    QName ua = reader.getName();
    if (ua.equals(AddressingVersion.MEMBER.wsdlExtensionTag)) {
        String required = reader.getAttributeValue(WSDLConstants.NS_WSDL, "required");
        binding.addFeature(new MemberSubmissionAddressingFeature(Boolean.parseBoolean(required)));
        XMLStreamReaderUtil.skipElement(reader);
        return true;        // UsingAddressing is consumed
    }

    return false;
}
 
Example 10
Source File: WSDLParserExtensionFacade.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public boolean serviceElements(EditableWSDLService service, XMLStreamReader reader) {
    for (WSDLParserExtension e : extensions) {
        if(e.serviceElements(service,reader))
            return true;
    }
    XMLStreamReaderUtil.skipElement(reader);
    return true;
}
 
Example 11
Source File: WSDLParserExtensionFacade.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public boolean bindingOperationOutputElements(EditableWSDLBoundOperation operation, XMLStreamReader reader) {
    for (WSDLParserExtension e : extensions) {
        if (e.bindingOperationOutputElements(operation, reader)) {
            return true;
        }
    }
    XMLStreamReaderUtil.skipElement(reader);
    return true;
}
 
Example 12
Source File: WSDLParserExtensionFacade.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public boolean portTypeOperationInputElements(EditableWSDLInput input, XMLStreamReader reader) {
    for (WSDLParserExtension e : extensions) {
        if (e.portTypeOperationInputElements(input, reader)) {
            return true;
        }
    }
    XMLStreamReaderUtil.skipElement(reader);
    return true;
}
 
Example 13
Source File: WSDLParserExtensionFacade.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public boolean bindingElements(EditableWSDLBoundPortType binding, XMLStreamReader reader){
    for (WSDLParserExtension e : extensions) {
        if (e.bindingElements(binding, reader)) {
            return true;
        }
    }
    //extension is not understood by any WSDlParserExtension
    //Check if it must be understood.
    if (isRequiredExtension(reader)) {
        binding.addNotUnderstoodExtension(
                reader.getName(), getLocator(reader));
    }
    XMLStreamReaderUtil.skipElement(reader);
    return true;
}
 
Example 14
Source File: WSDLParserExtensionFacade.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public boolean messageElements(EditableWSDLMessage msg, XMLStreamReader reader) {
    for (WSDLParserExtension e : extensions) {
        if (e.messageElements(msg, reader)) {
            return true;
        }
    }
    XMLStreamReaderUtil.skipElement(reader);
    return true;
}
 
Example 15
Source File: WSDLParserExtensionFacade.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public boolean portTypeOperationElements(EditableWSDLOperation operation, XMLStreamReader reader) {
    for (WSDLParserExtension e : extensions) {
        if (e.portTypeOperationElements(operation, reader)) {
            return true;
        }
    }
    XMLStreamReaderUtil.skipElement(reader);
    return true;
}
 
Example 16
Source File: WSDLParserExtensionFacade.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public boolean bindingOperationFaultElements(EditableWSDLBoundFault fault, XMLStreamReader reader) {
    for (WSDLParserExtension e : extensions) {
        if (e.bindingOperationFaultElements(fault, reader)) {
            return true;
        }
    }
    XMLStreamReaderUtil.skipElement(reader);
    return true;
}
 
Example 17
Source File: RuntimeWSDLParser.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private static void parseMIMEPart(XMLStreamReader reader, EditableWSDLBoundOperation op, BindingMode mode) {
    boolean bodyFound = false;
    Map<String, ParameterBinding> parts = null;
    if (mode == BindingMode.INPUT) {
        parts = op.getInputParts();
    } else if (mode == BindingMode.OUTPUT) {
        parts = op.getOutputParts();
    } else if (mode == BindingMode.FAULT) {
        parts = op.getFaultParts();
    }
    while (XMLStreamReaderUtil.nextElementContent(reader) != XMLStreamConstants.END_ELEMENT) {
        QName name = reader.getName();
        if (SOAPConstants.QNAME_BODY.equals(name) && !bodyFound) {
            bodyFound = true;
            parseSOAPBodyBinding(reader, op, mode);
            XMLStreamReaderUtil.next(reader);
        } else if (SOAPConstants.QNAME_HEADER.equals(name)) {
            bodyFound = true;
            parseSOAPHeaderBinding(reader, parts);
            XMLStreamReaderUtil.next(reader);
        } else if (MIMEConstants.QNAME_CONTENT.equals(name)) {
            String part = reader.getAttributeValue(null, "part");
            String type = reader.getAttributeValue(null, "type");
            if ((part == null) || (type == null)) {
                XMLStreamReaderUtil.skipElement(reader);
                continue;
            }
            ParameterBinding sb = ParameterBinding.createAttachment(type);
            if (parts != null && sb != null && part != null)
                parts.put(part, sb);
            XMLStreamReaderUtil.next(reader);
        } else {
            XMLStreamReaderUtil.skipElement(reader);
        }
    }
}
 
Example 18
Source File: WSDLParserExtensionFacade.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public boolean bindingOperationFaultElements(EditableWSDLBoundFault fault, XMLStreamReader reader) {
    for (WSDLParserExtension e : extensions) {
        if (e.bindingOperationFaultElements(fault, reader)) {
            return true;
        }
    }
    XMLStreamReaderUtil.skipElement(reader);
    return true;
}
 
Example 19
Source File: RuntimeWSDLParser.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
private void parseBindingOperation(XMLStreamReader reader, EditableWSDLBoundPortType binding) {
    String bindingOpName = ParserUtil.getMandatoryNonEmptyAttribute(reader, "name");
    if (bindingOpName == null) {
        //TODO: throw exception?
        //skip wsdl:binding element for now
        XMLStreamReaderUtil.skipElement(reader);
        return;
    }

    QName opName = new QName(binding.getPortTypeName().getNamespaceURI(), bindingOpName);
    EditableWSDLBoundOperation bindingOp = new WSDLBoundOperationImpl(reader,binding, opName);
    binding.put(opName, bindingOp);
    extensionFacade.bindingOperationAttributes(bindingOp, reader);

    while (XMLStreamReaderUtil.nextElementContent(reader) != XMLStreamConstants.END_ELEMENT) {
        QName name = reader.getName();
        String style = null;
        if (WSDLConstants.QNAME_INPUT.equals(name)) {
            parseInputBinding(reader, bindingOp);
        } else if (WSDLConstants.QNAME_OUTPUT.equals(name)) {
            parseOutputBinding(reader, bindingOp);
        } else if (WSDLConstants.QNAME_FAULT.equals(name)) {
            parseFaultBinding(reader, bindingOp);
        } else if (SOAPConstants.QNAME_OPERATION.equals(name) ||
                SOAPConstants.QNAME_SOAP12OPERATION.equals(name)) {
            style = reader.getAttributeValue(null, "style");
            String soapAction = reader.getAttributeValue(null, "soapAction");

            if (soapAction != null)
                bindingOp.setSoapAction(soapAction);

            goToEnd(reader);
        } else {
            extensionFacade.bindingOperationElements(bindingOp, reader);
        }
        /**
         *  If style attribute is present set it otherwise set the style as defined
         *  on the <soap:binding> element
         */
        if (style != null) {
            if (style.equals("rpc"))
                bindingOp.setStyle(Style.RPC);
            else
                bindingOp.setStyle(Style.DOCUMENT);
        } else {
            bindingOp.setStyle(binding.getStyle());
        }
    }
}
 
Example 20
Source File: RuntimeWSDLParser.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
private static void goToEnd(XMLStreamReader reader) {
    while (XMLStreamReaderUtil.nextElementContent(reader) != XMLStreamConstants.END_ELEMENT) {
        XMLStreamReaderUtil.skipElement(reader);
    }
}