InvalidOperationException on webservice call with C# client and Java server side

My issues is similar to C# error executing soap client method but not exact. I want to pose a different question. On the Java server side I have a webservice with several methods. Here are 2 examples (mostly want to show the annotations here):

@WebResult(name = "result")
@WebMethod 
public TheResult method1(string x, string y) 
throws Exception
{
         TheResult result = new TheResult();
         // continue with code, not important
         return result;
      }
@WebResult(name = "result")
@WebMethod 
public Boolean method2(int x, string y) 
throws Exception
{
         Boolean result = new TheResult();
         // continue with code, not important
         return result;
      }

There are more methods and they all use @WebResult(name = "result"). The Java side was written by another developer long ago and I don't have an option to change this. I am getting an InvalidOperationException, Message=There was an error reflecting 'result'. The inner exception is the same but the messag is : The top XML element 'result' from namespace '' references distinct types...[details here left out purposely] Use XML attributes to specify another XML name or namespace for the element or types. As you can tell from my post so far I have zero'd in on the fact that the previous developer used 'result' for all web methods. This seems to be the problem and if I change the server code and recompile for testing purposes I can avoid the exception (again this is not an option).

I am using VS2012 for the client and I was able to pull in the Java webservice with little effort. Code was generated as expected. The exception occurs when I attempt to make a call to method1(bla, bla). How can I solve this on the client side using client side techniques only?

链接地址: http://www.djcxy.com/p/62944.html

上一篇: base.Show()抛出InvalidOperationException

下一篇: 使用C#客户端和Java服务器端调用webservice时的InvalidOperationException