Here was my code:
ServiceInterfaceStrategy strategy = new
ServiceInterfaceStrategy(TestService.class, false);
SoapJaxbDataFormat soapDF = new
SoapJaxbDataFormat("com.referentia.cameltest.TestServiceImpl", strategy);
soapDF.setContextPath("com.referentia.cameltest");
TestServiceImpl serverBean = new TestServiceImpl();
from(WEB_SERVICES_URL2)
.bean(soapDF);
Which that SoapJaxbDataFormat initialization was giving me that error.
On the advice of someone else, I did not use the soapDF object and
instead used my service impl class directly like so:
TestServiceImpl serverBean = new TestServiceImpl();
from(WEB_SERVICES_URL2)
.bean(serverBean );
Which start up fine and will serve one method fine, but additional
methods in the service interface give the following error when I call
any of them:
EVERE: Failed delivery for exchangeId: ID-QTMPC-53039-1305180094073-0-2.
Exhausted after delivery attempt: 1 caught:
org.apache.camel.component.bean.AmbiguousMethodCallException: Ambiguous
method invocations possible: [public com.referentia.cameltest.TestData
com.referentia.cameltest.TestServiceImpl.getTestData(java.lang.String,int,java.util.Date),
public com.referentia.cameltest.TestData
com.referentia.cameltest.TestServiceImpl.getTestData(java.lang.String,int,java.util.Date)]
.........
Which makes me think that code cannot wire up the proper incoming
service call to the proper implementation method. If I cannot have
Came-CXF wire up a soap service interface to its implementation class
using the Soap data format class due to the parameter issue, and I
cannot wire directly to an implementation class due to it not supporting
multiple methods, What am I supposed to do?
I have seen examples of creating processors for determining which method
was being called then having logic to call the proper bean method, but
what's the point of having JAX-WS annotation interfaces/impl classes if
you have to manually create buggy, hard to maintain logic to wire
interface to implementation rather than taking advantage of JAX-WS
annotations that are used directly in CXF, etc?
Perhaps I am missing a big picture conceptual item, but to boil things
down to their most simple: I have an existing JAX-WS annotated service
interface and associated implementation class that was running stand
alone in CXF. Can I re-use these service definitions in a
straightforward manner in CAMEL-CXF *without* spring, just pure
code/api approach? I am starting to wonder if this is possible?
Thanks again for your time you have taken for me...
Chris
On 5/10/2011 6:53 PM, Claus Ibsen wrote:
On Wed, May 11, 2011 at 4:12 PM, Chris Richmond
<crichm...@referentia.com> wrote:
I finally successfully got CXF service being served at a Camel consumer
endpoint, where TestService has the interface annotated method which I can
call from a .NET soap client no problem:
@WebMethod(operationName="EchoValue")
@WebResult(name = "EchoResponse", targetNamespace =
"http://component.referentia.com")
public String echoValue(@WebParam(name="value")String value);
However, when I add a more complex method like this:
@WebMethod(operationName="GetTestData")
@WebResult(name = "TestData", targetNamespace =
"http://liveaction.referentia.com")
public TestData getTestData(@WebParam(name="Name")String name,
@WebParam(name="MachineValue")int machineValue,
@WebParam(name="Timestamp")Date timestamp);
when I start the application, I get the error below. Am I to believe that
Camel-CXF cannot handle multiple parameter webmethods???
The stacktrace is from camel-soap. Its that data format that doesn't
support that yet. I think there is a JIRA ticket for that. If not feel
free to create a ticket.
java.lang.IllegalArgumentException: Method getTestData has more than one
parameter and no request wrapper. This is not yet supported
at
org.apache.camel.dataformat.soap.name.ServiceInterfaceStrategy.getInInfo(ServiceInterfaceStrategy.java:106)
at
org.apache.camel.dataformat.soap.name.ServiceInterfaceStrategy.analyzeMethod(ServiceInterfaceStrategy.java:118)
at
org.apache.camel.dataformat.soap.name.ServiceInterfaceStrategy.analyzeServiceInterface(ServiceInterfaceStrategy.java:128)
at
org.apache.camel.dataformat.soap.name.ServiceInterfaceStrategy.<init>(ServiceInterfaceStrategy.java:54)
at
com.referentia.cameltest.CamelTestMain$1.configure(CamelTestMain.java:67)
at
org.apache.camel.builder.RouteBuilder.checkInitialized(RouteBuilder.java:322)
at
org.apache.camel.builder.RouteBuilder.configureRoutes(RouteBuilder.java:277)
at
org.apache.camel.builder.RouteBuilder.addRoutesToCamelContext(RouteBuilder.java:263)
at
org.apache.camel.impl.DefaultCamelContext.addRoutes(DefaultCamelContext.java:613)
at com.referentia.cameltest.CamelTestMain.main(CamelTestMain.java:52)