com.sun.tools.internal.ws.resources.ModelerMessages Java Examples

The following examples show how to use com.sun.tools.internal.ws.resources.ModelerMessages. 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: WSDLModeler.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/**
 * @param part
 * @return Returns a JAXBType object
 */
private JAXBType getJAXBType(MessagePart part) {
    JAXBType type;
    QName name = part.getDescriptor();
    if (part.getDescriptorKind().equals(SchemaKinds.XSD_ELEMENT)) {
        type = getJAXBModelBuilder().getJAXBType(name);
        if(type == null){
            error(part, ModelerMessages.WSDLMODELER_JAXB_JAVATYPE_NOTFOUND(name, part.getName()));
        }
    } else {
        S2JJAXBModel jaxbModel = getJAXBModelBuilder().getJAXBModel().getS2JJAXBModel();
        TypeAndAnnotation typeAnno = jaxbModel.getJavaType(name);
        if (typeAnno == null) {
            error(part, ModelerMessages.WSDLMODELER_JAXB_JAVATYPE_NOTFOUND(name, part.getName()));
        }
        JavaType javaType = new JavaSimpleType(new JAXBTypeAndAnnotation(typeAnno));
        type = new JAXBType(new QName("", part.getName()), javaType);
    }
    return type;
}
 
Example #2
Source File: WSDLModelerBase.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * @return List of SOAPHeader extensions
 */
protected List<SOAPHeader> getHeaderExtensions(TWSDLExtensible extensible) {
    List<SOAPHeader> headerList = new ArrayList<SOAPHeader>();
    for (TWSDLExtension extension : extensible.extensions()) {
        if (extension.getClass()==MIMEMultipartRelated.class) {
            for( MIMEPart part : ((MIMEMultipartRelated) extension).getParts() ) {
                boolean isRootPart = isRootPart(part);
                for (TWSDLExtension obj : part.extensions()) {
                    if (obj instanceof SOAPHeader) {
                        //bug fix: 5024015
                        if (!isRootPart) {
                            warning((Entity) obj, ModelerMessages.MIMEMODELER_WARNING_IGNORINGINVALID_HEADER_PART_NOT_DECLARED_IN_ROOT_PART(info.bindingOperation.getName()));
                            return new ArrayList<SOAPHeader>();
                        }
                        headerList.add((SOAPHeader) obj);
                    }
                }
            }
        } else if (extension instanceof SOAPHeader) {
            headerList.add((SOAPHeader) extension);
        }
    }
     return headerList;
}
 
Example #3
Source File: WSDLModeler.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
private List<MessagePart> getBodyParts(SOAPBody body, Message message) {
    String bodyParts = body.getParts();
    if (bodyParts != null) {
        List<MessagePart> partsList = new ArrayList<MessagePart>();
        StringTokenizer in = new StringTokenizer(bodyParts.trim(), " ");
        while (in.hasMoreTokens()) {
            String part = in.nextToken();
            MessagePart mPart = message.getPart(part);
            if (null == mPart) {
                error(message, ModelerMessages.WSDLMODELER_ERROR_PARTS_NOT_FOUND(part, message.getName()));
            }
            mPart.setBindingExtensibilityElementKind(MessagePart.SOAP_BODY_BINDING);
            partsList.add(mPart);
        }
        return partsList;
    }
    return null;
}
 
