com.sun.xml.internal.ws.streaming.XMLStreamReaderUtil Java Examples

The following examples show how to use com.sun.xml.internal.ws.streaming.XMLStreamReaderUtil. 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 openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
void readRequest( Object[] args, XMLStreamReader r, AttachmentSet att) throws JAXBException {
    Object obj = null;
    AttachmentUnmarshallerImpl au = (att != null)?new AttachmentUnmarshallerImpl(att):null;
    if (bridge instanceof RepeatedElementBridge) {
        RepeatedElementBridge rbridge = (RepeatedElementBridge)bridge;
        ArrayList list = new ArrayList();
        QName name = r.getName();
        while (r.getEventType()==XMLStreamReader.START_ELEMENT && name.equals(r.getName())) {
            list.add(rbridge.unmarshal(r, au));
            XMLStreamReaderUtil.toNextTag(r, name);
        }
        obj = rbridge.collectionHandler().convert(list);
    } else {
        obj = bridge.unmarshal(r, au);
    }
    setter.put(obj,args);
}
 
Example #2
Source File: DeploymentDescriptorParser.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Parses the handler and role information and sets it
 * on the {@link WSBinding}.
 *
 * @return true if <handler-chains> element present in DD
 *         false otherwise.
 */
protected boolean setHandlersAndRoles(WSBinding binding, XMLStreamReader reader, QName serviceName, QName portName) {

    if (reader.getEventType() == XMLStreamConstants.END_ELEMENT ||
            !reader.getName().equals(HandlerChainsModel.QNAME_HANDLER_CHAINS)) {
        return false;
    }

    HandlerAnnotationInfo handlerInfo = HandlerChainsModel.parseHandlerFile(
            reader, classLoader, serviceName, portName, binding);

    binding.setHandlerChain(handlerInfo.getHandlers());
    if (binding instanceof SOAPBinding) {
        ((SOAPBinding) binding).setRoles(handlerInfo.getRoles());
    }

    // move past </handler-chains>
    XMLStreamReaderUtil.nextContent(reader);
    return true;
}
 
Example #3
Source File: WsimportOptions.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Exposing it as a public method to allow external tools such as NB to read from wsdl model and work on it.
 * TODO: WSDL model needs to be exposed - basically at tool time we need to use the runtimw wsdl model
 *
 * Binding files could be jaxws or jaxb. This method identifies jaxws and jaxb binding files and keeps them separately. jaxb binding files are given separately
 * to JAXB in {@link com.sun.tools.internal.ws.processor.modeler.wsdl.JAXBModelBuilder}
 *
 * @param receiver {@link ErrorReceiver}
 */
public final void parseBindings(ErrorReceiver receiver){
    for (InputSource is : bindingFiles) {
        XMLStreamReader reader =
                XMLStreamReaderFactory.create(is,true);
        XMLStreamReaderUtil.nextElementContent(reader);
        if (reader.getName().equals(JAXWSBindingsConstants.JAXWS_BINDINGS)) {
            jaxwsCustomBindings.add(new RereadInputSource(is));
        } else if (reader.getName().equals(JAXWSBindingsConstants.JAXB_BINDINGS) ||
                reader.getName().equals(new QName(SchemaConstants.NS_XSD, "schema"))) {
            jaxbCustomBindings.add(new RereadInputSource(is));
        } else {
            LocatorImpl locator = new LocatorImpl();
            locator.setSystemId(reader.getLocation().getSystemId());
            locator.setPublicId(reader.getLocation().getPublicId());
            locator.setLineNumber(reader.getLocation().getLineNumber());
            locator.setColumnNumber(reader.getLocation().getColumnNumber());
            receiver.warning(locator, ConfigurationMessages.CONFIGURATION_NOT_BINDING_FILE(is.getSystemId()));
        }
    }
}
 
