CXF client is using the operation qName to look up the request method.

As you specify another targetNamespace which we cannot tell from the SEI 
package name, you need to specify the header of 
CxfConstants.OPERATION_NAMESPACE at the same time.  

--  
Willem Jiang

Red Hat, Inc.
Web: http://www.redhat.com
Blog: http://willemjiang.blogspot.com (http://willemjiang.blogspot.com/) 
(English)
          http://jnn.iteye.com (http://jnn.javaeye.com/) (Chinese)
Twitter: willemjiang  
Weibo: 姜宁willem





On Monday, September 2, 2013 at 5:08 PM, Ernest Lu wrote:

> Thanks for your reply
>  
> I have a test case like this:
>  
> public class CXFTest extends CamelTestSupport {
>  
> protected static Endpoint endpoint;
> protected static WebServiceTestImpl implementor;
>  
> public static String proxyAddress = "http://localhost:11000/cxf/proxy/";;
> public static String realServiceAddress =
> "http://localhost:12000/cxf/service/";;
>  
> @Override
> protected RouteBuilder createRouteBuilder() {
> return new RouteBuilder() {
> public void configure() {
> from("cxf://" + proxyAddress + "?dataFormat=PAYLOAD")
> .to("cxf://" + realServiceAddress + "?dataFormat=PAYLOAD");
> }
> };
> }
>  
> @Test
> public void invokeSayHelloMethod() throws Exception {
> JaxWsDynamicClientFactory dcf = JaxWsDynamicClientFactory.newInstance();
> Client client = dcf.createClient(proxyAddress + "?wsdl");
> //BindingOperationInfo oi = new BindingOperationInfo();
> Object[] res = client.invoke("sayHello", "xiaoMing");
> if(res.length > 0){
> System.out.println("response: " + res[0]);  
> }
> }
>  
>  
> @AfterClass
> public static void stopService() {
> if (endpoint != null) {
> endpoint.stop();
> }
> }
>  
> @BeforeClass
> public static void startService() {
> implementor = new WebServiceTestImpl();
> endpoint = Endpoint.publish(realServiceAddress, implementor);
> }
>  
> }
>  
> The SEI(Service Endpoint Interface) like this:
>  
> @WebService(targetNamespace = "http://service.test.com/";)
> public interface WebServiceTest {
>  
> @WebMethod
> String sayHi();
>  
> @WebMethod
> String sayHello(String name);
> }
>  
> @WebService(endpointInterface = "WebServiceTest",targetNamespace =
> "http://service.test.com/";)
> public class WebServiceTestImpl implements WebServiceTest {
>  
> @Override
> @WebMethod
> public String sayHi() {
> return "hi";
> }
>  
> @Override
> @WebMethod
> public String sayHello(String name) {
> return "hello " + name;
> }
>  
> }
>  
> when running the test case,it throw an Exception below.
> org.apache.cxf.common.i18n.UncheckedException: No operation was found with
> the name {http://camel.apache.org/cxf/jaxws/provider}sayHello.
> at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:331)
> at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:325)
> at
> com.rongji.esb.junit.CXFTest.testInvokingServiceFromCXFClient(CXFTest.java:49)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:597)
> at
> org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
> at
> org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
> at
> org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
> at
> org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
> at org.junit.rules.TestWatchman$1.evaluate(TestWatchman.java:48)
> at
> org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
> at
> org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
> at
> org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:76)
> at
> org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
> at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
> at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
> at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
> at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
> at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
> at
> org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
> at
> org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
> at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
> at
> org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
> at
> org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
> at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
> at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
> at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
> at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
>  
> I think the operation is not found, Due to omit both wsdlURL and
> serviceClass options.Where I go wrong?
>  
>  
>  
>  
>  
>  
>  
>  
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/The-Message-header-with-the-name-of-CxfConstants-OPERATION-NAME-tp5738456p5738492.html
> Sent from the Camel - Users mailing list archive at Nabble.com 
> (http://Nabble.com).



Reply via email to