Search in sources :

Example 6 with ResponseWrapper

use of javax.xml.ws.ResponseWrapper in project cxf by apache.

the class JaxWsServiceConfiguration method getResponseWrapperPartName.

@Override
public String getResponseWrapperPartName(OperationInfo op, Method method) {
    method = getDeclaredMethod(method);
    WebResult webResult = getWebResult(method);
    ResponseWrapper rw = method.getAnnotation(ResponseWrapper.class);
    if (rw != null) {
        String pn = getWithReflection(ResponseWrapper.class, rw, "partName");
        if (pn != null) {
            return pn;
        }
    }
    int countOut = 0;
    int countHeaders = 0;
    if (webResult != null && webResult.header()) {
        countHeaders++;
    } else if (method.getReturnType() != Void.TYPE) {
        countOut++;
    }
    for (int x = 0; x < method.getParameterTypes().length; x++) {
        WebParam parm = getWebParam(method, x);
        if (parm != null) {
            if (parm.header()) {
                countHeaders++;
            }
            if (parm.mode() != WebParam.Mode.IN) {
                countOut++;
            }
        }
    }
    if (countHeaders > 0 && countOut == 0) {
        // thus return the default for an empty part of "result"
        return "result";
    }
    return null;
}
Also used : WebParam(javax.jws.WebParam) ResponseWrapper(javax.xml.ws.ResponseWrapper) WebResult(javax.jws.WebResult)

Example 7 with ResponseWrapper

use of javax.xml.ws.ResponseWrapper in project cxf by apache.

the class JaxWsServiceConfiguration method getResponseWrapperName.

@Override
public QName getResponseWrapperName(OperationInfo op, Method method) {
    Method m = getDeclaredMethod(method);
    ResponseWrapper rw = m.getAnnotation(ResponseWrapper.class);
    String nm = null;
    String lp = null;
    if (rw != null) {
        nm = rw.targetNamespace();
        lp = rw.localName();
    }
    WebMethod meth = m.getAnnotation(WebMethod.class);
    if (meth != null && StringUtils.isEmpty(lp)) {
        lp = meth.operationName();
        if (!StringUtils.isEmpty(lp)) {
            lp += "Response";
        }
    }
    if (StringUtils.isEmpty(nm)) {
        nm = op.getName().getNamespaceURI();
    }
    if (!StringUtils.isEmpty(nm) && !StringUtils.isEmpty(lp)) {
        return new QName(nm, lp);
    }
    return null;
}
Also used : WebMethod(javax.jws.WebMethod) QName(javax.xml.namespace.QName) ResponseWrapper(javax.xml.ws.ResponseWrapper) Method(java.lang.reflect.Method) WebMethod(javax.jws.WebMethod)

Aggregations

ResponseWrapper (javax.xml.ws.ResponseWrapper)7 Method (java.lang.reflect.Method)5 WebMethod (javax.jws.WebMethod)5 WebResult (javax.jws.WebResult)4 File (java.io.File)2 ObjectStreamClass (java.io.ObjectStreamClass)2 WebParam (javax.jws.WebParam)2 WebService (javax.jws.WebService)2 QName (javax.xml.namespace.QName)2 RequestWrapper (javax.xml.ws.RequestWrapper)2 AbstractCodeGenTest (org.apache.cxf.tools.wsdlto.AbstractCodeGenTest)2 Test (org.junit.Test)2 Oneway (javax.jws.Oneway)1 SOAPBinding (javax.jws.soap.SOAPBinding)1