use of javax.jws.WebParam in project cxf by apache.
the class CodeGenTest method testDocLitHolder.
@Test
public void testDocLitHolder() throws Exception {
env.put(ToolConstants.CFG_WSDLURL, getLocation("/wsdl2java_wsdl/mapping-doc-literal.wsdl"));
processor.setContext(env);
processor.execute();
assertNotNull(output);
File org = new File(output, "org");
assertTrue(org.exists());
File apache = new File(org, "apache");
assertTrue(apache.exists());
File mapping = new File(apache, "mapping");
assertTrue(mapping.exists());
File[] files = mapping.listFiles();
assertEquals(9, files.length);
Class<?> clz = classLoader.loadClass("org.apache.mapping.SomethingServer");
Method method = clz.getMethod("doSomething", new Class[] { int.class, javax.xml.ws.Holder.class, javax.xml.ws.Holder.class });
assertEquals("boolean", method.getReturnType().getSimpleName());
WebParam webParamAnno = AnnotationUtil.getWebParam(method, "y");
assertEquals("INOUT", webParamAnno.mode().name());
webParamAnno = AnnotationUtil.getWebParam(method, "z");
assertEquals("OUT", webParamAnno.mode().name());
}
use of javax.jws.WebParam in project cxf by apache.
the class JaxWsServiceConfiguration method isInParam.
@Override
public Boolean isInParam(Method method, int j) {
if (j < 0) {
return Boolean.FALSE;
}
method = getDeclaredMethod(method);
WebParam webParam = getWebParam(method, j);
return webParam == null || (webParam.mode().equals(Mode.IN) || webParam.mode().equals(Mode.INOUT));
}
use of javax.jws.WebParam in project cxf by apache.
the class JaxWsServiceConfiguration method isHeader.
@Override
public Boolean isHeader(Method method, int j) {
method = getDeclaredMethod(method);
if (j >= 0) {
WebParam webParam = getWebParam(method, j);
return webParam != null && webParam.header();
}
WebResult webResult = getWebResult(method);
return webResult != null && webResult.header();
}
use of javax.jws.WebParam in project cxf by apache.
the class JaxWsServiceConfiguration method getWebParam.
private WebParam getWebParam(Method method, int parameter) {
// we could really use a centralized location for this.
Annotation[][] annotations = methodAnnotationCache.get(method);
if (annotations == null) {
annotations = method.getParameterAnnotations();
methodAnnotationCache.put(method, annotations);
}
if (parameter >= annotations.length) {
return null;
}
for (int i = 0; i < annotations[parameter].length; i++) {
Annotation annotation = annotations[parameter][i];
// == operator seems to give the desired result.
if (annotation instanceof WebParam) {
return (WebParam) annotation;
}
}
return null;
}
use of javax.jws.WebParam 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;
}
Aggregations