Example #4
Source File: WSDLModeler.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
private boolean applyOperationNameCustomization() {
    JAXWSBinding jaxwsCustomization = (JAXWSBinding) getExtensionOfType(info.portTypeOperation, JAXWSBinding.class);
    String operationName = (jaxwsCustomization != null) ? ((jaxwsCustomization.getMethodName() != null) ? jaxwsCustomization.getMethodName().getName() : null) : null;
    if (operationName != null) {
        if (Names.isJavaReservedWord(operationName)) {
            if (options.isExtensionMode()) {
                warning(info.portTypeOperation, ModelerMessages.WSDLMODELER_WARNING_IGNORING_OPERATION_JAVA_RESERVED_WORD_NOT_ALLOWED_CUSTOMIZED_OPERATION_NAME(info.operation.getName(), operationName));
            } else {
                error(info.portTypeOperation, ModelerMessages.WSDLMODELER_INVALID_OPERATION_JAVA_RESERVED_WORD_NOT_ALLOWED_CUSTOMIZED_OPERATION_NAME(info.operation.getName(), operationName));
            }
            return false;
        }

        info.operation.setCustomizedName(operationName);
    }

    if (Names.isJavaReservedWord(info.operation.getJavaMethodName())) {
        if (options.isExtensionMode()) {
            warning(info.portTypeOperation, ModelerMessages.WSDLMODELER_WARNING_IGNORING_OPERATION_JAVA_RESERVED_WORD_NOT_ALLOWED_OPERATION_NAME(info.operation.getName()));
        } else {
            error(info.portTypeOperation, ModelerMessages.WSDLMODELER_INVALID_OPERATION_JAVA_RESERVED_WORD_NOT_ALLOWED_OPERATION_NAME(info.operation.getName()));
        }
        return false;
    }
    return true;
}
 
Example #5
Source File: WSDLModelerBase.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * @param mimeParts
 */
protected boolean validateMimeParts(Iterable<MIMEPart> mimeParts) {
    boolean gotRootPart = false;
    List<MIMEContent> mimeContents = new ArrayList<MIMEContent>();
    for (MIMEPart mPart : mimeParts) {
        for (TWSDLExtension obj : mPart.extensions()) {
            if (obj instanceof SOAPBody) {
                if (gotRootPart) {
                    warning(mPart, ModelerMessages.MIMEMODELER_INVALID_MIME_PART_MORE_THAN_ONE_SOAP_BODY(info.operation.getName().getLocalPart()));
                    return false;
                }
                gotRootPart = true;
            } else if (obj instanceof MIMEContent) {
                mimeContents.add((MIMEContent) obj);
            }
        }
        if (!validateMimeContentPartNames(mimeContents)) {
            return false;
        }
        if(mPart.getName() != null) {
            warning(mPart, ModelerMessages.MIMEMODELER_INVALID_MIME_PART_NAME_NOT_ALLOWED(info.portTypeOperation.getName()));
        }
    }
    return true;

}
 
Example #6
Source File: WSDLModeler.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
private List<MessagePart> getBodyParts(SOAPBody body, Message message) {
    String bodyParts = body.getParts();
    if (bodyParts != null) {
        List<MessagePart> partsList = new ArrayList<MessagePart>();
        StringTokenizer in = new StringTokenizer(bodyParts.trim(), " ");
        while (in.hasMoreTokens()) {
            String part = in.nextToken();
            MessagePart mPart = message.getPart(part);
            if (null == mPart) {
                error(message, ModelerMessages.WSDLMODELER_ERROR_PARTS_NOT_FOUND(part, message.getName()));
            }
            mPart.setBindingExtensibilityElementKind(MessagePart.SOAP_BODY_BINDING);
            partsList.add(mPart);
        }
        return partsList;
    }
    return null;
}
 
Example #7
Source File: WSDLModeler.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
private boolean applyOperationNameCustomization() {
    JAXWSBinding jaxwsCustomization = (JAXWSBinding) getExtensionOfType(info.portTypeOperation, JAXWSBinding.class);
    String operationName = (jaxwsCustomization != null) ? ((jaxwsCustomization.getMethodName() != null) ? jaxwsCustomization.getMethodName().getName() : null) : null;
    if (operationName != null) {
        if (Names.isJavaReservedWord(operationName)) {
            if (options.isExtensionMode()) {
                warning(info.portTypeOperation, ModelerMessages.WSDLMODELER_WARNING_IGNORING_OPERATION_JAVA_RESERVED_WORD_NOT_ALLOWED_CUSTOMIZED_OPERATION_NAME(info.operation.getName(), operationName));
            } else {
                error(info.portTypeOperation, ModelerMessages.WSDLMODELER_INVALID_OPERATION_JAVA_RESERVED_WORD_NOT_ALLOWED_CUSTOMIZED_OPERATION_NAME(info.operation.getName(), operationName));
            }
            return false;
        }

        info.operation.setCustomizedName(operationName);
    }

    if (Names.isJavaReservedWord(info.operation.getJavaMethodName())) {
        if (options.isExtensionMode()) {
            warning(info.portTypeOperation, ModelerMessages.WSDLMODELER_WARNING_IGNORING_OPERATION_JAVA_RESERVED_WORD_NOT_ALLOWED_OPERATION_NAME(info.operation.getName()));
        } else {
            error(info.portTypeOperation, ModelerMessages.WSDLMODELER_INVALID_OPERATION_JAVA_RESERVED_WORD_NOT_ALLOWED_OPERATION_NAME(info.operation.getName()));
        }
        return false;
    }
    return true;
}
 
