Best way to use .NET .NET services in Java

I am trying to use some .NET web services using JAX-WS. I created Java classes using the wsimport tool. However, when I try to use these (proprietary, not public) web services in Java, I notice that most of the methods and properties provided by the provider in their C # examples are not available in the generated classes (despite the absence of any errors when creating Java classes from the WSDL file). Connecting to web services also works mostly.

When I tried to generate the C # class using wsdl.exe from the .NET SDK, all the methods were correctly generated.

What would be the best way to use .NET web services so that full functionality is available in Java and why does wsimport generate only a small subset of all the methods and properties described in the WSDL file?

Example: in the WSDL file UserManagement.wsdl there is a fragment

<s:schema elementFormDefault="qualified" targetNamespace=" http://www.initechsystems.com/initech7/initechws/ "> <s:element name="UserSecurityContext" type="s2:UserSecurityContext"/> <s:complexType name="UserSecurityContext"> <s:sequence> <s:element minOccurs="0" maxOccurs="1" name="Token" type="s2:UserToken"/> </s:sequence> </s:complexType> <s:complexType name="UserToken"> <s:sequence> <s:element minOccurs="0" maxOccurs="1" name="Value" type="s:string"/> </s:sequence> </s:complexType> </s:schema> 

In C #, I can access the UserSecurityContext as follows:

 UserManagement userMgmt = new UserManagement(); userMgmt.UserSecurityContextValue = new SampleWS.UserRef.UserSecurityContext(); 
However, in Java I can create the UserManagement object

 UserManagement userMgmt = new UserManagement(); 

but the generated UserManagement object does not have any SecurityContext object available, and not getters or setters for such a private object.

+4
source share
2 answers

I would like to see the example you are talking about, since it looks like the example sends objects with wiring behavior, and not just with models (or messages, if you prefer the best term SOA).

When you send an object that is formed as a data model or message, it will not contain methods to use. And, with interop, it doesn't make much sense to tweak the behavior (methods) to go through the wire.

As for what you can do as you serialize, you can create behavioral methods if they make sense on your side. Personally, I would create behavior in other objects and save the models / messages as state containers. But your mileage may vary .; -)

+1
source

All Articles