Search in sources :

Example 1 with TWSDLExtensible

use of com.sun.tools.ws.api.wsdl.TWSDLExtensible in project metro-jax-ws by eclipse-ee4j.

the class WSDLModeler method handleLiteralSOAPHeaders.

protected void handleLiteralSOAPHeaders(Request request, Response response, Iterator headerParts, Set duplicateNames, @NotNull List<String> definitiveParameterList, boolean processRequest) {
    QName headerName;
    Block headerBlock;
    JAXBType jaxbType;
    int parameterOrderPosition = definitiveParameterList.size();
    while (headerParts.hasNext()) {
        MessagePart part = (MessagePart) headerParts.next();
        headerName = part.getDescriptor();
        jaxbType = getJAXBType(part);
        headerBlock = new Block(headerName, jaxbType, part);
        TWSDLExtensible ext;
        if (processRequest) {
            ext = info.bindingOperation.getInput();
        } else {
            ext = info.bindingOperation.getOutput();
        }
        Message headerMessage = getHeaderMessage(part, ext);
        if (processRequest) {
            request.addHeaderBlock(headerBlock);
        } else {
            response.addHeaderBlock(headerBlock);
        }
        Parameter parameter = ModelerUtils.createParameter(part.getName(), jaxbType, headerBlock);
        parameter.setParameterIndex(parameterOrderPosition);
        setCustomizedParameterName(info.bindingOperation, headerMessage, part, parameter, false);
        if (processRequest) {
            request.addParameter(parameter);
            definitiveParameterList.add(parameter.getName());
        } else {
            for (String inParamName : definitiveParameterList) {
                if (inParamName.equals(parameter.getName())) {
                    Parameter inParam = request.getParameterByName(inParamName);
                    parameter.setLinkedParameter(inParam);
                    inParam.setLinkedParameter(parameter);
                    // its in/out parameter, input and output parameter have the same order position.
                    parameter.setParameterIndex(inParam.getParameterIndex());
                }
            }
            if (!definitiveParameterList.contains(parameter.getName())) {
                definitiveParameterList.add(parameter.getName());
            }
            response.addParameter(parameter);
        }
        parameterOrderPosition++;
    }
}
Also used : Message(com.sun.tools.ws.wsdl.document.Message) TWSDLExtensible(com.sun.tools.ws.api.wsdl.TWSDLExtensible) QName(javax.xml.namespace.QName)

Example 2 with TWSDLExtensible

use of com.sun.tools.ws.api.wsdl.TWSDLExtensible in project metro-jax-ws by eclipse-ee4j.

the class WSDLModeler method getHeaderParts.

private List<MessagePart> getHeaderParts(BindingOperation bindingOperation, boolean isInput) {
    TWSDLExtensible ext;
    if (isInput) {
        ext = bindingOperation.getInput();
    } else {
        ext = bindingOperation.getOutput();
    }
    List<MessagePart> parts = new ArrayList<>();
    Iterator<SOAPHeader> headers = getHeaderExtensions(ext).iterator();
    while (headers.hasNext()) {
        SOAPHeader header = headers.next();
        if (!header.isLiteral()) {
            error(header, ModelerMessages.WSDLMODELER_INVALID_HEADER_NOT_LITERAL(header.getPart(), bindingOperation.getName()));
        }
        if (header.getNamespace() != null) {
            warning(header, ModelerMessages.WSDLMODELER_WARNING_R_2716_R_2726("soapbind:header", bindingOperation.getName()));
        }
        com.sun.tools.ws.wsdl.document.Message headerMessage = findMessage(header.getMessage(), document);
        if (headerMessage == null) {
            error(header, ModelerMessages.WSDLMODELER_INVALID_HEADER_CANT_RESOLVE_MESSAGE(header.getMessage(), bindingOperation.getName()));
        }
        MessagePart part = headerMessage.getPart(header.getPart());
        if (part == null) {
            error(header, ModelerMessages.WSDLMODELER_INVALID_HEADER_NOT_FOUND(header.getPart(), bindingOperation.getName()));
        }
        if (part.getDescriptorKind() != SchemaKinds.XSD_ELEMENT) {
            if (options.isExtensionMode()) {
                warning(part, ModelerMessages.WSDLMODELER_INVALID_HEADER_MESSAGE_PART_MUST_HAVE_ELEMENT_DESCRIPTOR(part.getName(), bindingOperation.getName()));
            } else {
                error(part, ModelerMessages.WSDLMODELER_INVALID_HEADER_MESSAGE_PART_MUST_HAVE_ELEMENT_DESCRIPTOR(part.getName(), bindingOperation.getName()));
            }
        }
        part.setBindingExtensibilityElementKind(MessagePart.SOAP_HEADER_BINDING);
        parts.add(part);
    }
    return parts;
}
Also used : Message(com.sun.tools.ws.wsdl.document.Message) TWSDLExtensible(com.sun.tools.ws.api.wsdl.TWSDLExtensible) com.sun.tools.ws.wsdl.document(com.sun.tools.ws.wsdl.document)

Aggregations

TWSDLExtensible (com.sun.tools.ws.api.wsdl.TWSDLExtensible)2 Message (com.sun.tools.ws.wsdl.document.Message)2 com.sun.tools.ws.wsdl.document (com.sun.tools.ws.wsdl.document)1 QName (javax.xml.namespace.QName)1