Search in sources :

Example 21 with WebParam

use of javax.jws.WebParam in project cxf by apache.

the class JaxWsServiceConfiguration method isInOutParam.

@Override
public Boolean isInOutParam(Method method, int j) {
    method = getDeclaredMethod(method);
    if (j == -1) {
        return !method.getReturnType().equals(void.class);
    }
    WebParam webParam = getWebParam(method, j);
    if (webParam != null && webParam.mode().equals(Mode.INOUT)) {
        return Boolean.TRUE;
    }
    return Boolean.FALSE;
}
Also used : WebParam(javax.jws.WebParam)

Example 22 with WebParam

use of javax.jws.WebParam in project cxf by apache.

the class JaxWsServiceConfiguration method getPartName.

private QName getPartName(OperationInfo op, Method method, int paramNumber, MessageInfo mi, String prefix, boolean isIn) {
    int partIndex = getPartIndex(method, paramNumber, isIn);
    method = getDeclaredMethod(method);
    WebParam param = getWebParam(method, paramNumber);
    String tns = mi.getName().getNamespaceURI();
    String local = null;
    if (param != null) {
        if (Boolean.TRUE.equals(isRPC(method)) || isDocumentBare(method) || param.header()) {
            local = param.partName();
        }
        if (local == null || local.length() == 0) {
            local = param.name();
        }
    }
    if (local == null || local.length() == 0) {
        if (Boolean.TRUE.equals(isRPC(method)) || !Boolean.FALSE.equals(isWrapped(method))) {
            local = getDefaultLocalName(op, method, paramNumber, partIndex, prefix);
        } else {
            local = getOperationName(op.getInterface(), method).getLocalPart();
        }
    }
    return new QName(tns, local);
}
Also used : WebParam(javax.jws.WebParam) QName(javax.xml.namespace.QName)

Example 23 with WebParam

use of javax.jws.WebParam in project cxf by apache.

the class JaxWsServiceConfiguration method isOutParam.

@Override
public Boolean isOutParam(Method method, int j) {
    method = getDeclaredMethod(method);
    if (j == -1) {
        return !method.getReturnType().equals(void.class);
    }
    WebParam webParam = getWebParam(method, j);
    if (webParam != null && (webParam.mode().equals(Mode.OUT) || webParam.mode().equals(Mode.INOUT))) {
        return Boolean.TRUE;
    }
    return method.getParameterTypes()[j] == Holder.class;
}
Also used : WebParam(javax.jws.WebParam)

Example 24 with WebParam

use of javax.jws.WebParam in project cxf by apache.

the class TestRPCHeaderTest method testInOutHeader.

@Test
public void testInOutHeader() {
    Method[] meths = cls.getMethods();
    for (Method m : meths) {
        if ("testInOutHeader".equals(m.getName())) {
            Annotation[][] annotations = m.getParameterAnnotations();
            assertEquals(2, annotations.length);
            assertEquals(1, annotations[1].length);
            assertTrue(annotations[1][0] instanceof WebParam);
            WebParam parm = (WebParam) annotations[1][0];
            assertEquals("http://apache.org/header_test/rpc/types", parm.targetNamespace());
            assertEquals("inOutHeader", parm.partName());
            assertEquals("headerMessage", parm.name());
            assertTrue(parm.header());
        }
    }
}
Also used : WebParam(javax.jws.WebParam) Method(java.lang.reflect.Method) Test(org.junit.Test)

Example 25 with WebParam

use of javax.jws.WebParam in project cxf by apache.

the class TestRPCHeaderTest method testHeader1.

@Test
public void testHeader1() {
    Method[] meths = cls.getMethods();
    for (Method m : meths) {
        if ("testHeader1".equals(m.getName())) {
            Annotation[][] annotations = m.getParameterAnnotations();
            assertEquals(2, annotations.length);
            assertEquals(1, annotations[0].length);
            assertTrue(annotations[0][0] instanceof WebParam);
            WebParam parm = (WebParam) annotations[0][0];
            assertEquals("http://apache.org/header_test/rpc/types", parm.targetNamespace());
            assertEquals("inHeader", parm.partName());
            assertEquals("headerMessage", parm.name());
            assertTrue(parm.header());
        }
    }
}
Also used : WebParam(javax.jws.WebParam) Method(java.lang.reflect.Method) Test(org.junit.Test)

Aggregations

WebParam (javax.jws.WebParam)28 Test (org.junit.Test)15 Method (java.lang.reflect.Method)14 WebMethod (javax.jws.WebMethod)12 AbstractCodeGenTest (org.apache.cxf.tools.wsdlto.AbstractCodeGenTest)12 Annotation (java.lang.annotation.Annotation)7 File (java.io.File)5 WebResult (javax.jws.WebResult)5 ArrayList (java.util.ArrayList)4 QName (javax.xml.namespace.QName)4 SOAPBinding (javax.jws.soap.SOAPBinding)3 ObjectStreamClass (java.io.ObjectStreamClass)2 Type (java.lang.reflect.Type)2 Holder (javax.xml.ws.Holder)2 RequestWrapper (javax.xml.ws.RequestWrapper)2 ResponseWrapper (javax.xml.ws.ResponseWrapper)2 MessagePartInfo (org.apache.cxf.service.model.MessagePartInfo)2 JavaField (org.apache.cxf.tools.common.model.JavaField)2 ParameterizedType (java.lang.reflect.ParameterizedType)1 Oneway (javax.jws.Oneway)1