Example #8
Source File: WSDLModeler.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * @param part
 * @return Returns a JAXBType object
 */
private JAXBType getJAXBType(MessagePart part) {
    JAXBType type;
    QName name = part.getDescriptor();
    if (part.getDescriptorKind().equals(SchemaKinds.XSD_ELEMENT)) {
        type = getJAXBModelBuilder().getJAXBType(name);
        if(type == null){
            error(part, ModelerMessages.WSDLMODELER_JAXB_JAVATYPE_NOTFOUND(name, part.getName()));
        }
    } else {
        S2JJAXBModel jaxbModel = getJAXBModelBuilder().getJAXBModel().getS2JJAXBModel();
        TypeAndAnnotation typeAnno = jaxbModel.getJavaType(name);
        if (typeAnno == null) {
            error(part, ModelerMessages.WSDLMODELER_JAXB_JAVATYPE_NOTFOUND(name, part.getName()));
        }
        JavaType javaType = new JavaSimpleType(new JAXBTypeAndAnnotation(typeAnno));
        type = new JAXBType(new QName("", part.getName()), javaType);
    }
    return type;
}
 
Example #9
Source File: WSDLModelerBase.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/**
 * @return List of SOAPHeader extensions
 */
protected List<SOAPHeader> getHeaderExtensions(TWSDLExtensible extensible) {
    List<SOAPHeader> headerList = new ArrayList<SOAPHeader>();
    for (TWSDLExtension extension : extensible.extensions()) {
        if (extension.getClass()==MIMEMultipartRelated.class) {
            for( MIMEPart part : ((MIMEMultipartRelated) extension).getParts() ) {
                boolean isRootPart = isRootPart(part);
                for (TWSDLExtension obj : part.extensions()) {
                    if (obj instanceof SOAPHeader) {
                        //bug fix: 5024015
                        if (!isRootPart) {
                            warning((Entity) obj, ModelerMessages.MIMEMODELER_WARNING_IGNORINGINVALID_HEADER_PART_NOT_DECLARED_IN_ROOT_PART(info.bindingOperation.getName()));
                            return new ArrayList<SOAPHeader>();
                        }
                        headerList.add((SOAPHeader) obj);
                    }
                }
            }
        } else if (extension instanceof SOAPHeader) {
            headerList.add((SOAPHeader) extension);
        }
    }
     return headerList;
}
 
Example #10
Source File: WSDLModelerBase.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * @return List of SOAPHeader extensions
 */
protected List<SOAPHeader> getHeaderExtensions(TWSDLExtensible extensible) {
    List<SOAPHeader> headerList = new ArrayList<SOAPHeader>();
    for (TWSDLExtension extension : extensible.extensions()) {
        if (extension.getClass()==MIMEMultipartRelated.class) {
            for( MIMEPart part : ((MIMEMultipartRelated) extension).getParts() ) {
                boolean isRootPart = isRootPart(part);
                for (TWSDLExtension obj : part.extensions()) {
                    if (obj instanceof SOAPHeader) {
                        //bug fix: 5024015
                        if (!isRootPart) {
                            warning((Entity) obj, ModelerMessages.MIMEMODELER_WARNING_IGNORINGINVALID_HEADER_PART_NOT_DECLARED_IN_ROOT_PART(info.bindingOperation.getName()));
                            return new ArrayList<SOAPHeader>();
                        }
                        headerList.add((SOAPHeader) obj);
                    }
                }
            }
        } else if (extension instanceof SOAPHeader) {
            headerList.add((SOAPHeader) extension);
        }
    }
     return headerList;
}
 
