Клиент C # не может вызвать веб-сервис Java Axis2 - PullRequest
1 голос
/ 20 февраля 2011

У меня есть встроенный Java-сервис Axis2, который отлично работает с Soap UI и с клиентом CXF / Axis Мне также нужно заставить его работать с клиентом .Net / C #, созданным с использованием Microsoft Visual Studio 2008.

Когда я пытаюсь позвонить, используя службу через клиент Microsoft Visual Studio, это не удается.

Пожалуйста, смотрите код Visual Studio: -

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);

        }
    }
}

Исключение на стороне клиента: -

System.ServiceModel.FaultException было необработанное сообщение = "неизвестно"
Source = "mscorlib" StackTrace: Трассировка стека сервера: в System.ServiceModel.Channels.ServiceChannel.HandleReply (ProxyOperationRuntime операция, ProxyRpc & rpc) в System.ServiceModel.Channels.ServiceChannel.Call (String действие, логическое одностороннее, Операция ProxyOperationRuntime, Object [] ins, Object [] outs, TimeSpan тайм-аут) в System.ServiceModel.Channels.ServiceChannelProxy.InvokeService (IMethodCallMessage methodCall, ProxyOperationRuntime операция) в System.ServiceModel.Channels.ServiceChannelProxy.Invoke (IMessage сообщение) Исключение переброшено в [0]: в System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage (IMessage reqMsg, IMessage retMsg) в System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke (MessageData & msgData, тип Int32) at ConsumeNameWorldwideWebService.NameWorldwideClient.HIqualityNameWorldwidePortType.interpret (interpretRequest запрос) по адресу запрос) в C: \ работа \ consumenameworldwidewebservice \ consumenameworldwidewebservice \ сервис ссылки \ nameworldwideclient \ Reference.cs: линия 1131 at ConsumeNameWorldwideWebService.Form1.button1_Click (Object отправитель, EventArgs e) в C: \ работа \ ConsumeNameWorldwideWebService \ ConsumeNameWorldwideWebService \ Form1.cs: линия 33 в System.Windows.Forms.Control.OnClick (EventArgs е) в System.Windows.Forms.Button.OnMouseUp (MouseEventArgs mevent) в System.Windows.Forms.Control.WmMouseUp (Сообщение & m, кнопка MouseButtons, щелчки Int32) в System.Windows.Forms.Control.WndProc (Сообщение & м) в System.Windows.Forms.ButtonBase.WndProc (Сообщение & м) в System.Windows.Forms.Button.WndProc (Сообщение & м) в System.Windows.Forms.Control.ControlNativeWindow.WndProc (Сообщение & м) в System.Windows.Forms.NativeWindow.DebuggableCallback (IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr LPARAM) в System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW (MSG & сбщ) в System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop (Int32 dwComponentID, причина Int32, Int32 pvLoopData) в System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner (Int32 причина, контекст ApplicationContext) в System.Windows.Forms.Application.ThreadContext.RunMessageLoop (Int32 причина, контекст ApplicationContext) at ConsumeNameWorldwideWebService.Program.Main () в C: \ работа \ ConsumeNameWorldwideWebService \ ConsumeNameWorldwideWebService \ Program.cs: линия 18 в System.AppDomain._nExecuteAssembly (Assembly сборка, строка [] args) в Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly () в System.Threading.ExecutionContext.Run (ExecutionContext executeContext, ContextCallback обратный вызов, состояние объекта) в System.Threading.ThreadHelper.ThreadStart () InnerException:

Исключение на стороне сервера: -

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

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

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

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

icationFilterChain.java: 215) в org.apache.catalina.core.ApplicationFilterChain.doFilter (ApplicationF ilterChain.java:188) в com.hi.openname.filter.OpenNameFilter.) в org.apache.catalina.core.StandardWrapperValve.invoke (StandardWrapperV alve.java:213) в org.apache.catalina.core.StandardContextValve.invoke (StandardContextV alve.java:172) в org.apache.al.StandardHostValve.invoke (StandardHostValve.j ava: 127) в org.apache.catalina.valves.ErrorReportValve.invoke (ErrorReportValve.j ava: 117) в org.apache.catalina.core.StandardEngineValve.invoke (StandardEngineVal ve.java:108) в org.apache.catalina.connector.CoyoteAdapter.service (CoyoteAdapter.jav a: 174) atg.apache.coyote.http11.Http11Processor.process (Http11Processor.java: 873) по адресу org.apache.coyote.http11.Http11BaseProtocol $ Http11ConnectionHandler.p rocessConnection (Http11BaseProtocol.java:apol.p.tom.tg.tg.tg.tg.tg.ttp_tg_t3p5) или om c at).processSocket (PoolTcpEndpo int.java:528) в org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt (LeaderFol lowerWorkerThread.java:81) в org.apache.tomcat.util.threads.ThreadPablerunool.java:689) at java.lang.Thread.run (Thread.java:619) Вызывается: java.lang.IllegalArgumentException в sun.reflect.NativeMethodAccessorImpl.invoke0 (собственный метод) в sun.reflect.NativeMethodAccessorImplNativeMethodAccessorImpl.java: 39) в sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAcces sorImpl.java:25) в java.lang.reflect.Method.invoke (Method.java:597) в org.apache.axis2.rpc.receivers.P.invokeServiceClass (RPCUtil.jav a: 194) в org.apache.axis2.rpc.receivers.RPCMessageReceiver.invokeBusinessLogic (RPCMessageReceiver.java:102) ... еще 27

Любая помощь будет принята с благодарностью.

1 Ответ

0 голосов
/ 20 февраля 2011

Подумайте: разве вы не должны передавать объект Request следующим образом:

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

Вместо того, чтобы передавать параметры отдельно, как вы делаете сейчас?

...