Java Code Examples for javax.jws.WebResult#targetNamespace()

The following examples show how to use javax.jws.WebResult#targetNamespace() . 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: JaxWsServiceConfiguration.java    From cxf with Apache License 2.0 5 votes vote down vote up
@Override
public QName getOutParameterName(OperationInfo op, Method method, int paramNumber) {
    method = getDeclaredMethod(method);

    if (paramNumber >= 0) {
        return getParameterName(op, method, paramNumber, op.getOutput().size(), "return", false);
    }
    WebResult webResult = getWebResult(method);

    String tns = null;
    String local = null;
    if (webResult != null) {
        tns = webResult.targetNamespace();
        local = webResult.name();
    }
    if (tns == null || tns.length() == 0) {
        QName wrappername = getResponseWrapperName(op, method);
        if (wrappername != null) {
            tns = wrappername.getNamespaceURI();
        }
    }

    if (tns == null || tns.length() == 0) {
        tns = op.getName().getNamespaceURI();
    }

    if (local == null || local.length() == 0) {
        if (Boolean.TRUE.equals(isRPC(method)) || !Boolean.FALSE.equals(isWrapped(method))) {
            local = getDefaultLocalName(op, method, paramNumber, op.getOutput().size(), "return");
        } else {
            local = getOperationName(op.getInterface(),
                                     method).getLocalPart() + "Response";
        }
    }

    return new QName(tns, local);
}
 
Example 2
Source File: AbstractWrapperBeanGenerator.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Computes response bean members for a method. Collects all OUT and INOUT
 * parameters as response bean fields. In this process, if a parameter
 * has any known JAXB annotations they are collected as well.
 * Special processing for @XmlElement annotation is done.
 *
 * @param method SEI method for which response bean members are computed
 * @return List of response bean members
 */
public List<A> collectResponseBeanMembers(M method) {

    List<A> responseMembers = new ArrayList<A>();

    // return that need to be part response wrapper bean
    String responseElementName = RETURN;
    String responseNamespace = EMTPY_NAMESPACE_ID;
    boolean isResultHeader = false;
    WebResult webResult = annReader.getMethodAnnotation(WebResult.class, method ,null);
    if (webResult != null) {
        if (webResult.name().length() > 0) {
            responseElementName = webResult.name();
        }
        if (webResult.targetNamespace().length() > 0) {
            responseNamespace = webResult.targetNamespace();
        }
        isResultHeader = webResult.header();
    }
    T returnType = getSafeType(nav.getReturnType(method));
    if (!isVoidType(returnType) && !isResultHeader) {
        List<Annotation> jaxbRespAnnotations = collectJAXBAnnotations(method);
        processXmlElement(jaxbRespAnnotations, responseElementName, responseNamespace, returnType);
        responseMembers.add(factory.createWrapperBeanMember(returnType, getPropertyName(responseElementName), jaxbRespAnnotations));
    }

    // Now parameters that need to be part response wrapper bean
    int paramIndex = -1;
    for (T param : nav.getMethodParameters(method)) {
        paramIndex++;

        T paramType = getHolderValueType(param);
        WebParam webParam = annReader.getMethodParameterAnnotation(WebParam.class, method, paramIndex, null);
        if (paramType == null || (webParam != null && webParam.header())) {
            continue;       // not a holder or a header - so don't add it
        }

        String paramName = (webParam != null && webParam.name().length() > 0)
                ? webParam.name() : "arg"+paramIndex;
        String paramNamespace = (webParam != null && webParam.targetNamespace().length() > 0)
                ? webParam.targetNamespace() : EMTPY_NAMESPACE_ID;
        List<Annotation> jaxbAnnotation = collectJAXBAnnotations(method, paramIndex);
        processXmlElement(jaxbAnnotation, paramName, paramNamespace, paramType);
        A member = factory.createWrapperBeanMember(paramType,
                getPropertyName(paramName), jaxbAnnotation);
        responseMembers.add(member);
    }

    return responseMembers;
}
 
Example 3
Source File: AbstractWrapperBeanGenerator.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Computes response bean members for a method. Collects all OUT and INOUT
 * parameters as response bean fields. In this process, if a parameter
 * has any known JAXB annotations they are collected as well.
 * Special processing for @XmlElement annotation is done.
 *
 * @param method SEI method for which response bean members are computed
 * @return List of response bean members
 */