Example #11
Source File: WSDLModeler.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
private List<MessagePart> getBodyParts(SOAPBody body, Message message) {
    String bodyParts = body.getParts();
    if (bodyParts != null) {
        List<MessagePart> partsList = new ArrayList<MessagePart>();
        StringTokenizer in = new StringTokenizer(bodyParts.trim(), " ");
        while (in.hasMoreTokens()) {
            String part = in.nextToken();
            MessagePart mPart = message.getPart(part);
            if (null == mPart) {
                error(message, ModelerMessages.WSDLMODELER_ERROR_PARTS_NOT_FOUND(part, message.getName()));
            }
            mPart.setBindingExtensibilityElementKind(MessagePart.SOAP_BODY_BINDING);
            partsList.add(mPart);
        }
        return partsList;
    }
    return null;
}
 
Example #12
Source File: WSDLModelerBase.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
/**
 * @param mimeParts
 */
protected boolean validateMimeParts(Iterable<MIMEPart> mimeParts) {
    boolean gotRootPart = false;
    List<MIMEContent> mimeContents = new ArrayList<MIMEContent>();
    for (MIMEPart mPart : mimeParts) {
        for (TWSDLExtension obj : mPart.extensions()) {
            if (obj instanceof SOAPBody) {
                if (gotRootPart) {
                    warning(mPart, ModelerMessages.MIMEMODELER_INVALID_MIME_PART_MORE_THAN_ONE_SOAP_BODY(info.operation.getName().getLocalPart()));
                    return false;
                }
                gotRootPart = true;
            } else if (obj instanceof MIMEContent) {
                mimeContents.add((MIMEContent) obj);
            }
        }
        if (!validateMimeContentPartNames(mimeContents)) {
            return false;
        }
        if(mPart.getName() != null) {
            warning(mPart, ModelerMessages.MIMEMODELER_INVALID_MIME_PART_NAME_NOT_ALLOWED(info.portTypeOperation.getName()));
        }
    }
    return true;

}
 
Example #13
Source File: WSDLModeler.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
private boolean applyOperationNameCustomization() {
    JAXWSBinding jaxwsCustomization = (JAXWSBinding) getExtensionOfType(info.portTypeOperation, JAXWSBinding.class);
    String operationName = (jaxwsCustomization != null) ? ((jaxwsCustomization.getMethodName() != null) ? jaxwsCustomization.getMethodName().getName() : null) : null;
    if (operationName != null) {
        if (Names.isJavaReservedWord(operationName)) {
            if (options.isExtensionMode()) {
                warning(info.portTypeOperation, ModelerMessages.WSDLMODELER_WARNING_IGNORING_OPERATION_JAVA_RESERVED_WORD_NOT_ALLOWED_CUSTOMIZED_OPERATION_NAME(info.operation.getName(), operationName));
            } else {
                error(info.portTypeOperation, ModelerMessages.WSDLMODELER_INVALID_OPERATION_JAVA_RESERVED_WORD_NOT_ALLOWED_CUSTOMIZED_OPERATION_NAME(info.operation.getName(), operationName));
            }
            return false;
        }

        info.operation.setCustomizedName(operationName);
    }

    if (Names.isJavaReservedWord(info.operation.getJavaMethodName())) {
        if (options.isExtensionMode()) {
            warning(info.portTypeOperation, ModelerMessages.WSDLMODELER_WARNING_IGNORING_OPERATION_JAVA_RESERVED_WORD_NOT_ALLOWED_OPERATION_NAME(info.operation.getName()));
        } else {
            error(info.portTypeOperation, ModelerMessages.WSDLMODELER_INVALID_OPERATION_JAVA_RESERVED_WORD_NOT_ALLOWED_OPERATION_NAME(info.operation.getName()));
        }
        return false;
    }
    return true;
}
 
