use of javax.jws.WebMethod in project cxf by apache.
the class DOCBareClientServerTest method testAnnotation.
@Test
public void testAnnotation() throws Exception {
Class<PutLastTradedPricePortType> claz = PutLastTradedPricePortType.class;
TradePriceData priceData = new TradePriceData();
Holder<TradePriceData> holder = new Holder<>(priceData);
Method method = claz.getMethod("sayHi", holder.getClass());
assertNotNull("Can not find SayHi method in generated class ", method);
Annotation ann = method.getAnnotation(WebMethod.class);
WebMethod webMethod = (WebMethod) ann;
assertEquals(webMethod.operationName(), "SayHi");
Annotation[][] paraAnns = method.getParameterAnnotations();
for (Annotation[] paraType : paraAnns) {
for (Annotation an : paraType) {
if (an.annotationType() == WebParam.class) {
WebParam webParam = (WebParam) an;
assertNotSame("", webParam.targetNamespace());
}
}
}
}
use of javax.jws.WebMethod in project cxf by apache.
the class BaseGreeterImpl method testDocLitBare.
@WebMethod
public BareDocumentResponse testDocLitBare(String in) {
invocationCount++;
BareDocumentResponse res = new BareDocumentResponse();
res.setCompany("CXF");
res.setId(1);
return res;
}
use of javax.jws.WebMethod in project cxf by apache.
the class CustomerService method getCustomers.
@WebMethod
@WebResult(name = "customers")
public Customers getCustomers() {
Customers cbean = new Customers();
cbean.setCustomer(customers.values());
return cbean;
}
use of javax.jws.WebMethod in project cxf by apache.
the class CustomerService method getCustomer.
@WebMethod
@WebResult(name = "customer")
public Customer getCustomer(@WebParam(name = "getCustomer") GetCustomer getCustomer) throws CustomerNotFoundFault {
Customer c = customers.get(getCustomer.getId());
if (c == null) {
CustomerNotFoundDetails details = new CustomerNotFoundDetails();
details.setId(getCustomer.getId());
throw new CustomerNotFoundFault(details);
}
return c;
}
use of javax.jws.WebMethod in project cxf by apache.
the class CodeGenTest method testAsyncMethodNoService.
@Test
public void testAsyncMethodNoService() throws Exception {
env.put(ToolConstants.CFG_WSDLURL, getLocation("/wsdl2java_wsdl/hello_world_async_noservice.wsdl"));
// no binding so all the tests that check bindings fail
env.remove(ToolConstants.CFG_VALIDATE_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 cxf = new File(apache, "cxf");
assertTrue(cxf.exists());
File w2j = new File(cxf, "w2j");
assertTrue(w2j.exists());
File async = new File(w2j, "hello_world_async_soap_http");
assertTrue(async.exists());
File[] files = async.listFiles();
assertEquals(Arrays.asList(files).toString(), 9, files.length);
Class<?> clz = classLoader.loadClass("org.apache.cxf.w2j.hello_world_async_soap_http.GreeterAsync");
Method method1 = clz.getMethod("greetMeSometimeAsync", new Class[] { java.lang.String.class, javax.xml.ws.AsyncHandler.class });
WebMethod webMethodAnno1 = AnnotationUtil.getPrivMethodAnnotation(method1, WebMethod.class);
assertEquals(method1.getName() + "()" + " Annotation : WebMethod.operationName ", "greetMeSometime", webMethodAnno1.operationName());
java.lang.reflect.Method method2 = clz.getMethod("greetMeSometimeAsync", new Class[] { java.lang.String.class });
WebMethod webMethodAnno2 = AnnotationUtil.getPrivMethodAnnotation(method2, WebMethod.class);
assertEquals(method2.getName() + "()" + " Annotation : WebMethod.operationName ", "greetMeSometime", webMethodAnno2.operationName());
clz.getMethod("greetMeSometimeAsync", new Class[] { java.lang.String.class, javax.xml.ws.AsyncHandler.class });
try {
clz.getMethod("testIntAsync", new Class[] { Integer.TYPE, javax.xml.ws.AsyncHandler.class });
fail("Should not have generated testIntAsync");
} catch (NoSuchMethodException ex) {
// expected
}
clz = classLoader.loadClass("org.apache.cxf.w2j.hello_world_async_soap_http.GreeterDAsync");
clz.getMethod("greetMeSometimeAsync", new Class[] { java.lang.String.class, javax.xml.ws.AsyncHandler.class });
clz = classLoader.loadClass("org.apache.cxf.w2j.hello_world_async_soap_http.GreeterCAsync");
try {
clz.getMethod("greetMeSometimeAsync", new Class[] { java.lang.String.class, javax.xml.ws.AsyncHandler.class });
fail("Should not have generated greetMeSometimeAsync");
} catch (NoSuchMethodException ex) {
// expected
}
clz.getMethod("testIntAsync", new Class[] { Integer.TYPE, javax.xml.ws.AsyncHandler.class });
clz = classLoader.loadClass("org.apache.cxf.w2j.hello_world_async_soap_http.GreeterBAsync");
try {
clz.getMethod("greetMeSometimeAsync", new Class[] { java.lang.String.class, javax.xml.ws.AsyncHandler.class });
fail("Should not have generated greetMeSometimeAsync");
} catch (NoSuchMethodException ex) {
// expected
}
clz.getMethod("testIntAsync", new Class[] { Integer.TYPE, javax.xml.ws.AsyncHandler.class });
}
Aggregations