Example #4
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 #5
Source File: RuntimeWSDLParser.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
private void parseService(XMLStreamReader reader) {
    service_nsdecl.putAll(wsdldef_nsdecl);
    readNSDecl(service_nsdecl,reader);

    String serviceName = ParserUtil.getMandatoryNonEmptyAttribute(reader, WSDLConstants.ATTR_NAME);
    EditableWSDLService service = new WSDLServiceImpl(reader,wsdlDoc,new QName(targetNamespace, serviceName));
    extensionFacade.serviceAttributes(service, reader);
    while (XMLStreamReaderUtil.nextElementContent(reader) != XMLStreamConstants.END_ELEMENT) {
        QName name = reader.getName();
        if (WSDLConstants.QNAME_PORT.equals(name)) {
            parsePort(reader, service);
            if (reader.getEventType() != XMLStreamConstants.END_ELEMENT) {
                XMLStreamReaderUtil.next(reader);
            }
        } else {
            extensionFacade.serviceElements(service, reader);
        }
    }
    wsdlDoc.addService(service);
    service_nsdecl =  new HashMap<String, String>();
}
 
Example #6
Source File: RuntimeWSDLParser.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
private void parseOutputBinding(XMLStreamReader reader, EditableWSDLBoundOperation bindingOp) {
    boolean bodyFound = false;
    extensionFacade.bindingOperationOutputAttributes(bindingOp, reader);
    while (XMLStreamReaderUtil.nextElementContent(reader) != XMLStreamConstants.END_ELEMENT) {
        QName name = reader.getName();
        if ((SOAPConstants.QNAME_BODY.equals(name) || SOAPConstants.QNAME_SOAP12BODY.equals(name)) && !bodyFound) {
            bodyFound = true;
            bindingOp.setOutputExplicitBodyParts(parseSOAPBodyBinding(reader, bindingOp, BindingMode.OUTPUT));
            goToEnd(reader);
        } else if ((SOAPConstants.QNAME_HEADER.equals(name) || SOAPConstants.QNAME_SOAP12HEADER.equals(name))) {
            parseSOAPHeaderBinding(reader, bindingOp.getOutputParts());
        } else if (MIMEConstants.QNAME_MULTIPART_RELATED.equals(name)) {
            parseMimeMultipartBinding(reader, bindingOp, BindingMode.OUTPUT);
        } else {
            extensionFacade.bindingOperationOutputElements(bindingOp, reader);
        }
    }
}
 
Example #7
Source File: DeploymentDescriptorParser.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Parses the handler and role information and sets it
 * on the {@link WSBinding}.
 *
 * @return true if <handler-chains> element present in DD
 *         false otherwise.
 */
protected boolean setHandlersAndRoles(WSBinding binding, XMLStreamReader reader, QName serviceName, QName portName) {

    if (reader.getEventType() == XMLStreamConstants.END_ELEMENT ||
            !reader.getName().equals(HandlerChainsModel.QNAME_HANDLER_CHAINS)) {
        return false;
    }

    HandlerAnnotationInfo handlerInfo = HandlerChainsModel.parseHandlerFile(
            reader, classLoader, serviceName, portName, binding);

    binding.setHandlerChain(handlerInfo.getHandlers());
    if (binding instanceof SOAPBinding) {
        ((SOAPBinding) binding).setRoles(handlerInfo.getRoles());
    }

    // move past </handler-chains>
    XMLStreamReaderUtil.nextContent(reader);
    return true;
}
 
Example #8
Source File: ResponseBuilder.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
final Object readResponse(Object[] args, XMLStreamReader r, AttachmentSet att) throws JAXBException {
    Object obj;
    AttachmentUnmarshallerImpl au = (att != null)?new AttachmentUnmarshallerImpl(att):null;
    if (bridge instanceof RepeatedElementBridge) {
        RepeatedElementBridge rbridge = (RepeatedElementBridge)bridge;
        ArrayList list = new ArrayList();
        QName name = r.getName();
        while (r.getEventType()==XMLStreamReader.START_ELEMENT && name.equals(r.getName())) {
            list.add(rbridge.unmarshal(r, au));
            XMLStreamReaderUtil.toNextTag(r, name);
        }
        obj = rbridge.collectionHandler().convert(list);
    } else {
        obj = bridge.unmarshal(r, au);
    }
    return setter.put(obj,args);
}
 