Example #14
Source File: WSDLModeler.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
private boolean applyOperationNameCustomization() {
    JAXWSBinding jaxwsCustomization = (JAXWSBinding) getExtensionOfType(info.portTypeOperation, JAXWSBinding.class);
    String operationName = (jaxwsCustomization != null) ? ((jaxwsCustomization.getMethodName() != null) ? jaxwsCustomization.getMethodName().getName() : null) : null;
    if (operationName != null) {
        if (Names.isJavaReservedWord(operationName)) {
            if (options.isExtensionMode()) {
                warning(info.portTypeOperation, ModelerMessages.WSDLMODELER_WARNING_IGNORING_OPERATION_JAVA_RESERVED_WORD_NOT_ALLOWED_CUSTOMIZED_OPERATION_NAME(info.operation.getName(), operationName));
            } else {
                error(info.portTypeOperation, ModelerMessages.WSDLMODELER_INVALID_OPERATION_JAVA_RESERVED_WORD_NOT_ALLOWED_CUSTOMIZED_OPERATION_NAME(info.operation.getName(), operationName));
            }
            return false;
        }

        info.operation.setCustomizedName(operationName);
    }

    if (Names.isJavaReservedWord(info.operation.getJavaMethodName())) {
        if (options.isExtensionMode()) {
            warning(info.portTypeOperation, ModelerMessages.WSDLMODELER_WARNING_IGNORING_OPERATION_JAVA_RESERVED_WORD_NOT_ALLOWED_OPERATION_NAME(info.operation.getName()));
        } else {
            error(info.portTypeOperation, ModelerMessages.WSDLMODELER_INVALID_OPERATION_JAVA_RESERVED_WORD_NOT_ALLOWED_OPERATION_NAME(info.operation.getName()));
        }
        return false;
    }
    return true;
}
 
Example #15
Source File: WSDLModeler.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
private List<MessagePart> getBodyParts(SOAPBody body, Message message) {
    String bodyParts = body.getParts();
    if (bodyParts != null) {
        List<MessagePart> partsList = new ArrayList<MessagePart>();
        StringTokenizer in = new StringTokenizer(bodyParts.trim(), " ");
        while (in.hasMoreTokens()) {
            String part = in.nextToken();
            MessagePart mPart = message.getPart(part);
            if (null == mPart) {
                error(message, ModelerMessages.WSDLMODELER_ERROR_PARTS_NOT_FOUND(part, message.getName()));
            }
            mPart.setBindingExtensibilityElementKind(MessagePart.SOAP_BODY_BINDING);
            partsList.add(mPart);
        }
        return partsList;
    }
    return null;
}
 
Example #16
Source File: WSDLModeler.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
private boolean applyOperationNameCustomization() {
    JAXWSBinding jaxwsCustomization = (JAXWSBinding) getExtensionOfType(info.portTypeOperation, JAXWSBinding.class);
    String operationName = (jaxwsCustomization != null) ? ((jaxwsCustomization.getMethodName() != null) ? jaxwsCustomization.getMethodName().getName() : null) : null;
    if (operationName != null) {
        if (Names.isJavaReservedWord(operationName)) {
            if (options.isExtensionMode()) {
                warning(info.portTypeOperation, ModelerMessages.WSDLMODELER_WARNING_IGNORING_OPERATION_JAVA_RESERVED_WORD_NOT_ALLOWED_CUSTOMIZED_OPERATION_NAME(info.operation.getName(), operationName));
            } else {
                error(info.portTypeOperation, ModelerMessages.WSDLMODELER_INVALID_OPERATION_JAVA_RESERVED_WORD_NOT_ALLOWED_CUSTOMIZED_OPERATION_NAME(info.operation.getName(), operationName));
            }
            return false;
        }

        info.operation.setCustomizedName(operationName);
    }

    if (Names.isJavaReservedWord(info.operation.getJavaMethodName())) {
        if (options.isExtensionMode()) {
            warning(info.portTypeOperation, ModelerMessages.WSDLMODELER_WARNING_IGNORING_OPERATION_JAVA_RESERVED_WORD_NOT_ALLOWED_OPERATION_NAME(info.operation.getName()));
        } else {
            error(info.portTypeOperation, ModelerMessages.WSDLMODELER_INVALID_OPERATION_JAVA_RESERVED_WORD_NOT_ALLOWED_OPERATION_NAME(info.operation.getName()));
        }
        return false;
    }
    return true;
}
 
