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

The following examples show how to use com.sun.xml.internal.ws.streaming.XMLStreamReaderUtil. These examples are extracted from open source projects. 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 Project: jdk8u60   Source File: RuntimeWSDLParser.java    License: 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 2
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 3
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 4
/**
 * 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 5
Source Project: openjdk-8   Source File: RuntimeWSDLParser.java    License: 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 6
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 7
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 8
Source Project: hottub   Source File: ResponseBuilder.java    License: 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
/**
 * 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 10
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 11
/**
 * 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 12
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 13
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 14
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 Project: TencentKona-8   Source File: StreamMessage.java    License: 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
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 17
public boolean portTypeOperationOutputElements(EditableWSDLOutput output, XMLStreamReader reader) {
    for (WSDLParserExtension e : extensions) {
        if (e.portTypeOperationOutputElements(output, reader)) {
            return true;
        }
    }
    XMLStreamReaderUtil.skipElement(reader);
    return true;
}
 
Example 18
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
public boolean bindingOperationOutputElements(EditableWSDLBoundOperation operation, XMLStreamReader reader) {
    for (WSDLParserExtension e : extensions) {
        if (e.bindingOperationOutputElements(operation, reader)) {
            return true;
        }
    }
    XMLStreamReaderUtil.skipElement(reader);
    return true;
}
 
Example 20
Source Project: openjdk-jdk9   Source File: StreamSOAPCodec.java    License: GNU General Public License v2.0 5 votes vote down vote up
public static final Message decode(SOAPVersion soapVersion, XMLStreamReader reader, @NotNull AttachmentSet attachmentSet) {
    // Move to soap:Envelope and verify
    if(reader.getEventType()!=XMLStreamConstants.START_ELEMENT)
        XMLStreamReaderUtil.nextElementContent(reader);
    XMLStreamReaderUtil.verifyReaderState(reader,XMLStreamConstants.START_ELEMENT);
    if (SOAP_ENVELOPE.equals(reader.getLocalName()) && !soapVersion.nsUri.equals(reader.getNamespaceURI())) {
        throw new VersionMismatchException(soapVersion, soapVersion.nsUri, reader.getNamespaceURI());
    }
    XMLStreamReaderUtil.verifyTag(reader, soapVersion.nsUri, SOAP_ENVELOPE);
    return new StreamMessage(soapVersion, reader, attachmentSet);
}
 
Example 21
protected ExternalMetadataFeature configureExternalMetadataReader(XMLStreamReader reader) {

        ExternalMetadataFeature.Builder featureBuilder = null;
        while (QNAME_EXT_METADA.equals(reader.getName())) {

            if (reader.getEventType() == XMLStreamConstants.START_ELEMENT) {
                Attributes attrs = XMLStreamReaderUtil.getAttributes(reader);
                String file = getAttribute(attrs, ATTR_FILE);
                if (file != null) {
                    if (featureBuilder == null) {
                        featureBuilder = ExternalMetadataFeature.builder();
                    }
                    featureBuilder.addFiles(new File(file));
                }

                String res = getAttribute(attrs, ATTR_RESOURCE);
                if (res != null) {
                    if (featureBuilder == null) {
                        featureBuilder = ExternalMetadataFeature.builder();
                    }
                    featureBuilder.addResources(res);
                }
            }

            XMLStreamReaderUtil.nextElementContent(reader);
        }

        return buildFeature(featureBuilder);
    }
 
Example 22
public boolean portTypeOperationElements(EditableWSDLOperation operation, XMLStreamReader reader) {
    for (WSDLParserExtension e : extensions) {
        if (e.portTypeOperationElements(operation, reader)) {
            return true;
        }
    }
    XMLStreamReaderUtil.skipElement(reader);
    return true;
}
 
Example 23
public boolean bindingOperationElements(EditableWSDLBoundOperation operation, XMLStreamReader reader) {
    for (WSDLParserExtension e : extensions) {
        if (e.bindingOperationElements(operation, reader)) {
            return true;
        }
    }
    XMLStreamReaderUtil.skipElement(reader);
    return true;
}
 
Example 24
public static final Message decode(SOAPVersion soapVersion, XMLStreamReader reader, @NotNull AttachmentSet attachmentSet) {
    // Move to soap:Envelope and verify
    if(reader.getEventType()!=XMLStreamConstants.START_ELEMENT)
        XMLStreamReaderUtil.nextElementContent(reader);
    XMLStreamReaderUtil.verifyReaderState(reader,XMLStreamConstants.START_ELEMENT);
    if (SOAP_ENVELOPE.equals(reader.getLocalName()) && !soapVersion.nsUri.equals(reader.getNamespaceURI())) {
        throw new VersionMismatchException(soapVersion, soapVersion.nsUri, reader.getNamespaceURI());
    }
    XMLStreamReaderUtil.verifyTag(reader, soapVersion.nsUri, SOAP_ENVELOPE);
    return new StreamMessage(soapVersion, reader, attachmentSet);
}
 
Example 25
Source Project: TencentKona-8   Source File: MtomCodec.java    License: 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;
}
 
Example 26
Source Project: hottub   Source File: RuntimeWSDLParser.java    License: 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 27
static String documentRootNamespace(Source src, boolean disableXmlSecurity) throws XMLStreamException {
    XMLInputFactory factory;
    factory = XmlUtil.newXMLInputFactory(!disableXmlSecurity);
    XMLStreamReader streamReader = factory.createXMLStreamReader(src);
    XMLStreamReaderUtil.nextElementContent(streamReader);
    String namespaceURI = streamReader.getName().getNamespaceURI();
    XMLStreamReaderUtil.close(streamReader);
    return namespaceURI;
}
 
Example 28
private static void skipInitParamElement(XMLStreamReader reader) {
    int state;
    do {
        state = XMLStreamReaderUtil.nextContent(reader);
    } while (state != XMLStreamReader.END_ELEMENT ||
            !reader.getName().equals(QNAME_HANDLER_PARAM));
    XMLStreamReaderUtil.nextElementContent(reader);
}
 
Example 29
Source Project: jdk8u60   Source File: RuntimeWSDLParser.java    License: 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 30
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);
}