开发者

C# client fails to call Axis2 Java web service

I have a Axis2 built Java web service which works fine with Soap UI and using CXF/Axis client. I also need to make it work with .Net/C# client built using Microsoft Visual Studio 2008.

When I try to make a call using the service through Microsoft Visual Studio client it fails.

Please see the Visual Studio code : -

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using ConsumeNameWorldwideWebService.NameWorldwideService;

namespace ConsumeNameWorldwideWebService
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            HIqualityNameWorldwidePortTypeClient client = new HIqualityNameWorldwidePortTypeClient();
            validateFamilyNameRequest req = new validateFamilyNameRequest();
            req.input = "Kumar";
            req.maxNumberOfSuggestions = 2;
            DetailedNameResult res = client.validateFamilyName("Kumar",null,2);

        }
    }
}

Exception on client side: -

System.ServiceModel.FaultException was unhandled Message="unknown"

Source="mscorlib" StackTrace: Server stack trace: at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc& rpc) at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout) at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation) at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message) Exception rethrown at [0]: at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg) at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type) at ConsumeNameWorldwideWebService.NameWorldwideClient.HIqualityNameWorldwidePortType.interpret(interpretRequest request) at ConsumeNameWorldwideWebService.NameWorldwideClient.HIqualityNameWorldwidePortTypeClient.ConsumeNameWorldwideWebService.NameWorldwideClient.HIqualityNameWorldwidePortType.interpret(interpretRequest request) in c:\work\consumenameworldwidewebservice\consumenameworldwidewebservice\service references\nameworldwideclient\reference.cs:line 1131 at ConsumeNameWorldwideWebService.Form1.button1_Click(Object sender, EventArgs e) in C:\work\ConsumeNameWorldwideWebService\ConsumeNameWorldwideWebService\Form1.cs:line 33 at System.Windows.Forms.Control.OnClick(EventArgs e) at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent) at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks) at System.Windows.Forms.Control.WndProc(Message& m) at System.Windows.Forms.ButtonBase.WndProc(Message& m) at System.Windows.Forms.Button.WndProc(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m) at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg) at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData) at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context) at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context) at ConsumeNameWorldwideWebService.Program.Main() in C:\work\ConsumeNameWorldwideWebService\ConsumeNameWorldwideWebService\Program.cs:line 18 at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args) at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.ThreadHelper.ThreadStart() InnerException:

Exception on Server Side: -

java.lang.IllegalArgumentException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl. java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces sorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.apache.axis2.rpc.receivers.RPCUtil.invokeServiceClass(RPCUtil.jav a:194) at org.apache.axis2.rpc.receivers.RPCMessageReceiver.invokeBusinessLogic (RPCMessageReceiver.java:102) at org.apache.axis2.receivers.AbstractInOutMessageReceiver.invokeBusines sLogic(AbstractInOutMessageReceiver.java:40) at org.apache.axis2.receivers.AbstractMessageReceiver.receive(AbstractMe ssageReceiver.java:114) at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:173) at org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostReq uest(HTTPTransportUtils.java:167) at org.apache.axis2.transport.http.AxisServlet.doPost(AxisServlet.java:1 42) at javax.servlet.http.HttpServlet.service(HttpServlet.java:647) at javax.servlet.http.HttpServlet.service(HttpServlet.java:729) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl icationFilterChain.java:269) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF ilterChain.java:188) at org.apache.tapestry5.TapestryFilter.doFilter(TapestryFilter.java:129)

    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl

icationFilterChain.java:215) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF ilterChain.java:188) at com.hi.openname.filter.OpenNameFilter.doFilter(OpenNameFilter.java:46 ) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl icationFilterChain.java:215) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF ilterChain.java:188) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperV alve.java:213) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextV alve.java:172) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.j ava:127) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.j ava:117) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineVal ve.java:108) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.jav a:174) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java :873) at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.p rocessConnection(Http11BaseProtocol.java:665) at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpo int.java:528) at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFol lowerWorkerThread.java:81) at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadP ool.java:689) at java.lang.Thread.run(Thread.java:619) 2011-02-20 15:31:34,837 [http-8080-Processor25] ERROR AxisEngine - org.apache.axis2.AxisFault at org.apache.axis2.AxisFault.makeFault(AxisFault.java:430) at org.apache.axis2.rpc.receivers.RPCMessageReceiver.invokeBusinessLogic (RPCMessageReceiver.java:161) at org.apache.axis2.receivers.AbstractInOutMessageReceiver.invokeBusines sLogic(AbstractInOutMessageReceiver.java:40) at org.apache.axis2.receivers.AbstractMessageReceiver.receive(AbstractMe ssageReceiver.java:114) at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:173) at org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostReq uest(HTTPTransportUtils.java:167) at org.apache.axis2.transport.http.AxisServlet.doPost(AxisServlet.java:1 42) at javax.servlet.http.HttpServlet.service(HttpServlet.java:647) at javax.servlet.http.HttpServlet.service(HttpServlet.java:729) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl icationFilterChain.java:269) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF ilterChain.java:188) at org.apache.tapestry5.TapestryFilter.doFilter(TapestryFilter.java:129)

    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl

icationFilterChain.java:215) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF ilterChain.java:188) at com.hi.openname.filter.OpenNameFilter.doFilter(OpenNameFilter.java:46 ) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl icationFilterChain.java:215) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF ilterChain.java:188) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperV alve.java:213) at org.apache.catalina.开发者_高级运维core.StandardContextValve.invoke(StandardContextV alve.java:172) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.j ava:127) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.j ava:117) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineVal ve.java:108) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.jav a:174) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java :873) at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.p rocessConnection(Http11BaseProtocol.java:665) at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpo int.java:528) at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFol lowerWorkerThread.java:81) at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadP ool.java:689) at java.lang.Thread.run(Thread.java:619) Caused by: java.lang.IllegalArgumentException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl. java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces sorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.apache.axis2.rpc.receivers.RPCUtil.invokeServiceClass(RPCUtil.jav a:194) at org.apache.axis2.rpc.receivers.RPCMessageReceiver.invokeBusinessLogic (RPCMessageReceiver.java:102) ... 27 more

Any help would be really appreciated.


Quick thought: shouldn't you pass the Request object like so:

HIqualityNameWorldwidePortTypeClient client = new HIqualityNameWorldwidePortTypeClient();
    validateFamilyNameRequest req = new validateFamilyNameRequest();
    req.input = "Kumar";
    req.maxNumberOfSuggestions = 2;
    DetailedNameResult res = client.validateFamilyName(req);

Instead of passing the params separately as you do now?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