开发者

Interop problem calling jax-ws service with complex typed parameter from .net - fields received as null by server

开发者 https://www.devze.com 2022-12-22 00:15 出处:网络
I have create a web service in glassfish v3. The method I am try to call from .net using generated client in visual studio 2008 takes a single parameter which is basically a java bean - simple types (

I have create a web service in glassfish v3. The method I am try to call from .net using generated client in visual studio 2008 takes a single parameter which is basically a java bean - simple types (Double, String, Date) as fields with getters and setters (Actually it is an EJB entity class). I find that when I call the method from my c# client that the null values are received for the Double and Date parameters (but not for String ones) by the server. Interestingly, I was also having this problem within a java net beans generated client until I made the fields of the bean protected instead of private in the web service implementation, but in the java case all non primitive types including String came in as null.

Since the java client now works it seems the problem is with the way .net is marshalling the data. I am wondering if I can change the way the server generates the wsdl using annotations on the开发者_StackOverflow中文版 server side so that .net interprets it in the right way, or somehow control how .net generates the client - using parameters to a command line tool rather than generating the client using visual studio for example. I don't really want to build a client by hand.


The classes that are generated on the .NET side may include "FooSpecified" field used to indicate if the "Foo" property/field is set. These are an unfortunate side-effect of those types (Double, DateTime) being nullable in SOAP/WebServices/Java, but not being nullable in .NET. Instead of Nullable for the field, instead there may be an additional boolean field used to indicate if those fields are specified or not. Try explicitly setting those fields to true before sending them to your web service.

0

精彩评论

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

关注公众号