I wanted to let the
Axis users know of a potential problem with interoperability with .NET when
passing array data from AXIS to .NET. If an array has zero length,
different than a null array, .NET can not parse the encoded data. For
the purposes of this e-mail the java data type I use as an example
is:
String[] classOfServiceList;
classOfServiceList = new String[0];
Specifically .NET can
not parse a tag like the following in a SOAP message:
<classOfServiceList xsi:type="SOAP-ENC:Array"
SOAP-ENC:arrayType="xsd:string[0]"/>
After many grueling
days of working with Microsoft's tech support they recommended that we change
the SOAP message to provide a </classOfServiceList> terminating XML tag
to avoid a bug in .NET. Following is an example of this work
around:
<classOfServiceList xsi:type="SOAP-ENC:Array"
SOAP-ENC:arrayType="xsd:string[0]">
</classOfServiceList>
But, as a user of
Axis, this was would have been difficult for us to implement. So, when we have
an array of zero length, we set that array to null, thus avoiding the zero
length problems completely. Here is what the message looks like
now:
<classOfServiceList xsi:nil="true"/>
This work around
allowed us to move past this problem...
NOTE: Microsoft said
they have a fix for this in .NET v2 due to be released late this
year.
Jim Stickley
Birch Telecom
(816) 300-6743
[EMAIL PROTECTED]
-----Original
Message-----
From: Stickley,
Jim [mailto:[EMAIL PROTECTED]]
Sent: Monday, June 10,
2002 8:31
AM
To:
'[EMAIL PROTECTED]'
Subject: RE: AXIS to .NET
interoperability error!
The following note was sent to
my by Microsoft's tech support regarding the wsdl file generated by Axis, can
anyone confirm that these elements are missing from the WSDL file and if so,
am I using the tool wrong, or is there a bug in Axis? (WSDL file is
attached)
The
old one was missing the following imports:
Schema
with targetNamespace="http://PreorderComponent.Birch.com"
<import namespace="http://schemas.xmlsoap.org/soap/encoding/"
/>
Thank
you,
David
Jim
Stickley
Birch
Telecom
(816)
300-6743
[EMAIL PROTECTED]
-----Original
Message-----
From: Stickley,
Jim [mailto:[EMAIL PROTECTED]]
Sent: Friday, June 07,
2002 12:29
PM
To:
'[EMAIL PROTECTED]'
Subject: RE: AXIS to .NET
interoperability error!
For
those that are interested in this issue:
It
appears that this problem is a bug in .NET SOAP client. Microsoft
support staff has indicated to me that this will be fixed in .NET version 2
released late 2002. Since we have MSDN support agreement, we will
be getting a pre-release patch in the next week or so.
Jim
Stickley
Birch
Telecom
(816)
300-6743
[EMAIL PROTECTED]
-----Original
Message-----
From: Stickley,
Jim [mailto:[EMAIL PROTECTED]]
Sent: Friday, May 31,
2002 3:02
PM
To: '[EMAIL PROTECTED]';
'[EMAIL PROTECTED]'
Cc:
Robertson, Angela
Subject:
RE: AXIS to .NET interoperability error!
I guess
a better way to put it would be to ask:
Should objects be
serialized depth first or breadth first?
It
appears that they are serialized breadth first, but if the serialization is
done depth first, then objects would always be generated so that the client
could deserialize an object knowing that all of its references have already
been deserialized.
Jim
Stickley
Birch
Telecom
(816)
300-6743
[EMAIL PROTECTED]
-----Original
Message-----
From: Stickley,
Jim [mailto:[EMAIL PROTECTED]]
Sent: Friday, May 31,
2002 2:54
PM
To: '[EMAIL PROTECTED]';
'[EMAIL PROTECTED]'
Cc:
Robertson, Angela
Subject:
RE: AXIS to .NET interoperability error!
Is it
possible that the order of objects in the SOAP message are not correct, i.e.
should the object for 'id1' be posted prior to making any references to
it? Right now the object 'id1' appears after the reference to it has
been made. What does SOAP standard state about the order of object
references in the SOAP message?
Jim
Stickley
Birch
Telecom
(816)
300-6743
[EMAIL PROTECTED]
-----Original
Message-----
From: Stickley,
Jim [mailto:[EMAIL PROTECTED]]
Sent: Friday, May 31,
2002 8:43
AM
To: '[EMAIL PROTECTED]';
'[EMAIL PROTECTED]'
Cc:
Robertson, Angela
Subject:
AXIS to .NET interoperability error!
After
having fixed the exception in my original message, I now get the following
exception from .NET. Does anyone have any ideas what might be causing
this failure? I have attached the complete wsdl and the response to the
request. I have clipped out the relevant info below:
-
Exception generated
by .NET (basically it states that 'id1' is not found):
System.Reflection.TargetInvocationException: Exception has been thrown by the
target of an invocation. ---> System.InvalidOperationException: There is an
error in XML document (553, 3). ---> System.InvalidOperationException: The
referenced element with ID 'id1' was not found in the
document.
-
The array that is
having the error is in CSRGroupOrder.csrList definition is in
CSRSessionHomeSOAP.wsdl line 85 (clipped out below)
<element
name="csrList" nillable="true" type="intf:ArrayOfCSR"/>
-
ArrayOfCSR definition
is in CSRSessionHomeSOAP.wsdl line 828
<complexType name="ArrayOfCSR">
<complexContent>
<restriction base="SOAP-ENC:Array">
<attribute ref="SOAP-ENC:arrayType"
wsdl:arrayType="intf:CSR[]"/>
</restriction>
</complexContent>
</complexType>
-
The soap response
containing the data causing the error is in Response.txt line 28 (clipped out
below)
<csrList xsi:type="SOAP-ENC:Array"
SOAP-ENC:arrayType="ns2:CSR[2]">
<item href="#id1"/>
<item href="#id2"/>
</csrList>
-
The supposedly
missing id1 is in the Response.txt at line 39 and is included below.
Does anyone see any reason why .NET should fail to process this
response?
<multiRef id="id1" SOAP-ENC:root="0"
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xsi:type="ns3:CSR" xmlns:ns3="http://PreorderComponent.Birch.com"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/">
<LAST_MOD_BY xsi:nil="true"/>
<LAST_MOD_DATE xsi:nil="true"/>
<CREATE_BY xsi:nil="true"/>
<CREATE_DATE xsi:nil="true"/>
<csrRequest href="#id4"/>
<csrResponse href="#id5"/>
<CSR_ID xsi:type="xsd:long">9</CSR_ID>
<INCLUDE_ON_ORDER xsi:nil="true"/>
<REC_STAT xsi:nil="true"/>
<ILEC_ID xsi:type="xsd:long">1</ILEC_ID>
</multiRef>
Jim
Stickley
Birch
Telecom
(816)
300-6743
[EMAIL PROTECTED]
-----Original
Message-----
From: Stickley,
Jim [mailto:[EMAIL PROTECTED]]
Sent: Thursday, May 30,
2002 4:43
PM
To: '[EMAIL PROTECTED]';
'[EMAIL PROTECTED]'
Cc:
Robertson, Angela
Subject:
RE: WebService Studio error...
Found
the problem... It is a server side problem with the way we setup the
CSRGroupOrder object... the getter/setter for the csrList was overloaded
(getCsrList() and setCSRList() ). There was one for getting and setting
the list and another to get elements of the list given an index as
input. To fix the problem we renamed the getter/setter for accessing
individual elements so it did not confuse the WSDL generator in AXIS.
It is
very strange how AXIS interpreted the overloaded getter.
Jim
Stickley
Birch
Telecom
(816)
300-6743
[EMAIL PROTECTED]
-----Original
Message-----
From: Stickley,
Jim [mailto:[EMAIL PROTECTED]]
Sent: Thursday, May 30,
2002 12:21
PM
To: '[EMAIL PROTECTED]'
Cc: [EMAIL PROTECTED]; Robertson,
Angela
Subject: WebService
Studio error...
I received the following error
from a web service call using the WebService Studio on Windows XP (latest .Net
patches)... The particular object it is complaining about is an array of CSR
objects. For some reason the .NET client can not move the elements of
the array from the SOAP message into the stub class.
Can somone explain if this is an
error is due to a problem with the server not constructing the message
correctly, or is it a problem with the .NET client not interpreting the
message correctly?
I have attached the WSDL file and
the XML response that generated this error. To provide a point to focus
on, the CSR[] element is a member of the CSRGroupOrder class and is named
csrList (see CSRSessionHomeSOAP.wsdl file, line 85). This array has two
elements in it (see Response.txt file, line 28 and 29). The SOAP server
is running Apache Axis Beta 2 (05/13/02 code drop
date) with Tomcat 4.x. Thanks for any help you can
provide.
System.Reflection.TargetInvocationException:
Exception has been thrown by the target of an invocation. --->
System.InvalidOperationException: There is an error in XML document (546, 4).
---> System.InvalidCastException: Cannot assign object of type CSR to an
object of type CSR[].
at
Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReader1.fixup_Read39_CSRGroupOrder(Object
objFixup)
at
System.Xml.Serialization.XmlSerializationReader.DoFixups()
at
System.Xml.Serialization.XmlSerializationReader.ReadReferencedElements()
at
Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReader1.Read61_retrieveNaturalCSRResponse()
--- End of inner
exception stack trace ---
at
System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader
xmlReader)
at
System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage
message, WebResponse response, Stream responseStream)
at
System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName,
Object[] parameters)
at
CSRSessionHomeSOAPService.retrieveNaturalCSR(Int64 sessionId, Int64
csrGroupOrderId)
--- End of inner
exception stack trace ---
at
System.Reflection.RuntimeMethodInfo.InternalInvoke(Object obj, BindingFlags
invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean
isBinderDefault, Assembly caller, Boolean verifyAccess)
at
System.Reflection.RuntimeMethodInfo.InternalInvoke(Object obj, BindingFlags
invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean
verifyAccess)
at
System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags
invokeAttr, Binder binder, Object[] parameters, CultureInfo
culture)
at
WebServiceStudio.MainForm.InvokeWebMethod()
at
WebServiceStudio.MainForm.buttonInvoke_Click(Object sender, EventArgs
e)
at
System.Windows.Forms.Control.OnClick(EventArgs e)
at
System.Windows.Forms.Button.OnClick(EventArgs e)
at
System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at
System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button,
Int32 clicks)
at
System.Windows.Forms.Control.WndProc(Message& m)
at
System.Windows.Forms.ButtonBase.WndProc(Message& m)
at
System.Windows.Forms.Button.WndProc(Message& m)
at
System.Windows.Forms.ControlNativeWindow.OnMessage(Message&
m)
at
System.Windows.Forms.ControlNativeWindow.WndProc(Message&
m)
at
System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr
wparam, IntPtr lparam)
************** Loaded Assemblies
**************
mscorlib
Assembly
Version: 1.0.3300.0
Win32 Version:
1.0.3705.209
CodeBase:
file:///c:/windows/microsoft.net/framework/v1.0.3705/mscorlib.dll
----------------------------------------
WebServiceStudio
Assembly
Version: 1.1.3102.0
Win32 Version:
1.1.3102.0
CodeBase:
file:///C:/Program%20Files/WebServiceStudio/WebServiceStudio.exe
----------------------------------------
System.Windows.Forms
Assembly
Version: 1.0.3300.0
Win32 Version:
1.0.3705.0
CodeBase:
file:///c:/windows/assembly/gac/system.windows.forms/1.0.3300.0__b77a5c561934e089/system.windows.forms.dll
----------------------------------------
System
Assembly
Version: 1.0.3300.0
Win32 Version:
1.0.3705.0
CodeBase:
file:///c:/windows/assembly/gac/system/1.0.3300.0__b77a5c561934e089/system.dll
----------------------------------------
System.Web.Services
Assembly
Version: 1.0.3300.0
Win32 Version:
1.0.3705.0
CodeBase:
file:///c:/windows/assembly/gac/system.web.services/1.0.3300.0__b03f5f7f11d50a3a/system.web.services.dll
----------------------------------------
System.Xml
Assembly
Version: 1.0.3300.0
Win32 Version:
1.0.3705.0
CodeBase:
file:///c:/windows/assembly/gac/system.xml/1.0.3300.0__b77a5c561934e089/system.xml.dll
----------------------------------------
System.Web
Assembly
Version: 1.0.3300.0
Win32 Version:
1.0.3705.0
CodeBase:
file:///c:/windows/assembly/gac/system.web/1.0.3300.0__b03f5f7f11d50a3a/system.web.dll
----------------------------------------
System.Drawing
Assembly
Version: 1.0.3300.0
Win32 Version:
1.0.3705.0
CodeBase:
file:///c:/windows/assembly/gac/system.drawing/1.0.3300.0__b03f5f7f11d50a3a/system.drawing.dll
----------------------------------------
1u6akmya
Assembly
Version: 0.0.0.0
Win32 Version:
1.0.3705.0
CodeBase:
file:///c:/windows/assembly/gac/system/1.0.3300.0__b77a5c561934e089/system.dll
----------------------------------------
System.Data
Assembly
Version: 1.0.3300.0
Win32 Version:
1.0.3705.0
CodeBase:
file:///c:/windows/assembly/gac/system.data/1.0.3300.0__b77a5c561934e089/system.data.dll
----------------------------------------
qzyvr9g2
Assembly
Version: 0.0.0.0
Win32 Version:
0.0.0.0
CodeBase:
file:///C:/DOCUME~1/STICKL~1/LOCALS~1/Temp/qzyvr9g2.dll
----------------------------------------
e5w10czw
Assembly
Version: 0.0.0.0
Win32 Version:
1.0.3705.0
CodeBase:
file:///c:/windows/assembly/gac/system/1.0.3300.0__b77a5c561934e089/system.dll
----------------------------------------
System.Design
Assembly
Version: 1.0.3300.0
Win32 Version:
1.0.3705.0
CodeBase:
file:///c:/windows/assembly/gac/system.design/1.0.3300.0__b03f5f7f11d50a3a/system.design.dll
----------------------------------------
Accessibility
Assembly
Version: 1.0.3300.0
Win32 Version:
1.0.3705.0
CodeBase:
file:///c:/windows/assembly/gac/accessibility/1.0.3300.0__b03f5f7f11d50a3a/accessibility.dll
----------------------------------------
************** JIT Debugging
**************
To enable just in time (JIT)
debugging, the config file for this
application or machine
(machine.config) must have the
jitDebugging value set in the
system.windows.forms section.
The application must also be
compiled with debugging
enabled.
For example:
<configuration>
<system.windows.forms jitDebugging="true" />
</configuration>
When JIT debugging is enabled, any
unhandled exception
will be sent to the JIT debugger
registered on the machine
rather than being handled by this
dialog.
Jim Stickley
Birch Telecom
(816) 300-6743
[EMAIL PROTECTED]