Example #9
Source File: EndpointArgumentsBuilder.java    From openjdk-jdk9 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 #10
Source File: ResponseBuilder.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
final Object readResponse(Object[] args, XMLStreamReader r, AttachmentSet att) throws JAXBException {
    Object obj;
    AttachmentUnmarshallerImpl au = (att != null)?new AttachmentUnmarshallerImpl(att):null;
    if (bridge instanceof RepeatedElementBridge) {
        RepeatedElementBridge rbridge = (RepeatedElementBridge)bridge;
        ArrayList list = new ArrayList();
        QName name = r.getName();
        while (r.getEventType()==XMLStreamReader.START_ELEMENT && name.equals(r.getName())) {
            list.add(rbridge.unmarshal(r, au));
            XMLStreamReaderUtil.toNextTag(r, name);
        }
        obj = rbridge.collectionHandler().convert(list);
    } else {
        obj = bridge.unmarshal(r, au);
    }
    return setter.put(obj,args);
}
 
Example #11
Source File: RuntimeWSDLParser.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
private void parseService(XMLStreamReader reader) {
    service_nsdecl.putAll(wsdldef_nsdecl);
    readNSDecl(service_nsdecl,reader);

    String serviceName = ParserUtil.getMandatoryNonEmptyAttribute(reader, WSDLConstants.ATTR_NAME);
    EditableWSDLService service = new WSDLServiceImpl(reader,wsdlDoc,new QName(targetNamespace, serviceName));
    extensionFacade.serviceAttributes(service, reader);
    while (XMLStreamReaderUtil.nextElementContent(reader) != XMLStreamConstants.END_ELEMENT) {
        QName name = reader.getName();
        if (WSDLConstants.QNAME_PORT.equals(name)) {
            parsePort(reader, service);
            if (reader.getEventType() != XMLStreamConstants.END_ELEMENT) {
                XMLStreamReaderUtil.next(reader);
            }
        } else {
            extensionFacade.serviceElements(service, reader);
        }
    }
    wsdlDoc.addService(service);
    service_nsdecl =  new HashMap<String, String>();
}
 
Example #12
Source File: EndpointArgumentsBuilder.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
void readRequest( Object[] args, XMLStreamReader r, AttachmentSet att) throws JAXBException {
    Object obj = null;
    AttachmentUnmarshallerImpl au = (att != null)?new AttachmentUnmarshallerImpl(att):null;
    if (bridge instanceof RepeatedElementBridge) {
        RepeatedElementBridge rbridge = (RepeatedElementBridge)bridge;
        ArrayList list = new ArrayList();
        QName name = r.getName();
        while (r.getEventType()==XMLStreamReader.START_ELEMENT && name.equals(r.getName())) {
            list.add(rbridge.unmarshal(r, au));
            XMLStreamReaderUtil.toNextTag(r, name);
        }
        obj = rbridge.collectionHandler().convert(list);
    } else {
        obj = bridge.unmarshal(r, au);
    }
    setter.put(obj,args);
}
 
Example #13
Source File: RuntimeWSDLParser.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
private void parseInputBinding(XMLStreamReader reader, EditableWSDLBoundOperation bindingOp) {
    boolean bodyFound = false;
    extensionFacade.bindingOperationInputAttributes(bindingOp, reader);
    while (XMLStreamReaderUtil.nextElementContent(reader) != XMLStreamConstants.END_ELEMENT) {
        QName name = reader.getName();
        if ((SOAPConstants.QNAME_BODY.equals(name) || SOAPConstants.QNAME_SOAP12BODY.equals(name)) && !bodyFound) {
            bodyFound = true;
            bindingOp.setInputExplicitBodyParts(parseSOAPBodyBinding(reader, bindingOp, BindingMode.INPUT));
            goToEnd(reader);
        } else if ((SOAPConstants.QNAME_HEADER.equals(name) || SOAPConstants.QNAME_SOAP12HEADER.equals(name))) {
            parseSOAPHeaderBinding(reader, bindingOp.getInputParts());
        } else if (MIMEConstants.QNAME_MULTIPART_RELATED.equals(name)) {
            parseMimeMultipartBinding(reader, bindingOp, BindingMode.INPUT);
        } else {
            extensionFacade.bindingOperationInputElements(bindingOp, reader);
        }
    }
}
 
