Eric, Please post this description with your bug in JIRA.
Thanks!!!! -----Original Message----- From: Eric Chijioke [mailto:[EMAIL PROTECTED] Sent: Friday, September 24, 2004 10:46 AM To: [EMAIL PROTECTED]; Ellecer Valencia Subject: RE: Axis and .NET interoperability - Arrays Ellecer, The following comments apply to my experiences serializing arrays using Axis 1.2 beta 3 -> Doc/literal/wrapped Depending on how your array is described in your WSDL, Axis serializes the element names differently. For arrays described using the <element minOccurs="0" maxOccurs="unbounded"...> WSDL syntax (Correct according to WS-I), Axis purports to use the element name it receives from the operation description. For arrays specified using SOAP encoding (prohibited by WS-I), Axis names each element <item> as you observed. .NET clients can be easily configured to acommodate this. To handle these arrays in .NET, simply apply the [return: System.Xml.Serialization.XmlArrayItemAttribute("item")] attribute to your web service function (in your Reference.cs file) expecting an array with <item> elements and .NET will expect to deserialize array elements named <item>. However: I have found that if your arrays are specified using the <element name="arrayElement" minOccurs="0" maxOccurs="unbounded"...> WSDL syntax, Axis does NOT use the name attribute specified in the array schema in the WSDL to name the array elements as I think it should. Instead, it names each element <XXXReturn> where XXX is the name of the 'method' being called (It only uses an element name if provided in an operation description in your WSDD). Furthermore, as I have noted previously in this thread. Axis places these <XXXReturn> array elements directly in the root method element. So for a function called getMyArray, which returns a 'MyArray' array, described in the WSDL <types> section like this: <complexType name="MyArrayType"> <sequence> <element name="arrayElement" type="intf:ArrayItem" minOccurs="0" maxOccurs="unbounded"/> </sequence> </complexType> The Axis response looks something like this: <?xml version="1.0" encoding="utf-8"?> <soapenv:Envelope namespaces="omitted"> <soapenv:Body namespaces="omitted"> <getMyArrayResponse namespaces="omitted"> <getMyArrayReturn> <name>My Test Factor</name> <id>1</id> </getMyArrayReturn> <getMyArrayReturn> <name>My Test Factor</name> <id>1</id> </getMyArrayReturn> <getMyArrayReturn> <name>My Test Factor</name> <id>1</id> </getMyArrayReturn> </getMyArrayResponse > </soapenv:Body> </soapenv:Envelope> However, if you provide an operation description in your WSDD, Axis WILL use the element name described in the operation instead of the <XXXReturn> element name. So if you have the same conditions as above, and following operation described in your WSDD (namespaces omitted): <operation name="getMyArray" qname="ns:getMyArray" returnQName="ns1:arrayElement" returnType="ns1:MyArrayType"> <parameter name="id" type="xsd:string"/> </operation> Axis will return the following response: <?xml version="1.0" encoding="utf-8"?> <soapenv:Envelope namespaces="omitted"> <soapenv:Body namespaces="omitted"> <getMyArrayResponse namespaces="omitted"> <arrayElement> <name>My Test Factor</name> <id>1</id> </arrayElement> <arrayElement> <name>My Test Factor</name> <id>1</id> </arrayElement> <arrayElement> <name>My Test Factor</name> <id>1</id> </arrayElement> </getMyArrayResponse > </soapenv:Body> </soapenv:Envelope> With the appropriate <arrayElement> named array elements. The bigger problem - and one which .NET CANNOT handle (that I know of),. Is that these elements are still directly below the <getMyArrayResponse> element and not wrappered with the element described by your WSDL (the name attribute of the element in your WSDL <types> section that references the MyArrayType) So to summarize, I see two issues for arrays described using the WSDL syntax deemed correct by WS-I. 1) During serialization, Axis does not wrapper these arrays in the appropriate containing element. 2) Axis does not use the element name specified in the WSDL description of the array to name the arry elements. I hope this helps. I have been struggling eith this for awhile and have ended up modifying som eof my Axis code to make it work. I have filed a bug with JIRA (Issue# AXIS-1547) which I think I need to updated. - eric -----Original Message----- From: Ellecer Valencia [mailto:[EMAIL PROTECTED] Sent: Thursday, September 23, 2004 10:32 PM To: [EMAIL PROTECTED] Subject: Re: Axis and .NET interoperability - Arrays I've also noticed this behaviour with array elements being named "item" by default, and .Net clients don't seem to like this. We're currently using Axis 1.2beta2, and generating WSDL automatically, from Axis. Haven't tried beta3 yet, though, so I don't know if this has been fixed. Is there a way to tell Axis in the WSDD what name should be used for the elements of each array, so they don't all get called "item"? (i'll probably be told to create WSDL first... but if so, why then do we have java2wsdl?) ellecer On Wed, 22 Sep 2004 18:53:32 -0700, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > I believe this relates to a problem I am having as well. The array is > not being wrapped with another element in the response. > > In addition there is another problem in that the wsdl that is > generated for the array wrapper schema names the element "item" and if > you have more than > 1 array wrapper in the same schema then you have 2 elements with the > name "item" and .NET apparently doesn't like this. > > If you look at the code you pointed out below it will create a wrapper > element with sub elements all named "item" this matches what happens > during the rpc/encoded processing but I don't believe it is valid for > the wrapped/literal processing. > > marcus > > > > -----Original Message----- > From: Eric Chijioke [mailto:[EMAIL PROTECTED] > Sent: Wednesday, September 22, 2004 11:46 AM > To: [EMAIL PROTECTED] > Subject: RE: Axis and .NET interoperability - Arrays > > My WSDL (and schema) was generated manually. I am including my WSDL > schema definitions below. The problem doesn't seem to be with the > WSDL, because the client (.NET) consuming it produces the correct > 'wrappered' array, which Axis deserializes fine. The problem occurs > when Axis attempts to serialize a response with an array using > document/literal (wrapped). Under these conditions, it doesn't place a wrapper element around the array items. > > I've located the following code in the > org.apache.axis.encoding.ser.ArraySerializer class: > > ------------ begin snippet --------------- > > if (!maxOccursUsage) { > serializeAttr = null; // since we are putting them here > context.startElement(name, attributes); > elementName = Constants.QNAME_LITERAL_ITEM; } > > ------------ end snippet ----------------- > > With the corresponding serialization of a closing wrapper later on: > > ------------ begin snippet --------------- > > if (!maxOccursUsage) > context.endElement(); > > ------------ end snippet ----------------- > > This indicates that Axis only includes the wrapper element when the > array is described using the soapenc:Array (Non WS-I compliant) syntax. > > Commenting out the conditionality for these statements seems to result > in the proper wrapped serialization. > > I am including the relevant schema definitions from my WSDL. > I am also including the parameter elements from the method ( > getFactors() ) which is serializing incorrectly - The > getFactorResponse() element doesn wrapper the individual <factor> > elements in an <wrapper> element. > ------------------ WSDL schema fragments --------------- > > <element name="getFactors"> > <complexType> > <sequence> > <element minOccurs="1" maxOccurs="1" name="ids" > type="intf:stringArray"/> > </sequence> > </complexType> > </element> > > <element name="getFactorsResponse"> > <complexType> > <sequence> > <element minOccurs="1" maxOccurs="1" > name="factors" type="intf:FactorArray"/> > </sequence> > </complexType> > </element> > > <complexType name="stringArray"> > <sequence> > <element name="element" type="xsd:string" minOccurs="0" > maxOccurs="unbounded"/> > </sequence> > </complexType> > > <complexType name="Factor"> > <sequence> > <element name="id" type="xsd:string"/> > <element name="name" type="xsd:string"/> > <element name="correlation" type="xsd:double"/> > <element name="mean" type="xsd:double"/> > <element name="variance" type="xsd:double"/> > <element name="covariance" type="xsd:double"/> > <element name="capital" type="xsd:double"/> > <element name="systematicContribution" > type="xsd:double"/> > <element name="idiosyncraticContribution" > type="xsd:double"/> > <element name="contribution" type="xsd:double"/> > <element name="maximum" type="xsd:double"/> > <element name="reinsurers" type="intf:ReinsurerArray"/> > </sequence> > </complexType> > > <complexType name="FactorArray"> > <sequence> > <element name="factor" type="intf:Factor" minOccurs="0" > maxOccurs="unbounded"/> > </sequence> > </complexType> > > <complexType name="Reinsurer"> > <sequence> > <element name="correlation" type="xsd:double"/> > <element name="probability" type="xsd:double"/> > <element name="amount" type="xsd:double"/> > <element name="contribution" type="xsd:double"/> > </sequence> > </complexType> > > <complexType name="ReinsurerArray"> > <sequence> > <element name="item" type="intf:Reinsurer" minOccurs="0" > maxOccurs="unbounded"/> > </sequence> > </complexType> > > Thanks, > Eric > > -----Original Message----- > From: Anne Thomas Manes [mailto:[EMAIL PROTECTED] > Sent: Wednesday, September 22, 2004 1:06 PM > To: [EMAIL PROTECTED] > Subject: RE: Axis and .NET interoperability - Arrays > > According to the WS-I Basic Profile [1] (see Section 4.3.3) > > Given the XML Schema Description: > > <xsd:element name="MyArray1" type="tns:MyArray1Type"/> > <xsd:complexType name="MyArray1Type"> <xsd:sequence> > <xsd:element name="x" type="xsd:string" > minOccurs="0" maxOccurs="unbounded"/> </xsd:sequence> > </xsd:complexType> > > The envelope would serialize as (omitting namespace declarations for > clarity): > > <MyArray1> > <x>abcd</x> > <x>efgh</x> > </MyArray1> > > Note that this is the proper way to define an array using document literal. > This type of definition should generate a wrapper (<MyArray1>) for the > array elements (<x>). If you have defined your array this way, but it > does not generate the <MyArray1> wrapper element, then there's obviously a bug. > > Nested arrays work pretty much the same way -- there should always be > a wrapper element for the array elements. > > Given the XML Schema Description: > > <xsd:element name="MyArray1" type="tns:MyArray1Type"/> > <xsd:complexType name="MyArray1Type"> <xsd:sequence> > <xsd:element name="MyArray2" type="tns:MyArray2Type" > minOccurs="0" maxOccurs="unbounded"/> </xsd:sequence> > </xsd:complexType> <xsd:complexType name="MyArray2Type"> > <xsd:sequence> > <xsd:element name="x" type="xsd:string" > minOccurs="0" maxOccurs="unbounded"/> </xsd:sequence> > </xsd:complexType> > > The envelope would serialize as (omitting namespace declarations for > clarity): > > <MyArray1> > <MyArray2> > <x>abcd</x> > <x>efgh</x> > </MyArray2> > <MyArray2> > <x>ijkl</x> > <x>mnop</x> > </MyArray2> > </MyArray1> > > I suspect that the interop problems may be caused by the way the > Schema definitions are generated. Can you provide us with the > generated XML Schema definitions of the nested arrays? > > [1] > http://www.ws-i.org/Profiles/BasicProfile-1.1-2004-08-24.html#soapenc_ > Ar > ray > > - Anne > > -----Original Message----- > From: Eric Chijioke [mailto:[EMAIL PROTECTED] > Sent: Wednesday, September 22, 2004 12:00 PM > To: [EMAIL PROTECTED]; [EMAIL PROTECTED] > Subject: RE: Axis and .NET interoperability - Arrays > > I hesitate to file a bug, because I'm still not sure which array > serialization scheme is correct (.NET or Axis). .NET wrappers the > array elements in a container element, whereas Axis places them > directly within the envelope's body root "method" element. > > -----Original Message----- > From: Davanum Srinivas [mailto:[EMAIL PROTECTED] > Sent: Tuesday, September 14, 2004 2:52 PM > To: [EMAIL PROTECTED] > Cc: Thiele, Michael (LDS) > Subject: Re: Axis and .NET interoperability - Arrays > > Guys, > > unless there is a bug report with a reproducible test case....we can't > help you. > > -- dims > > On Tue, 14 Sep 2004 09:54:30 -0400, Eric Chijioke > <[EMAIL PROTECTED]> > wrote: > > Thanks Michael, > > This is very useful. > > > > You found that .NET 1.1 doc/literal doesn't work with Axis 1.2 Beta > > 3 for complex objects, object arrays etc.. > > How did they fail to interop in your tests? > > I found that .NET wrappers arrays of complex objects with a > > container element, whereas Axis simply serializes the array elements > > directly inside the operation node (child node of soap body > > element), could you > > > corroborate this? > > > > Which is correct? (I don't see a directive in the spec anywhere) > > > > Thanks, > > Eric > > > > -----Original Message----- > > From: Thiele, Michael (LDS) [mailto:[EMAIL PROTECTED] > > Sent: Tuesday, September 14, 2004 3:33 AM > > To: [EMAIL PROTECTED] > > Cc: Eric Chijioke > > Subject: AW: Axis and .NET interoperability - Arrays > > > > Eric, > > > > we could not find sufficient information about interoperability in > > detail and checked out those issues with Axis and .NET on our own. > > Here is a list of out _primarily_ results. If we have some more time > > we will publish testcases and bugreports... > > > > HTH. > > > > Please use a monospaced font to view the matrix > > > > Server: > > Apache Axis 1.2 Beta 3 > > > > Clients: > > Microsoft .NET 1.1 RPC/encoded------------| Microsoft .NET 1.1 > > Doc/literal(wrapped)-| | Apache Axis 1.2 Beta 3 Doc/literal----| | | > > Apache Axis 1.2 Beta 3 RPC/encoded--| | | | Apache Axis 1.1 final > > RPC/encoded-| | | | | > > | | | | | > > Datatypes: | | | | | > > Simple Datatypes..................x.x.x.x.x > > String Arrays.....................x.x.x.x.- > > Complex Objects...................x.x.x.-.x > > Object Arrays.....................x.x.x.-.x > > Complex Object w/.................x.x.x.-.x nested Object Arrays.. > > Complex Objects w/................x.x.x.-.x nested Object w/ > > nested Object Arrays > > > > Server: > > Apache Axis 1.1 final > > > > Clients: > > Microsoft .NET 1.1 RPC/encoded------------| Microsoft .NET 1.1 > > Doc/literal(wrapped)-| | Apache Axis 1.2 Beta 3 Doc/literal----| | | > > Apache Axis 1.2 Beta 3 RPC/encoded--| | | | Apache Axis 1.1 final > > RPC/encoded-| | | | | > > | | | | | > > Datatypes: | | | | | > > Simple Datatypes..................x.x.o.o.x > > String Arrays.....................x.x.o.o.x > > Complex Objects...................x.x.o.o.x > > Object Arrays.....................x.x.o.o.x > > Complex Object w/.................x.x.o.o.x nested Object Arrays.. > > Complex Objects w/................x.x.o.o.x nested Object w/ > > nested Object Arrays > > > > ------------------- > > o: not tested > > x: tested, works > > -: tested, does not work > > > > Note 1: Of course, we changed the style (RPC/encoded, Doc/literal) > > on the server side first and generated new stubs for each client. > > Note 2: You have to transfer data to test interoperability. Only > > validataing if stubs can be generated is not sufficient. > > Note 3: There is no difference in interoperability if you are using > > .NET > > 1.1 with or without .NET Service Pack 1 and with or without > > Microsoft WS Enhancements. > > Note 4: There were no differences regarding this issues using > > Doc/literal or Doc/wrapped in Axis 1.2 Beta 3 Note 5: Simple > Datatypes: > > int, Integer, double, Double, String, > > java.util.Calendar(!) etc.; Complex Objects: like Address or so.; > > Object Arrays like Address[]; Complex Object w/ nested Object Arrays > > like Person with nested Address[]; > > > > As a result we cannot recommend using Doc/literal at this time if > > one client is using .NET. > > > > Best regards > > > > Mummert Consulting AG > > > > Michael Thiele > > Senior Consultant > > Integrated Business Consulting > > > > Neue Weyerstr. 6 > > D-50676 Koeln > > > > Tel: +49 221 92404-6130 > > Fax: +49 221 92404-6199 > > Mob: +49 178 6612185 > > Mailto: [EMAIL PROTECTED] http://www.mummert-consulting.de > > > > LDS-NRW > > Mauerstr. 51, Raum 9.27 > > 40476 Duesseldorf > > Mailto:[EMAIL PROTECTED] > > Durchwahl: +49 211 9449-2455 > > > > -----Ursprungliche Nachricht----- > > Von: Eric Chijioke [mailto:[EMAIL PROTECTED] > > Gesendet: Donnerstag, 9. September 2004 18:03 > > An: [EMAIL PROTECTED] > > Betreff: Axis and .NET interoperability - Arrays > > > > I have read a LOT of discussions concerning problems serializing and > > deserializing arrays between an Axis server and a .NET client but > > can't seem to find any definitive discussion/document. Is there one? > > > > Secondly, > > > > [...] > > > > Thanks > > > > Eric Chijioke > > [EMAIL PROTECTED] > > > > > > -- > Davanum Srinivas - http://webservices.apache.org/~dims/ >