Example #17
Source File: WSDLModeler.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * @param part
 * @return Returns a JAXBType object
 */
private JAXBType getJAXBType(MessagePart part) {
    JAXBType type;
    QName name = part.getDescriptor();
    if (part.getDescriptorKind().equals(SchemaKinds.XSD_ELEMENT)) {
        type = getJAXBModelBuilder().getJAXBType(name);
        if(type == null){
            error(part, ModelerMessages.WSDLMODELER_JAXB_JAVATYPE_NOTFOUND(name, part.getName()));
        }
    } else {
        S2JJAXBModel jaxbModel = getJAXBModelBuilder().getJAXBModel().getS2JJAXBModel();
        TypeAndAnnotation typeAnno = jaxbModel.getJavaType(name);
        if (typeAnno == null) {
            error(part, ModelerMessages.WSDLMODELER_JAXB_JAVATYPE_NOTFOUND(name, part.getName()));
        }
        JavaType javaType = new JavaSimpleType(new JAXBTypeAndAnnotation(typeAnno));
        type = new JAXBType(new QName("", part.getName()), javaType);
    }
    return type;
}
 
Example #18
Source File: WSDLModelerBase.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * @return List of SOAPHeader extensions
 */
protected List<SOAPHeader> getHeaderExtensions(TWSDLExtensible extensible) {
    List<SOAPHeader> headerList = new ArrayList<SOAPHeader>();
    for (TWSDLExtension extension : extensible.extensions()) {
        if (extension.getClass()==MIMEMultipartRelated.class) {
            for( MIMEPart part : ((MIMEMultipartRelated) extension).getParts() ) {
                boolean isRootPart = isRootPart(part);
                for (TWSDLExtension obj : part.extensions()) {
                    if (obj instanceof SOAPHeader) {
                        //bug fix: 5024015
                        if (!isRootPart) {
                            warning((Entity) obj, ModelerMessages.MIMEMODELER_WARNING_IGNORINGINVALID_HEADER_PART_NOT_DECLARED_IN_ROOT_PART(info.bindingOperation.getName()));
                            return new ArrayList<SOAPHeader>();
                        }
                        headerList.add((SOAPHeader) obj);
                    }
                }
            }
        } else if (extension instanceof SOAPHeader) {
            headerList.add((SOAPHeader) extension);
        }
    }
     return headerList;
}
 
Example #19
Source File: WSDLModelerBase.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * @param mimeParts
 */
protected boolean validateMimeParts(Iterable<MIMEPart> mimeParts) {
    boolean gotRootPart = false;
    List<MIMEContent> mimeContents = new ArrayList<MIMEContent>();
    for (MIMEPart mPart : mimeParts) {
        for (TWSDLExtension obj : mPart.extensions()) {
            if (obj instanceof SOAPBody) {
                if (gotRootPart) {
                    warning(mPart, ModelerMessages.MIMEMODELER_INVALID_MIME_PART_MORE_THAN_ONE_SOAP_BODY(info.operation.getName().getLocalPart()));
                    return false;
                }
                gotRootPart = true;
            } else if (obj instanceof MIMEContent) {
                mimeContents.add((MIMEContent) obj);
            }
        }
        if (!validateMimeContentPartNames(mimeContents)) {
            return false;
        }
        if(mPart.getName() != null) {
            warning(mPart, ModelerMessages.MIMEMODELER_INVALID_MIME_PART_NAME_NOT_ALLOWED(info.portTypeOperation.getName()));
        }
    }
    return true;

}
 
Example #20
Source File: WSDLModelerBase.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * @param mimeParts
 */