Example #14
Source File: RuntimeWSDLParser.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
private void parseOutputBinding(XMLStreamReader reader, EditableWSDLBoundOperation bindingOp) {
    boolean bodyFound = false;
    extensionFacade.bindingOperationOutputAttributes(bindingOp, reader);
    while (XMLStreamReaderUtil.nextElementContent(reader) != XMLStreamConstants.END_ELEMENT) {
        QName name = reader.getName();
        if ((SOAPConstants.QNAME_BODY.equals(name) || SOAPConstants.QNAME_SOAP12BODY.equals(name)) && !bodyFound) {
            bodyFound = true;
            bindingOp.setOutputExplicitBodyParts(parseSOAPBodyBinding(reader, bindingOp, BindingMode.OUTPUT));
            goToEnd(reader);
        } else if ((SOAPConstants.QNAME_HEADER.equals(name) || SOAPConstants.QNAME_SOAP12HEADER.equals(name))) {
            parseSOAPHeaderBinding(reader, bindingOp.getOutputParts());
        } else if (MIMEConstants.QNAME_MULTIPART_RELATED.equals(name)) {
            parseMimeMultipartBinding(reader, bindingOp, BindingMode.OUTPUT);
        } else {
            extensionFacade.bindingOperationOutputElements(bindingOp, reader);
        }
    }
}
 
Example #15
Source File: StreamMessage.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
private static XMLStreamBuffer cacheHeaders(XMLStreamReader reader,
        Map<String, String> namespaces, HeaderList headers,
        StreamHeaderDecoder headerDecoder) throws XMLStreamException {
    MutableXMLStreamBuffer buffer = createXMLStreamBuffer();
    StreamReaderBufferCreator creator = new StreamReaderBufferCreator();
    creator.setXMLStreamBuffer(buffer);

    // Reader is positioned at the first header block
    while(reader.getEventType() == javax.xml.stream.XMLStreamConstants.START_ELEMENT) {
        Map<String,String> headerBlockNamespaces = namespaces;

        // Collect namespaces on SOAP header block
        if (reader.getNamespaceCount() > 0) {
            headerBlockNamespaces = new HashMap<String,String>(namespaces);
            for (int i = 0; i < reader.getNamespaceCount(); i++) {
                headerBlockNamespaces.put(reader.getNamespacePrefix(i), reader.getNamespaceURI(i));
            }
        }

        // Mark
        XMLStreamBuffer mark = new XMLStreamBufferMark(headerBlockNamespaces, creator);
        // Create Header
        headers.add(headerDecoder.decodeHeader(reader, mark));


        // Cache the header block
        // After caching Reader will be positioned at next header block or
        // the end of the </soap:header>
        creator.createElementFragment(reader, false);
        if (reader.getEventType() != XMLStreamConstants.START_ELEMENT &&
                reader.getEventType() != XMLStreamConstants.END_ELEMENT) {
            XMLStreamReaderUtil.nextElementContent(reader);
        }
    }

    return buffer;
}
 
Example #16
Source File: RuntimeWSDLParser.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
private void parseFaultBinding(XMLStreamReader reader, EditableWSDLBoundOperation bindingOp) {
    String faultName = ParserUtil.getMandatoryNonEmptyAttribute(reader, "name");
    EditableWSDLBoundFault wsdlBoundFault = new WSDLBoundFaultImpl(reader, faultName, bindingOp);
    bindingOp.addFault(wsdlBoundFault);

    extensionFacade.bindingOperationFaultAttributes(wsdlBoundFault, reader);

    while (XMLStreamReaderUtil.nextElementContent(reader) != XMLStreamConstants.END_ELEMENT) {
        extensionFacade.bindingOperationFaultElements(wsdlBoundFault, reader);
    }
}
 
