use of org.apache.cxf.tools.java2wsdl.generator.wsdl11.model.WrapperBeanClass in project cxf by apache.
the class RequestWrapper method getWrapperBeanClass.
@Override
public WrapperBeanClass getWrapperBeanClass(final Method method) {
javax.xml.ws.RequestWrapper reqWrapper = method.getAnnotation(javax.xml.ws.RequestWrapper.class);
javax.jws.WebMethod webMethod = method.getAnnotation(javax.jws.WebMethod.class);
String methName = webMethod == null ? null : webMethod.operationName();
if (StringUtils.isEmpty(methName)) {
methName = method.getName();
}
String reqClassName = getClassName();
String reqNs = null;
if (reqWrapper != null) {
reqClassName = reqWrapper.className().length() > 0 ? reqWrapper.className() : reqClassName;
reqNs = reqWrapper.targetNamespace().length() > 0 ? reqWrapper.targetNamespace() : null;
}
if (reqClassName == null) {
reqClassName = getPackageName(method) + ".jaxws." + StringUtils.capitalize(methName);
}
WrapperBeanClass jClass = new WrapperBeanClass();
jClass.setFullClassName(reqClassName);
jClass.setNamespace(reqNs);
return jClass;
}
use of org.apache.cxf.tools.java2wsdl.generator.wsdl11.model.WrapperBeanClass in project cxf by apache.
the class ResponseWrapper method getWrapperBeanClass.
@Override
public WrapperBeanClass getWrapperBeanClass(final Method method) {
javax.xml.ws.ResponseWrapper resWrapper = method.getAnnotation(javax.xml.ws.ResponseWrapper.class);
javax.jws.WebMethod webMethod = method.getAnnotation(javax.jws.WebMethod.class);
String methName = webMethod == null ? null : webMethod.operationName();
if (StringUtils.isEmpty(methName)) {
methName = method.getName();
}
String resClassName = getClassName();
String resNs = null;
if (resWrapper != null) {
resClassName = resWrapper.className().length() > 0 ? resWrapper.className() : resClassName;
resNs = resWrapper.targetNamespace().length() > 0 ? resWrapper.targetNamespace() : null;
}
if (resClassName == null) {
resClassName = getPackageName(method) + ".jaxws." + StringUtils.capitalize(methName) + "Response";
}
WrapperBeanClass jClass = new WrapperBeanClass();
jClass.setFullClassName(resClassName);
jClass.setNamespace(resNs);
return jClass;
}
use of org.apache.cxf.tools.java2wsdl.generator.wsdl11.model.WrapperBeanClass in project cxf by apache.
the class Wrapper method getWrapperBeanClass.
protected WrapperBeanClass getWrapperBeanClass(final QName wrapperBeanName) {
WrapperBeanClass jClass = new WrapperBeanClass();
if (wrapperBeanName == null) {
return jClass;
}
String ns = wrapperBeanName.getNamespaceURI();
jClass.setNamespace(ns);
jClass.setPackageName(URIParserUtil.getPackageName(ns));
jClass.setName(NameUtil.mangleNameToClassName(wrapperBeanName.getLocalPart()));
jClass.setElementName(wrapperBeanName);
return jClass;
}
use of org.apache.cxf.tools.java2wsdl.generator.wsdl11.model.WrapperBeanClass in project cxf by apache.
the class Wrapper method getJavaClass.
public WrapperBeanClass getJavaClass() {
if (javaClass == null) {
WrapperBeanClass jClass1 = getWrapperBeanClass(this.name);
WrapperBeanClass jClass2 = getWrapperBeanClass(this.method);
javaClass = merge(jClass2, jClass1);
}
return javaClass;
}
use of org.apache.cxf.tools.java2wsdl.generator.wsdl11.model.WrapperBeanClass in project cxf by apache.
the class WrapperBeanAnnotatorTest method testAnnotate.
@Test
public void testAnnotate() {
String pkgName = "org.apache.cxf.tools.fortest.withannotation.doc.jaxws";
WrapperBeanClass clz = new WrapperBeanClass();
clz.setFullClassName(pkgName + ".SayHi");
clz.setElementName(new QName("http://doc.withannotation.fortest.tools.cxf.apache.org/", "sayHi"));
clz.annotate(new WrapperBeanAnnotator());
List<JAnnotation> annotations = clz.getAnnotations();
String expectedNamespace = "http://doc.withannotation.fortest.tools.cxf.apache.org/";
JAnnotation rootElementAnnotation = annotations.get(0);
assertEquals("@XmlRootElement(name = \"sayHi\", " + "namespace = \"" + expectedNamespace + "\")", rootElementAnnotation.toString());
JAnnotation xmlTypeAnnotation = annotations.get(2);
assertEquals("@XmlType(name = \"sayHi\", " + "namespace = \"" + expectedNamespace + "\")", xmlTypeAnnotation.toString());
JAnnotation accessorTypeAnnotation = annotations.get(1);
assertEquals("@XmlAccessorType(XmlAccessType.FIELD)", accessorTypeAnnotation.toString());
WrapperBeanClass resWrapperClass = new WrapperBeanClass();
resWrapperClass.setFullClassName(pkgName + ".SayHiResponse");
resWrapperClass.setElementName(new QName(expectedNamespace, "sayHiResponse"));
resWrapperClass.annotate(new WrapperBeanAnnotator());
annotations = resWrapperClass.getAnnotations();
rootElementAnnotation = annotations.get(0);
assertEquals("@XmlRootElement(name = \"sayHiResponse\", " + "namespace = \"" + expectedNamespace + "\")", rootElementAnnotation.toString());
accessorTypeAnnotation = annotations.get(1);
assertEquals("@XmlAccessorType(XmlAccessType.FIELD)", accessorTypeAnnotation.toString());
xmlTypeAnnotation = annotations.get(2);
assertEquals("@XmlType(name = \"sayHiResponse\", " + "namespace = \"" + expectedNamespace + "\")", xmlTypeAnnotation.toString());
}
Aggregations