从WSO2 ESB调用WSO2 DSS中的服务

时间:2017-03-31 11:50:19

标签: wso2 wso2esb wso2dss

我正在尝试从WSO2 ESB中的服务B向WSO2 DSS中的服务A发送消息。我使用JAX-WS生成了一个客户端,可以直接访问A. 从Java代码,但当我导出与Axis2服务相同的代码并将其放入ESB时,我收到以下错误:

[2017-03-31 08:30:54,110] ERROR - RPCMessageReceiver     org.wso2.carbon.core.services.echo.Echo.getEchoHttpSoap12Endpoint()Lorg/wso2/carbon/core/services/echo/EchoPortType;
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.apache.axis2.rpc.receivers.RPCUtil.invokeServiceClass(RPCUtil.java:212)
at org.apache.axis2.rpc.receivers.RPCMessageReceiver.invokeBusinessLogic(RPCMessageReceiver.java:117)
at org.apache.axis2.receivers.AbstractInOutMessageReceiver.invokeBusinessLogic(AbstractInOutMessageReceiver.java:40)
at org.apache.axis2.receivers.AbstractMessageReceiver.receive(AbstractMessageReceiver.java:110)
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180)
at org.apache.synapse.transport.passthru.ServerWorker.processEntityEnclosingRequest(ServerWorker.java:395)
at org.apache.synapse.transport.passthru.ServerWorker.run(ServerWorker.java:142)
at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.NoSuchMethodError: org.wso2.carbon.core.services.echo.Echo.getEchoHttpSoap12Endpoint()Lorg/wso2/carbon/core/services/echo/EchoPortType;
at service.ChangeName.echoString(ChangeName.java:27)
at service.ChangeName.changeName(ChangeName.java:34)
... 15 more
[2017-03-31 08:30:54,126] ERROR - ServerWorker Error processing POST request for : /services/ChangeName.ChangeNameHttpSoap12Endpoint
org.apache.axis2.AxisFault: org.wso2.carbon.core.services.echo.Echo.getEchoHttpSoap12Endpoint()Lorg/wso2/carbon/core/services/echo/EchoPortType;
at org.apache.axis2.rpc.receivers.RPCMessageReceiver.invokeBusinessLogic(RPCMessageReceiver.java:208)
at org.apache.axis2.receivers.AbstractInOutMessageReceiver.invokeBusinessLogic(AbstractInOutMessageReceiver.java:40)
at org.apache.axis2.receivers.AbstractMessageReceiver.receive(AbstractMessageReceiver.java:110)
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180)
at org.apache.synapse.transport.passthru.ServerWorker.processEntityEnclosingRequest(ServerWorker.java:395)
at org.apache.synapse.transport.passthru.ServerWorker.run(ServerWorker.java:142)
at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.apache.axis2.rpc.receivers.RPCUtil.invokeServiceClass(RPCUtil.java:212)
at org.apache.axis2.rpc.receivers.RPCMessageReceiver.invokeBusinessLogic(RPCMessageReceiver.java:117)
... 9 more
Caused by: java.lang.NoSuchMethodError: org.wso2.carbon.core.services.echo.Echo.getEchoHttpSoap12Endpoint()Lorg/wso2/carbon/core/services/echo/EchoPortType;
at service.ChangeName.echoString(ChangeName.java:27)
at service.ChangeName.changeName(ChangeName.java:34)
... 15 more

这是在ESB之外工作的代码:

public static String echoString(java.lang.String in) {
    Echo service = Echo();
    EchoPortType port = service.getEchoHttpSoap12Endpoint(); <-- ERROR HERE
    BindingProvider bp = (BindingProvider)port;
    bp.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,LOCAL_ENDPOINT);
    return port.echoString(in);
}

有任何解决此问题的建议吗?

1 个答案:

答案 0 :(得分:0)

如果您使用生成的客户端作为&#34; jar依赖&#34;,您需要将此jar放到文件夹src / main / resources / lib 或者把你的罐子放到&#34; dropins&#34; wso2esb的文件夹。