protected boolean validateMimeParts(Iterable<MIMEPart> mimeParts) {
    boolean gotRootPart = false;
    List<MIMEContent> mimeContents = new ArrayList<MIMEContent>();
    for (MIMEPart mPart : mimeParts) {
        for (TWSDLExtension obj : mPart.extensions()) {
            if (obj instanceof SOAPBody) {
                if (gotRootPart) {
                    warning(mPart, ModelerMessages.MIMEMODELER_INVALID_MIME_PART_MORE_THAN_ONE_SOAP_BODY(info.operation.getName().getLocalPart()));
                    return false;
                }
                gotRootPart = true;
            } else if (obj instanceof MIMEContent) {
                mimeContents.add((MIMEContent) obj);
            }
        }
        if (!validateMimeContentPartNames(mimeContents)) {
            return false;
        }
        if(mPart.getName() != null) {
            warning(mPart, ModelerMessages.MIMEMODELER_INVALID_MIME_PART_NAME_NOT_ALLOWED(info.portTypeOperation.getName()));
        }
    }
    return true;

}
 
Example #21
Source File: WSDLModeler.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
/**
 * @param part
 * @return Returns a JAXBType object
 */
private JAXBType getJAXBType(MessagePart part) {
    JAXBType type;
    QName name = part.getDescriptor();
    if (part.getDescriptorKind().equals(SchemaKinds.XSD_ELEMENT)) {
        type = getJAXBModelBuilder().getJAXBType(name);
        if(type == null){
            error(part, ModelerMessages.WSDLMODELER_JAXB_JAVATYPE_NOTFOUND(name, part.getName()));
        }
    } else {
        S2JJAXBModel jaxbModel = getJAXBModelBuilder().getJAXBModel().getS2JJAXBModel();
        TypeAndAnnotation typeAnno = jaxbModel.getJavaType(name);
        if (typeAnno == null) {
            error(part, ModelerMessages.WSDLMODELER_JAXB_JAVATYPE_NOTFOUND(name, part.getName()));
        }
        JavaType javaType = new JavaSimpleType(new JAXBTypeAndAnnotation(typeAnno));
        type = new JAXBType(new QName("", part.getName()), javaType);
    }
    return type;
}
 
Example #22
Source File: WSDLModeler.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
private List<MessagePart> getHeaderParts(BindingOperation bindingOperation, boolean isInput) {
    TWSDLExtensible ext;
    if (isInput) {
        ext = bindingOperation.getInput();
    } else {
        ext = bindingOperation.getOutput();
    }

    List<MessagePart> parts = new ArrayList<MessagePart>();
    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.internal.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;
}
 
Example #23
Source File: WSDLModelerBase.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
protected SOAPBody getSOAPResponseBody() {
    SOAPBody responseBody =
        (SOAPBody)getAnyExtensionOfType(info.bindingOperation.getOutput(),
            SOAPBody.class);
    if (responseBody == null) {
        // the WSDL document is invalid
        error(info.bindingOperation.getOutput(),  ModelerMessages.WSDLMODELER_INVALID_BINDING_OPERATION_OUTPUT_MISSING_SOAP_BODY(info.bindingOperation.getName()));
    }
    return responseBody;
}
 
Example #24
Source File: WSDLModelerBase.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private boolean validateMimeContentPartNames(List<MIMEContent> mimeContents) {
    //validate mime:content(s) in the mime:part as per R2909
    for (MIMEContent mimeContent : mimeContents) {
        String mimeContnetPart;
        mimeContnetPart = getMimeContentPartName(mimeContent);
        if(mimeContnetPart == null) {
            warning(mimeContent, ModelerMessages.MIMEMODELER_INVALID_MIME_CONTENT_MISSING_PART_ATTRIBUTE(info.operation.getName().getLocalPart()));
            return false;
        }
    }
    return true;
}
 