Example #17
Source File: WSDLParserExtensionFacade.java    From jdk8u60 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 #18
Source File: WSDLParserExtensionFacade.java    From openjdk-jdk8u 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 #19
Source File: WSDLParserExtensionFacade.java    From hottub 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 #20
Source File: RuntimeWSDLParser.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private void parsePortTypeOperation(XMLStreamReader reader, EditableWSDLPortType portType) {
    String operationName = ParserUtil.getMandatoryNonEmptyAttribute(reader, WSDLConstants.ATTR_NAME);
    if (operationName == null) {
        //TODO: throw exception?
        //skip wsdl:portType element for now
        XMLStreamReaderUtil.skipElement(reader);
        return;
    }

    QName operationQName = new QName(portType.getName().getNamespaceURI(), operationName);
    EditableWSDLOperation operation = new WSDLOperationImpl(reader,portType, operationQName);
    extensionFacade.portTypeOperationAttributes(operation, reader);
    String parameterOrder = ParserUtil.getAttribute(reader, "parameterOrder");
    operation.setParameterOrder(parameterOrder);
    portType.put(operationName, operation);
    while (XMLStreamReaderUtil.nextElementContent(reader) != XMLStreamConstants.END_ELEMENT) {
        QName name = reader.getName();
        if (name.equals(WSDLConstants.QNAME_INPUT)) {
            parsePortTypeOperationInput(reader, operation);
        } else if (name.equals(WSDLConstants.QNAME_OUTPUT)) {
            parsePortTypeOperationOutput(reader, operation);
        } else if (name.equals(WSDLConstants.QNAME_FAULT)) {
            parsePortTypeOperationFault(reader, operation);
        } else {
            extensionFacade.portTypeOperationElements(operation, reader);
        }
    }
}
 
Example #21
Source File: WSDLParserExtensionFacade.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public boolean portTypeOperationFaultElements(EditableWSDLFault fault, XMLStreamReader reader) {
    for (WSDLParserExtension e : extensions) {
        if (e.portTypeOperationFaultElements(fault, reader)) {
            return true;
        }
    }
    XMLStreamReaderUtil.skipElement(reader);
    return true;
}
 
Example #22
Source File: RuntimeWSDLParser.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
private void parseMessage(XMLStreamReader reader) {
    String msgName = ParserUtil.getMandatoryNonEmptyAttribute(reader, WSDLConstants.ATTR_NAME);
    EditableWSDLMessage msg = new WSDLMessageImpl(reader,new QName(targetNamespace, msgName));
    extensionFacade.messageAttributes(msg, reader);
    int partIndex = 0;
    while (XMLStreamReaderUtil.nextElementContent(reader) != XMLStreamConstants.END_ELEMENT) {
        QName name = reader.getName();
        if (WSDLConstants.QNAME_PART.equals(name)) {
            String part = ParserUtil.getMandatoryNonEmptyAttribute(reader, WSDLConstants.ATTR_NAME);
            String desc = null;
            int index = reader.getAttributeCount();
            WSDLDescriptorKind kind = WSDLDescriptorKind.ELEMENT;
            for (int i = 0; i < index; i++) {
                QName descName = reader.getAttributeName(i);
                if (descName.getLocalPart().equals("element"))
                    kind = WSDLDescriptorKind.ELEMENT;
                else if (descName.getLocalPart().equals("type"))
                    kind = WSDLDescriptorKind.TYPE;

                if (descName.getLocalPart().equals("element") || descName.getLocalPart().equals("type")) {
                    desc = reader.getAttributeValue(i);
                    break;
                }
            }
            if (desc != null) {
                EditableWSDLPart wsdlPart = new WSDLPartImpl(reader, part, partIndex, new WSDLPartDescriptorImpl(reader,ParserUtil.getQName(reader, desc), kind));
                msg.add(wsdlPart);
            }
            if (reader.getEventType() != XMLStreamConstants.END_ELEMENT)
                goToEnd(reader);
        } else {
            extensionFacade.messageElements(msg, reader);
        }
    }
    wsdlDoc.addMessage(msg);
    if (reader.getEventType() != XMLStreamConstants.END_ELEMENT)
        goToEnd(reader);
}
 
Example #23
Source File: RuntimeWSDLParser.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
private void parsePortTypeOperationOutput(XMLStreamReader reader, EditableWSDLOperation operation) {
    String msg = ParserUtil.getAttribute(reader, "message");
    QName msgName = ParserUtil.getQName(reader, msg);
    String name = ParserUtil.getAttribute(reader, "name");
    EditableWSDLOutput output = new WSDLOutputImpl(reader,name, msgName, operation);
    operation.setOutput(output);
    extensionFacade.portTypeOperationOutputAttributes(output, reader);
    extensionFacade.portTypeOperationOutput(operation, reader);
    while (XMLStreamReaderUtil.nextElementContent(reader) != XMLStreamConstants.END_ELEMENT) {
        extensionFacade.portTypeOperationOutputElements(output, reader);
    }
}
 
