views:

512

answers:

2

Hi,

I'm not an experienced java developer so any comment will be welcomed ...

I've written a web service using c# and I wanted to consume this service from java - used Netbeans for this task.

All methods works well beside one: the method expecting a type called BusinessDataField2 - this type contains 2 fields: name(string) and value(object)

Those fields are filled using get,set methods - this works easily at the .NET environment.

However ...

I can see that Java requires different parameters for the get and set methods - the parameter is :

JAXBElement JAXBElement

The question is: how do I instantiate this object? I tried many different ways but nothing worked...

Thanks, ofer

+2  A: 

You should not use the "object" type. It could be any actual type, but you're not telling the Java side what to expect. The best it can do, then, is process the actual XML of the value.

Consider: the object could be an int, or it could be some complex structure. How would the Java side know what to do with it? The Java side wouldn't even have a proxy classs for the complex structure, because you never told it that you could ever return the complex structure.

John Saunders
A: 

I'd recommend using the CXF web service framework to consume your web service. It can look at your wsdl file and generate java objects that correspond to your .net objects.

They have a HOWTO on their site as well.

ScArcher2