You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ws.apache.org by ge...@ws.apache.org on 2005/01/11 09:55:33 UTC

[Apache Web Services Wiki] New: FrontPage/Axis/DotNetInterop

   Date: 2005-01-11T00:55:32
   Editor: ToshiyukiKimura
   Wiki: Apache Web Services Wiki
   Page: FrontPage/Axis/DotNetInterop
   URL: http://wiki.apache.org/ws/FrontPage/Axis/DotNetInterop

   Importing old wiki ...

New Page:

##language:en
'''Interoperability Notes on Apache Axis 1.1 and [http://msdn.microsoft.com/library/default.asp?url=/downloads/list/netdevframework.asp Microsoft .NET Framework] 1.0/1.1 FAQ'''

'''Q: What datatypes can be safely used between Java and the Microsoft .NET Framework?'''

A: The following simple Java datatypes can be used: String, boolean, byte, short, int, long, float, and double. You can also create typed arrays of any of the above. Standard Sun [http://java.sun.com/products/javabeans/ JavaBeans] and arrays of {{{JavaBeans}}} are supported as well. 

'''Q: What about transferring java.util.Calendar values?'''

A: There are known problems with serializing/deserializing Calendar objects. Under Java, the [http://java.sun.com/j2se/1.4.2/docs/api/java/util/Calendar.html Calendar] class includes timezone information. Under .NET, the [http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfSystemDateTimeClassTopic.asp System.DateTime] structure does not contain timezone information. The .NET Framework assumes its timezone is the current timezone when serializing and ignores it when deserializing. As a result, values can be off by +/- 24 hours. 

Two possible work arounds are the use of a string or wrapper value object. When transmitting time values, a long of time in seconds (classic C time_t) is recommended. 

'''Q: Can you provide mappings for Java datatypes to their equivalents under .NET?'''

A: Sure. 

{{{
  Java            C#.NET     VB.NET      .NET Framework Type  
   String     string     String      [http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfSystemStringClassTopic.asp System.String] 
   boolean    bool       Boolean     [http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfSystemBooleanClassTopic.asp System.Boolean] 
   byte       sbyte      -N/A-       [http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfSystemSByteClassTopic.asp System.SByte] 
   short      short      Decimal     [http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfSystemInt16ClassTopic.asp System.Int16] 
   int        int        Integer     [http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfSystemInt32ClassTopic.asp System.Int32] 
   long       long       Long        [http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfSystemInt64ClassTopic.asp System.Int64] 
   float      float      Single      [http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfSystemSingleClassTopic.asp System.Single] 
   double     double     Double      [http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfSystemDoubleClassTopic.asp System.Double] 
}}}

'''Q: Can the standard Java primitive wrappers like java.lang.Integer or java.lang.Double be used?'''

A: Not directly. Microsoft C# does not have an equivalent language feature. You could work around this by using the C# [http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfSystemObjectClassTopic.asp System.Object] datatype. 

'''Q: What datatypes or design patterns should I avoid when seeking maximum interoperability?'''

A: You should avoid the following constructs: 

{{{
      * Standard Java Collection classes.  
      * Typesafe enumerations.  Use static final variables within Java instead. 
      * Multi-dimensional and jagged arrays. 
      * Sparse arrays (allowed in SOAP 1.1, not in SOAP 1.2). 
      * The Java char datatype is not supported because of an omission in XML Schema. 
      * Avoid using the same method name multiple times with varying parameters on a web service. 
}}}

'''Q: How does one go about transmitting attachments between Java and the Microsoft .NET Framework?'''

A: Both shipping versions of the .NET Framework 1.0 and 1.1 do NOT provide any support for attachments. 

The recent Microsoft Web Services Enhancements (WSE) does add support for [/Dime DIME (Direct Internet Message Encapsulation)]. As a result, DIME support requires the installation on WSE on client machines. 

Axis does support both MIME and DIME attachments: the server handles either, the client needs to be told to use DIME when sending messages. 

'''Q: Are there any requirements for using Axis with Microsoft Web Services Enhancements (WSE)?'''

A: To use the WSE toolkit with Axis, you need to turn off WS-Routing. 

This can be done by adding the following call: 

{{{ 
_server.RequestSoapContext.Path.MustUnderstand = false;
}}}

Otherwise you get a {{{MustUnderstand}}} fault when Axis fails to understand the WS-Routing headers. For more info, see [http://www.anecon.com/aktuelles/Java_and_dotNet_Interoperability_HowTo.pdf Java & .NET Interop - How To]. 

'''Q: Is there built in support for compressing messages using something like GZIP?'''

A: Unfortunately at this time no. In fact, the .NET Framework does not include a built in compression library. 

  Click on the following link for a discussion and potential work around to the issue: [http://marc.theaimsgroup.com/?l=axis-dev&m=106086909809576&w=2 archive]

  It does appear GZIP compression support will be added in the .NET Framework 2.0. 
  See the following article for more information: 
  [http://msdn.microsoft.com/netframework/archive/default.aspx?pull=/library/en-us/dnvs05/html/wsnetfx2.asp New Features for Web Service Developers in Beta 1 of the .NET Framework 2.0]

'''Q: Are there any documented web service bugs in Microsoft .NET Framework?'''

A: Yes, within .NET 1.0 there is an issue with empty array deserialization described in the following article: 

  BUG: Incorrect Results Occur When a Web Service Returns an Array of Size 0  
  [http://support.microsoft.com/default.aspx?scid=kb;en-us;330065 archive]

   This bug has been corrected in the .NET 1.1 release. 
   Starting with Axis 1.1RC2, you can place the following entry within your WSDD file to work around the issue: 
 
{{{
  <globalConfiguration> 
     <parameter name="axis.sendMinimizedElements" value="false"/> 
   </globalConfiguration> 
}}}

It is recommended that you only enable this option if you must support .NET 1.0 clients. }}} 

'''Q: Can you provide a recommendation of how to transport a java.util.Map to C#?'''

A: See [http://wiki.apache.org/old/AxisProjectPages_2fDotNetInteropMapInfo /DotNetInteropMapInfo].

--------------------------------------------------------------------------------

'''Q: Could someone please provide an example of {{JavaBean}}} serialization and access from a C# or other .Net client? I am able to generate a C# client proxy from the Axis-generated WSDL (using wsdl.exe), but when using it, I get a [http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfSystemInvalidOperationExceptionClassTopic.asp System.InvalidOperationException] when the proxy tries to unmarshall the response.'''

A: For a working bean example see: http://www.pankaj-k.net/axis4tag/ (this is a Java only example and not what was asked for) The .Net Framework 1.0 has a bug that results in this sort of error when empty arrays are deserialized on the client. http://support.microsoft.com/default.aspx?scid=kb;en-us;330065 

'''Q: Is there a list of web service related changes made between the Microsoft .NET Framework 1.0 and 1.1?'''

A: Yes, See the following articles: 

[http://www.perfectxml.com/DotNet11Changes.asp XML & Web Services Changes in .NET Framework 1.1]

[http://msdn.microsoft.com/webservices/default.aspx?pull=/library/en-us/dnwebsrv/html/syswebserchange.asp Changes in System.web.services from .NET Framework 1.0 to 1.1]

'''Resources'''

[http://msdn.microsoft.com/webservices/ MSDN Web Services Developer Center]

[http://www.west-wind.com/articles.asp West Wind Technologies White Papers]

'''Q: Why sendNull parameter of the method "{{{org.apache.axis.encoding.SerializationContextImpl.serialize}}}" is hard code set to true ?'''

'''Remark: When you want to access to a Microsoft Web Services, the parameters with a Null value shouldn't be sent. I think it will be interesting to add a Tag in the {{{client-config.wsdd}}} to choose if we want to send {{{<Parameter xsi:nil="true"/>}}} in the SOAP envelope of the request.'''