Hi fellow Axisants, we're also having "Arrays of problems" here, with getting Axis (1.2RC1) Services on Tomcat and a couple of Axis and .net clients working together.
The Axis clients deserialize Arrays of Beans correctly, while .net clients give us some headaches: At the moment we have identified two bugs, one we believe is rooted in .net (seemingly the "item" problem, discussed elsewhere in this list). That one we forwarded to Microsoft via our Premier Support Channel, but have not yet received anything to fix the problem. The other "misunderstanding" seems to be caused by Axis, when .net will correctly generate the underlying Bean type, yet would not fill the array with anything but nulls. It's the "correct number of nulls", though -- so the array length is as expected, after all, thus indicating that the *Array* serializer works for his part... Seemingly the deserialization of the beans themselves fails, resulting in the array to be filled with nulls instead of bean instances. We have pinpointed our problem to a bug in Axis where namespaces are not correctly set in the SOAP messages (responses) sent by Axis in document/wrapped style. By doctoring the XML by hand, we found a "correct" XML instance that would be serialized correctly by .net. Our XML Gurus tell me that Axis is definitely producing bogus XML here, with respect to the Java2WSDL-generated WSDL (which we believe is ok). After some "desparate disbelief" on my side, I had to concede that indeed there is a problem in Axis. Eric, did you post your patch to the ASF JIRA at http://nagoya.apache.org/jira/secure/Dashboard.jspa? If so, please let us know the bug number. I guess some of us would like to track and/or vote for the bug. Since I don't know what problem the other thread was adressing (the one Tami mentioned in her opening post of this thread), I don't know wether the fix presented by Eric works for us. What exactly does this patch fix? I'll post an in-depth description of our problems tomorrow, if anyone is interested. So long, Flexx -----Original Message----- From: Patrick Herber *EXTERN* [mailto:[EMAIL PROTECTED] Sent: Friday, November 05, 2004 1:25 PM To: [EMAIL PROTECTED] Subject: RE: Array of Objects in Axis and .NET interop Hi, I'm implementing a Web Service (using doc/literal) that returns an Array of objects. This service should be used by different types of client (also including .NET clients). Since it didn't work properly under .NET (the result Array was always empty) I applied the patch described here by Eric (thanks!) and afterwards it worked just fine. Does somebody see any problem applying this patch? (If not why is it not yet included in the standard axis distribution?) Thanks a lot for your advice. Best regards, Patrick Patrick Herber > -----Original Message----- > From: Eric Chijioke [mailto:[EMAIL PROTECTED] > Sent: Mittwoch, 29. September 2004 16:01 > To: [EMAIL PROTECTED] > Cc: Tami Wright > Subject: RE: Array of Objects in Axis and .NET interop > > BTW, I am using Axis 1.2 beta. That is important. I should note that I > also did NOT generate my WSDL using Java2WSDL but rather built my WSDL > first and then java classes manually which has resulted in a much > leaner code base that would have been produced automatically. > > - I know that axis hardcodes the names of the elements of the array as > <item>. Axis doesn't seem to interrogate the WSDL to figure out the > 'proper' array element names (!?). It was too much for me to try and > modify Axis to do that, and using <item> is prefferable to me than the > former <XXXReturn> which it defaulted to. My current client is .NET, > and as I described below, one can easily configure .NET to expect the > array elements to be named <item> using a method attribute. > As for Axis clients, I don't think Axis cares what the array elements > are named when deserializing. > > - A Wrapper element around the array elements is the proper schema > according to the WS-I profile (WS-I Profile 1.1 section 4.3.3 - > soapenc:Array) > > - There's one more change I made to my Axis code which I realize I > left out. It fixed some namespace issues wherein under certain > circumstances, Axis would asign an empty namespace attribute > (xmlns="") to the elements of the serialized array, if they were in > the default namespace. > > > > The change is made to the > org.apache.axis.encoding.SerializationContextImpl.serializeActual() > method. > > I added these lines: > ------------ begin snippet ------------------------------------ > > if (elemQName.getNamespaceURI() == ""){ > > elemQName = new QName(this.nsStack.getNamespaceURI(""), > elemQName.getLocalPart()); > > } > > ------------ end snippet -------------------------------------- > > > Before this line: > ------------ begin snippet (Line# 1231) ------------------------ > > ser.serialize(elemQName, attributes, value, this); > return; > > ------------ end snippet -------------------------------------- > > > Though these changes (above and below in this thread) seem to make > sense, I must make the disclaimer that I have not done any systematic > testing to make sure that these changes do not break a configuration > that I am not using. Per peoples requests, I am just posting my > resolution to the Axis' array serialization/deserialization > interoperability problems - as is. > > - Eric > > > > > > > -----Original Message----- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > Sent: Monday, September 27, 2004 6:55 PM > To: [EMAIL PROTECTED] > Subject: RE: Array of Objects in Axis and .NET interop > > I tried this same approach but I then received an unknown element > exception with the Axis Java client. In addition I didn't care for > the defaulted hardcoding of the "item" name which was causing problems > in the .NET client (especially in a situation where the modification > of the generated .NET client is not possible). > > In addition I found that this change caused a service method that > returns an array to not return the correct xml results since it added > extra wrapper and used item. > > NOTE: I have discovered also that by removing the field type > description for the array property from the helper class causes the > serializer to output correctly, with the wrapping element. (although > the Axis client is unable to correctly deserialize). > > marcus > > > > > > > > -----Original Message----- > From: Eric Chijioke [mailto:[EMAIL PROTECTED] > Sent: Monday, September 27, 2004 12:30 PM > To: [EMAIL PROTECTED] > Cc: Tami Wright > Subject: RE: Array of Objects in Axis and .NET interop > > > Tami, > > Here's what I've done to make it work with .NET: > > I've located the following code in the > org.apache.axis.encoding.ser.ArraySerializer.serialize() > method And in both places, commented out the if(...) condition in > order to place an array wrapper around the elements for arrays > specified using the <element minOccurs="0" maxOccurs="unbounded"...> > WSDL syntax. > > > ------------ begin snippet (Line# 322) ------------------------ > > // if (!maxOccursUsage) { > //****** commented out *****// > serializeAttr = null; // since we are putting them here > context.startElement(name, attributes); > elementName = Constants.QNAME_LITERAL_ITEM; // } > //****** commented out *****// > > ------------ end snippet -------------------------------------- > > > With the corresponding serialization of a closing wrapper later on: > > > ------------ begin snippet (Line# 363)-------------------------- > > // if (!maxOccursUsage) > //****** commented out *****// > context.endElement(); > > ------------ end snippet --------------------------------------- > > > > In order to set the appropriate type of array elements, I also changed > the following code (a bit of a blind hack, but it works) in the same > method > FROM: > > ------------ begin snippet (Line# 336)-------------------------- > > context.serialize(elementName, serializeAttr, aValue, > componentQName, // prefered type > QName > true, // Send null values > null); // Respect default type > config > > ------------ end snippet --------------------------------------- > > TO: > > ------------ begin snippet ------------------------------------- > > context.serialize(elementName, serializeAttr, aValue, > > msgContext.getTypeMapping().getXMLType(aValue.getClass(),null, > encoded), > // prefered type QName > true, // Send null values > null); // Respect default type config > > ------------ end snippet --------------------------------------- > > > Remember, your .NET client needs to use the > System.Xml.Serialization.XmlArrayItemAttribute("item")] > attribute on your web service methods (in your Reference.cs > file) in order to consume arrays serialized form axis with elements > named <item>. > > I hope this helps, > Eric > > > > > > > > > -----Original Message----- > From: Tami Wright [mailto:[EMAIL PROTECTED] > Sent: Monday, September 27, 2004 12:25 PM > To: [EMAIL PROTECTED] > Subject: Array of Objects in Axis and .NET interop > > Hi, > > I wondered what the status was with the message thread originally > posted by Eric Chijioke entitled "Axis and .NET interoperability - > Arrays". Any interim solution that can be posted until the bug is > resolved would be appreciated. > > Best Regards, > > tami >