public List<A> collectResponseBeanMembers(M method) {

    List<A> responseMembers = new ArrayList<A>();

    // return that need to be part response wrapper bean
    String responseElementName = RETURN;
    String responseNamespace = EMTPY_NAMESPACE_ID;
    boolean isResultHeader = false;
    WebResult webResult = annReader.getMethodAnnotation(WebResult.class, method ,null);
    if (webResult != null) {
        if (webResult.name().length() > 0) {
            responseElementName = webResult.name();
        }
        if (webResult.targetNamespace().length() > 0) {
            responseNamespace = webResult.targetNamespace();
        }
        isResultHeader = webResult.header();
    }
    T returnType = getSafeType(nav.getReturnType(method));
    if (!isVoidType(returnType) && !isResultHeader) {
        List<Annotation> jaxbRespAnnotations = collectJAXBAnnotations(method);
        processXmlElement(jaxbRespAnnotations, responseElementName, responseNamespace, returnType);
        responseMembers.add(factory.createWrapperBeanMember(returnType, getPropertyName(responseElementName), jaxbRespAnnotations));
    }

    // Now parameters that need to be part response wrapper bean
    int paramIndex = -1;
    for (T param : nav.getMethodParameters(method)) {
        paramIndex++;

        T paramType = getHolderValueType(param);
        WebParam webParam = annReader.getMethodParameterAnnotation(WebParam.class, method, paramIndex, null);
        if (paramType == null || (webParam != null && webParam.header())) {
            continue;       // not a holder or a header - so don't add it
        }

        String paramName = (webParam != null && webParam.name().length() > 0)
                ? webParam.name() : "arg"+paramIndex;
        String paramNamespace = (webParam != null && webParam.targetNamespace().length() > 0)
                ? webParam.targetNamespace() : EMTPY_NAMESPACE_ID;
        List<Annotation> jaxbAnnotation = collectJAXBAnnotations(method, paramIndex);
        processXmlElement(jaxbAnnotation, paramName, paramNamespace, paramType);
        A member = factory.createWrapperBeanMember(paramType,
                getPropertyName(paramName), jaxbAnnotation);
        responseMembers.add(member);
    }

    return responseMembers;
}
 
Example 4
Source File: AbstractWrapperBeanGenerator.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Computes response bean members for a method. Collects all OUT and INOUT
 * parameters as response bean fields. In this process, if a parameter
 * has any known JAXB annotations they are collected as well.
 * Special processing for @XmlElement annotation is done.
 *
 * @param method SEI method for which response bean members are computed
 * @return List of response bean members
 */
public List<A> collectResponseBeanMembers(M method) {

    List<A> responseMembers = new ArrayList<A>();

    // return that need to be part response wrapper bean
    String responseElementName = RETURN;
    String responseNamespace = EMTPY_NAMESPACE_ID;
    boolean isResultHeader = false;
    WebResult webResult = annReader.getMethodAnnotation(WebResult.class, method ,null);
    if (webResult != null) {
        if (webResult.name().length() > 0) {
            responseElementName = webResult.name();
        }
        if (webResult.targetNamespace().length() > 0) {
            responseNamespace = webResult.targetNamespace();
        }
        isResultHeader = webResult.header();
    }
    T returnType = getSafeType(nav.getReturnType(method));
    if (!isVoidType(returnType) && !isResultHeader) {
        List<Annotation> jaxbRespAnnotations = collectJAXBAnnotations(method);
        processXmlElement(jaxbRespAnnotations, responseElementName, responseNamespace, returnType);
        responseMembers.add(factory.createWrapperBeanMember(returnType, getPropertyName(responseElementName), jaxbRespAnnotations));
    }

    // Now parameters that need to be part response wrapper bean
    int paramIndex = -1;
    for (T param : nav.getMethodParameters(method)) {
        paramIndex++;

        T paramType = getHolderValueType(param);
        WebParam webParam = annReader.getMethodParameterAnnotation(WebParam.class, method, paramIndex, null);
        if (paramType == null || (webParam != null && webParam.header())) {
            continue;       // not a holder or a header - so don't add it
        }

        String paramName = (webParam != null && webParam.name().length() > 0)
                ? webParam.name() : "arg"+paramIndex;
        String paramNamespace = (webParam != null && webParam.targetNamespace().length() > 0)
                ? webParam.targetNamespace() : EMTPY_NAMESPACE_ID;
        List<Annotation> jaxbAnnotation = collectJAXBAnnotations(method, paramIndex);
        processXmlElement(jaxbAnnotation, paramName, paramNamespace, paramType);
        A member = factory.createWrapperBeanMember(paramType,
                getPropertyName(paramName), jaxbAnnotation);
        responseMembers.add(member);
    }

    return responseMembers;
}
 