Example #25
Source File: ModelerUtils.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public static List<Parameter> createRpcLitParameters(Message message, Block block, S2JJAXBModel jaxbModel, ErrorReceiverFilter errReceiver){
    RpcLitStructure rpcStruct = (RpcLitStructure)block.getType();

    List<Parameter> parameters = new ArrayList<Parameter>();
    for(MessagePart part : message.getParts()){
        if(!ModelerUtils.isBoundToSOAPBody(part))
            continue;
        QName name = part.getDescriptor();
        TypeAndAnnotation typeAndAnn = jaxbModel.getJavaType(name);
        if(typeAndAnn == null){
            String msgQName = "{"+message.getDefining().getTargetNamespaceURI()+"}"+message.getName();
            errReceiver.error(part.getLocator(), ModelerMessages.WSDLMODELER_RPCLIT_UNKOWNSCHEMATYPE(name.toString(),
                    part.getName(), msgQName));
            throw new AbortException();
        }
        String type = typeAndAnn.getTypeClass().fullName();
        type = ClassNameInfo.getGenericClass(type);
        RpcLitMember param = new RpcLitMember(new QName("", part.getName()), type);
        JavaType javaType = new JavaSimpleType(new JAXBTypeAndAnnotation(typeAndAnn));
        param.setJavaType(javaType);
        rpcStruct.addRpcLitMember(param);
        Parameter parameter = ModelerUtils.createParameter(part.getName(), param, block);
        parameter.setEmbedded(true);
        parameters.add(parameter);
    }
    return parameters;
}
 
Example #26
Source File: WSDLModelerBase.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
protected String getResponseNamespaceURI(SOAPBody body) {
    String namespaceURI = body.getNamespace();
    if (namespaceURI == null) {
        if(options.isExtensionMode()){
            return info.modelPort.getName().getNamespaceURI();
        }
        // the WSDL document is invalid
        // at least, that's my interpretation of section 3.5 of the WSDL 1.1 spec!
        error(body, ModelerMessages.WSDLMODELER_INVALID_BINDING_OPERATION_OUTPUT_SOAP_BODY_MISSING_NAMESPACE(info.bindingOperation.getName()));
    }
    return namespaceURI;
}
 
Example #27
Source File: WSDLModelerBase.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
protected String getResponseNamespaceURI(SOAPBody body) {
    String namespaceURI = body.getNamespace();
    if (namespaceURI == null) {
        if(options.isExtensionMode()){
            return info.modelPort.getName().getNamespaceURI();
        }
        // the WSDL document is invalid
        // at least, that's my interpretation of section 3.5 of the WSDL 1.1 spec!
        error(body, ModelerMessages.WSDLMODELER_INVALID_BINDING_OPERATION_OUTPUT_SOAP_BODY_MISSING_NAMESPACE(info.bindingOperation.getName()));
    }
    return namespaceURI;
}
 
Example #28
Source File: WSDLModelerBase.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
protected String getResponseNamespaceURI(SOAPBody body) {
    String namespaceURI = body.getNamespace();
    if (namespaceURI == null) {
        if(options.isExtensionMode()){
            return info.modelPort.getName().getNamespaceURI();
        }
        // the WSDL document is invalid
        // at least, that's my interpretation of section 3.5 of the WSDL 1.1 spec!
        error(body, ModelerMessages.WSDLMODELER_INVALID_BINDING_OPERATION_OUTPUT_SOAP_BODY_MISSING_NAMESPACE(info.bindingOperation.getName()));
    }
    return namespaceURI;
}
 
Example #29
Source File: WSDLModelerBase.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
protected SOAPBody getSOAPRequestBody() {
    SOAPBody requestBody =
        (SOAPBody)getAnyExtensionOfType(info.bindingOperation.getInput(),
            SOAPBody.class);
    if (requestBody == null) {
        // the WSDL document is invalid
        error(info.bindingOperation.getInput(), ModelerMessages.WSDLMODELER_INVALID_BINDING_OPERATION_INPUT_MISSING_SOAP_BODY(info.bindingOperation.getName()));
    }
    return requestBody;
}
 
Example #30
Source File: WSDLModelerBase.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
protected String getRequestNamespaceURI(SOAPBody body) {
    String namespaceURI = body.getNamespace();
    if (namespaceURI == null) {
        if(options.isExtensionMode()){
            return info.modelPort.getName().getNamespaceURI();
        }
        // the WSDL document is invalid
        // at least, that's my interpretation of section 3.5 of the WSDL 1.1 spec!
        error(body, ModelerMessages.WSDLMODELER_INVALID_BINDING_OPERATION_INPUT_SOAP_BODY_MISSING_NAMESPACE(info.bindingOperation.getName()));
    }
    return namespaceURI;
}