Example #24
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 #25
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 #26
Source File: WSDLParserExtensionFacade.java    From openjdk-8-source 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 #27
Source File: RuntimeWSDLParser.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
private void parsePortTypeOperationInput(XMLStreamReader reader, EditableWSDLOperation operation) {
    String msg = ParserUtil.getMandatoryNonEmptyAttribute(reader, "message");
    QName msgName = ParserUtil.getQName(reader, msg);
    String name = ParserUtil.getAttribute(reader, "name");
    EditableWSDLInput input = new WSDLInputImpl(reader, name, msgName, operation);
    operation.setInput(input);
    extensionFacade.portTypeOperationInputAttributes(input, reader);
    extensionFacade.portTypeOperationInput(operation, reader);
    while (XMLStreamReaderUtil.nextElementContent(reader) != XMLStreamConstants.END_ELEMENT) {
        extensionFacade.portTypeOperationInputElements(input, reader);
    }
}
 
Example #28
Source File: StreamMessage.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private static XMLStreamBuffer cacheHeaders(XMLStreamReader reader,
        Map<String, String> namespaces, HeaderList headers,
        StreamHeaderDecoder headerDecoder) throws XMLStreamException {
    MutableXMLStreamBuffer buffer = createXMLStreamBuffer();
    StreamReaderBufferCreator creator = new StreamReaderBufferCreator();
    creator.setXMLStreamBuffer(buffer);

    // Reader is positioned at the first header block
    while(reader.getEventType() == javax.xml.stream.XMLStreamConstants.START_ELEMENT) {
        Map<String,String> headerBlockNamespaces = namespaces;

        // Collect namespaces on SOAP header block
        if (reader.getNamespaceCount() > 0) {
            headerBlockNamespaces = new HashMap<String,String>(namespaces);
            for (int i = 0; i < reader.getNamespaceCount(); i++) {
                headerBlockNamespaces.put(reader.getNamespacePrefix(i), reader.getNamespaceURI(i));
            }
        }

        // Mark
        XMLStreamBuffer mark = new XMLStreamBufferMark(headerBlockNamespaces, creator);
        // Create Header
        headers.add(headerDecoder.decodeHeader(reader, mark));


        // Cache the header block
        // After caching Reader will be positioned at next header block or
        // the end of the </soap:header>
        creator.createElementFragment(reader, false);
        if (reader.getEventType() != XMLStreamConstants.START_ELEMENT &&
                reader.getEventType() != XMLStreamConstants.END_ELEMENT) {
            XMLStreamReaderUtil.nextElementContent(reader);
        }
    }

    return buffer;
}
 
Example #29
Source File: RuntimeWSDLParser.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
private static void parseMimeMultipartBinding(XMLStreamReader reader, EditableWSDLBoundOperation op, BindingMode mode) {
    while (XMLStreamReaderUtil.nextElementContent(reader) != XMLStreamConstants.END_ELEMENT) {
        QName name = reader.getName();
        if (MIMEConstants.QNAME_PART.equals(name)) {
            parseMIMEPart(reader, op, mode);
        } else {
            XMLStreamReaderUtil.skipElement(reader);
        }
    }
}
 
Example #30
Source File: MtomCodec.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
@Override
public int next() throws XMLStreamException {
    int event = reader.next();
    if (event == XMLStreamConstants.START_ELEMENT && reader.getLocalName().equals(XOP_LOCALNAME) && reader.getNamespaceURI().equals(XOP_NAMESPACEURI)) {
        //its xop reference, take the URI reference
        String href = reader.getAttributeValue(null, "href");
        try {
            xopHref = href;
            Attachment att = getAttachment(href);
            if(att != null){
                DataHandler dh = att.asDataHandler();
                if (dh instanceof StreamingDataHandler) {
                    ((StreamingDataHandler)dh).setHrefCid(att.getContentId());
                }
                base64AttData = new Base64Data();
                base64AttData.set(dh);
            }
            xopReferencePresent = true;
        } catch (IOException e) {
            throw new WebServiceException(e);
        }
        //move to the </xop:Include>
        XMLStreamReaderUtil.nextElementContent(reader);
        return XMLStreamConstants.CHARACTERS;
    }
    if(xopReferencePresent){
        xopReferencePresent = false;
        base64EncodedText = null;
        xopHref = null;
    }
    return event;
}