Example 5
Source File: AbstractWrapperBeanGenerator.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Computes response bean members for a method. Collects all OUT and INOUT
 * parameters as response bean fields. In this process, if a parameter
 * has any known JAXB annotations they are collected as well.
 * Special processing for @XmlElement annotation is done.
 *
 * @param method SEI method for which response bean members are computed
 * @return List of response bean members
 */
public List<A> collectResponseBeanMembers(M method) {

    List<A> responseMembers = new ArrayList<A>();

    // return that need to be part response wrapper bean
    String responseElementName = RETURN;
    String responseNamespace = EMTPY_NAMESPACE_ID;
    boolean isResultHeader = false;
    WebResult webResult = annReader.getMethodAnnotation(WebResult.class, method ,null);
    if (webResult != null) {
        if (webResult.name().length() > 0) {
            responseElementName = webResult.name();
        }
        if (webResult.targetNamespace().length() > 0) {
            responseNamespace = webResult.targetNamespace();
        }
        isResultHeader = webResult.header();
    }
    T returnType = getSafeType(nav.getReturnType(method));
    if (!isVoidType(returnType) && !isResultHeader) {
        List<Annotation> jaxbRespAnnotations = collectJAXBAnnotations(method);
        processXmlElement(jaxbRespAnnotations, responseElementName, responseNamespace, returnType);
        responseMembers.add(factory.createWrapperBeanMember(returnType, getPropertyName(responseElementName), jaxbRespAnnotations));
    }

    // Now parameters that need to be part response wrapper bean
    int paramIndex = -1;
    for (T param : nav.getMethodParameters(method)) {
        paramIndex++;

        T paramType = getHolderValueType(param);
        WebParam webParam = annReader.getMethodParameterAnnotation(WebParam.class, method, paramIndex, null);
        if (paramType == null || (webParam != null && webParam.header())) {
            continue;       // not a holder or a header - so don't add it
        }

        String paramName = (webParam != null && webParam.name().length() > 0)
                ? webParam.name() : "arg"+paramIndex;
        String paramNamespace = (webParam != null && webParam.targetNamespace().length() > 0)
                ? webParam.targetNamespace() : EMTPY_NAMESPACE_ID;
        List<Annotation> jaxbAnnotation = collectJAXBAnnotations(method, paramIndex);
        processXmlElement(jaxbAnnotation, paramName, paramNamespace, paramType);
        A member = factory.createWrapperBeanMember(paramType,
                getPropertyName(paramName), jaxbAnnotation);
        responseMembers.add(member);
    }

    return responseMembers;
}
 
Example 6
Source File: AbstractWrapperBeanGenerator.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Computes response bean members for a method. Collects all OUT and INOUT
 * parameters as response bean fields. In this process, if a parameter
 * has any known JAXB annotations they are collected as well.
 * Special processing for @XmlElement annotation is done.
 *
 * @param method SEI method for which response bean members are computed
 * @return List of response bean members
 */
public List<A> collectResponseBeanMembers(M method) {

    List<A> responseMembers = new ArrayList<A>();

    // return that need to be part response wrapper bean
    String responseElementName = RETURN;
    String responseNamespace = EMTPY_NAMESPACE_ID;
    boolean isResultHeader = false;
    WebResult webResult = annReader.getMethodAnnotation(WebResult.class, method ,null);
    if (webResult != null) {
        if (webResult.name().length() > 0) {
            responseElementName = webResult.name();
        }
        if (webResult.targetNamespace().length() > 0) {
            responseNamespace = webResult.targetNamespace();
        }
        isResultHeader = webResult.header();
    }
    T returnType = getSafeType(nav.getReturnType(method));
    if (!isVoidType(returnType) && !isResultHeader) {
        List<Annotation> jaxbRespAnnotations = collectJAXBAnnotations(method);
        processXmlElement(jaxbRespAnnotations, responseElementName, responseNamespace, returnType);
        responseMembers.add(factory.createWrapperBeanMember(returnType, getPropertyName(responseElementName), jaxbRespAnnotations));
    }

    // Now parameters that need to be part response wrapper bean
    int paramIndex = -1;
    for (T param : nav.getMethodParameters(method)) {
        paramIndex++;

        T paramType = getHolderValueType(param);
        WebParam webParam = annReader.getMethodParameterAnnotation(WebParam.class, method, paramIndex, null);
        if (paramType == null || (webParam != null && webParam.header())) {
            continue;       // not a holder or a header - so don't add it
        }

        String paramName = (webParam != null && webParam.name().length() > 0)
                ? webParam.name() : "arg"+paramIndex;
        String paramNamespace = (webParam != null && webParam.targetNamespace().length() > 0)
                ? webParam.targetNamespace() : EMTPY_NAMESPACE_ID;
        List<Annotation> jaxbAnnotation = collectJAXBAnnotations(method, paramIndex);
        processXmlElement(jaxbAnnotation, paramName, paramNamespace, paramType);
        A member = factory.createWrapperBeanMember(paramType,
                getPropertyName(paramName), jaxbAnnotation);
        responseMembers.add(member);
    }

    return responseMembers;
}
 
