全部,
我正在使用Axis2
Web服务。这些服务捆绑为.aar file
并部署在WSO2 Application Server(AS)
中。我能够在Windows environment
以及Linux environment
中运行的WSO2 AS中部署生成的.aar。
问题是,
当我尝试访问托管在两个环境(Windows和Linux)中的POST服务时,我是getting response in Windows while getting the following error in the Linux
环境。
java.lang.IllegalArgumentException: wrong number of arguments
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:616)
at org.apache.axis2.rpc.receivers.RPCUtil.invokeServiceClass(RPCUtil.java:178)
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:434)
at org.apache.synapse.transport.passthru.ServerWorker.run(ServerWorker.java:219)
at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1146)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:679)
TID: [0] [ESB] [2013-07-02 04:18:22,576] ERROR {org.apache.synapse.transport.passthru.ServerWorker} - Error processing POST request for : /services/MyService/postRequest {org.apache.synapse.transport.passthru.ServerWorker}
org.apache.axis2.AxisFault: wrong number of arguments
at org.apache.axis2.AxisFault.makeFault(AxisFault.java:430)
at org.apache.axis2.rpc.receivers.RPCMessageReceiver.invokeBusinessLogic(RPCMessageReceiver.java:211)
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:434)
at org.apache.synapse.transport.passthru.ServerWorker.run(ServerWorker.java:219)
at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1146)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:679)
Caused by: java.lang.IllegalArgumentException: wrong number of arguments
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:616)
at org.apache.axis2.rpc.receivers.RPCUtil.invokeServiceClass(RPCUtil.java:178)
at org.apache.axis2.rpc.receivers.RPCMessageReceiver.invokeBusinessLogic(RPCMessageReceiver.java:117)
... 9 more.
以下是我给出的输入:
URI:
https://localhost:8243/services/MyService/postRequest
Input XML:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ser="http://service.sample.vijay.com">
<soapenv:Header/>
<soapenv:Body>
<ser:postRequest>
<ser:paramOne>Hello</ser:paramOne>
<ser:paramTwo>All</ser:paramTwo>
<ser:paramThree>This is POST request</ser:paramThree>
</ser:postRequest>
</soapenv:Body>
</soapenv:Envelope>
当我尝试使用Windows machine
(Chrome浏览器 - &gt; cREST插件)中的rest客户端访问上述服务时,它会返回我预期的结果。
但是当我在Linux environment
中尝试使用相同URI的相同请求时(主机地址单独更改为Linux IP),最终出现上述错误(想知道可能是什么问题)。
Do I need to change any configuration in Linux machine or WSO2 Application Server in Linux machine?
注意:
当我将URI更改为https://localhost:8243/services/MyService
时,它在Linux和Windows中都能正常工作。但我的要求是在URI中使用Web方法名称(/postRequest here
)
请帮我解决这个奇怪的问题
提前致谢。
修改:
我的services.xml是:
<serviceGroup name="AxisServices">
<service name="MyService">
<description>
Please Type your service description here
</description>
<messageReceivers>
<messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-only"
class="org.apache.axis2.rpc.receivers.RPCInOnlyMessageReceiver"></messageReceiver>
<messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-out"
class="org.apache.axis2.rpc.receivers.RPCMessageReceiver"></messageReceiver>
</messageReceivers>
<parameter name="ServiceClass" locked="false">com.vijay.sample.service.MyService</parameter>
</service>
我的Java课程:
package com.vijay.sample.service;
public class MyService {
public String postRequest(String paramOne, String paramTwo, String paramThree) {
// Logic here
return "Success";
}
}
答案 0 :(得分:0)
您可以尝试以下URI来访问服务
http://localhost:9763/services/MyService/postRequest
而不是
https://localhost:8243/services/MyService/postRequest