Example 7
Source File: AbstractWrapperBeanGenerator.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Computes response bean members for a method. Collects all OUT and INOUT
 * parameters as response bean fields. In this process, if a parameter
 * has any known JAXB annotations they are collected as well.
 * Special processing for @XmlElement annotation is done.
 *
 * @param method SEI method for which response bean members are computed
 * @return List of response bean members
 */
public List<A> collectResponseBeanMembers(M method) {

    List<A> responseMembers = new ArrayList<A>();

    // return that need to be part response wrapper bean
    String responseElementName = RETURN;
    String responseNamespace = EMTPY_NAMESPACE_ID;
    boolean isResultHeader = false;
    WebResult webResult = annReader.getMethodAnnotation(WebResult.class, method ,null);
    if (webResult != null) {
        if (webResult.name().length() > 0) {
            responseElementName = webResult.name();
        }
        if (webResult.targetNamespace().length() > 0) {
            responseNamespace = webResult.targetNamespace();
        }
        isResultHeader = webResult.header();
    }
    T returnType = getSafeType(nav.getReturnType(method));
    if (!isVoidType(returnType) && !isResultHeader) {
        List<Annotation> jaxbRespAnnotations = collectJAXBAnnotations(method);
        processXmlElement(jaxbRespAnnotations, responseElementName, responseNamespace, returnType);
        responseMembers.add(factory.createWrapperBeanMember(returnType, getPropertyName(responseElementName), jaxbRespAnnotations));
    }

    // Now parameters that need to be part response wrapper bean
    int paramIndex = -1;
    for (T param : nav.getMethodParameters(method)) {
        paramIndex++;

        T paramType = getHolderValueType(param);
        WebParam webParam = annReader.getMethodParameterAnnotation(WebParam.class, method, paramIndex, null);
        if (paramType == null || (webParam != null && webParam.header())) {
            continue;       // not a holder or a header - so don't add it
        }

        String paramName = (webParam != null && webParam.name().length() > 0)
                ? webParam.name() : "arg"+paramIndex;
        String paramNamespace = (webParam != null && webParam.targetNamespace().length() > 0)
                ? webParam.targetNamespace() : EMTPY_NAMESPACE_ID;
        List<Annotation> jaxbAnnotation = collectJAXBAnnotations(method, paramIndex);
        processXmlElement(jaxbAnnotation, paramName, paramNamespace, paramType);
        A member = factory.createWrapperBeanMember(paramType,
                getPropertyName(paramName), jaxbAnnotation);
        responseMembers.add(member);
    }

    return responseMembers;
}
 
Example 8
Source File: AbstractWrapperBeanGenerator.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Computes response bean members for a method. Collects all OUT and INOUT
 * parameters as response bean fields. In this process, if a parameter
 * has any known JAXB annotations they are collected as well.
 * Special processing for @XmlElement annotation is done.
 *
 * @param method SEI method for which response bean members are computed
 * @return List of response bean members
 */
public List<A> collectResponseBeanMembers(M method) {

    List<A> responseMembers = new ArrayList<A>();

    // return that need to be part response wrapper bean
    String responseElementName = RETURN;
    String responseNamespace = EMTPY_NAMESPACE_ID;
    boolean isResultHeader = false;
    WebResult webResult = annReader.getMethodAnnotation(WebResult.class, method ,null);
    if (webResult != null) {
        if (webResult.name().length() > 0) {
            responseElementName = webResult.name();
        }
        if (webResult.targetNamespace().length() > 0) {
            responseNamespace = webResult.targetNamespace();
        }
        isResultHeader = webResult.header();
    }
    T returnType = getSafeType(nav.getReturnType(method));
    if (!isVoidType(returnType) && !isResultHeader) {
        List<Annotation> jaxbRespAnnotations = collectJAXBAnnotations(method);
        processXmlElement(jaxbRespAnnotations, responseElementName, responseNamespace, returnType);
        responseMembers.add(factory.createWrapperBeanMember(returnType, getPropertyName(responseElementName), jaxbRespAnnotations));
    }

    // Now parameters that need to be part response wrapper bean
    int paramIndex = -1;
    for (T param : nav.getMethodParameters(method)) {
        paramIndex++;

        T paramType = getHolderValueType(param);
        WebParam webParam = annReader.getMethodParameterAnnotation(WebParam.class, method, paramIndex, null);
        if (paramType == null || (webParam != null && webParam.header())) {
            continue;       // not a holder or a header - so don't add it
        }

        String paramName = (webParam != null && webParam.name().length() > 0)
                ? webParam.name() : "arg"+paramIndex;
        String paramNamespace = (webParam != null && webParam.targetNamespace().length() > 0)
                ? webParam.targetNamespace() : EMTPY_NAMESPACE_ID;
        List<Annotation> jaxbAnnotation = collectJAXBAnnotations(method, paramIndex);
        processXmlElement(jaxbAnnotation, paramName, paramNamespace, paramType);
        A member = factory.createWrapperBeanMember(paramType,
                getPropertyName(paramName), jaxbAnnotation);
        responseMembers.add(member);
    }

    return responseMembers;
}
 
Example 9
Source File: AbstractWrapperBeanGenerator.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Computes response bean members for a method. Collects all OUT and INOUT
 * parameters as response bean fields. In this process, if a parameter
 * has any known JAXB annotations they are collected as well.
 * Special processing for @XmlElement annotation is done.
 *
 * @param method SEI method for which response bean members are computed
 * @return List of response bean members
 */
public List<A> collectResponseBeanMembers(M method) {

    List<A> responseMembers = new ArrayList<A>();

    // return that need to be part response wrapper bean
    String responseElementName = RETURN;
    String responseNamespace = EMTPY_NAMESPACE_ID;
    boolean isResultHeader = false;
    WebResult webResult = annReader.getMethodAnnotation(WebResult.class, method ,null);
    if (webResult != null) {
        if (webResult.name().length() > 0) {
            responseElementName = webResult.name();
        }
        if (webResult.targetNamespace().length() > 0) {
            responseNamespace = webResult.targetNamespace();
        }
        isResultHeader = webResult.header();
    }
    T returnType = getSafeType(nav.getReturnType(method));
    if (!isVoidType(returnType) && !isResultHeader) {
        List<Annotation> jaxbRespAnnotations = collectJAXBAnnotations(method);
        processXmlElement(jaxbRespAnnotations, responseElementName, responseNamespace, returnType);
        responseMembers.add(factory.createWrapperBeanMember(returnType, getPropertyName(responseElementName), jaxbRespAnnotations));
    }

    // Now parameters that need to be part response wrapper bean
    int paramIndex = -1;
    for (T param : nav.getMethodParameters(method)) {
        paramIndex++;

        T paramType = getHolderValueType(param);
        WebParam webParam = annReader.getMethodParameterAnnotation(WebParam.class, method, paramIndex, null);
        if (paramType == null || (webParam != null && webParam.header())) {
            continue;       // not a holder or a header - so don't add it
        }

        String paramName = (webParam != null && webParam.name().length() > 0)
                ? webParam.name() : "arg"+paramIndex;
        String paramNamespace = (webParam != null && webParam.targetNamespace().length() > 0)
                ? webParam.targetNamespace() : EMTPY_NAMESPACE_ID;
        List<Annotation> jaxbAnnotation = collectJAXBAnnotations(method, paramIndex);
        processXmlElement(jaxbAnnotation, paramName, paramNamespace, paramType);
        A member = factory.createWrapperBeanMember(paramType,
                getPropertyName(paramName), jaxbAnnotation);
        responseMembers.add(member);
    }

    return responseMembers;
}