axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Praveen Peddi" <>
Subject Re: array of recursive beans (doc/literal style)
Date Wed, 16 Feb 2005 19:20:59 GMT
I changed the wsdl. ContainerBean is now defined as (my changes are in blue):
<complexType name="ContainerBean">
     <element name="ID" nillable="true" type="xsd:string"/>
     <element name="accessPermissions" type="xsd:int"/>
     <element name="accountID" nillable="true" type="xsd:string"/>
     <element name="childContainers">
        <element maxOccurs="unbounded" name="item" type="tns1:ContainerBean"/>
     <element name="creationDate" nillable="true" type="xsd:dateTime"/>
     <element name="deliveryPermissions" type="xsd:int"/>
     <element name="description" nillable="true" type="xsd:string"/>
     <element name="lastModifiedDate" nillable="true" type="xsd:dateTime"/>
     <element name="name" nillable="true" type="xsd:string"/>
     <element name="parentID" nillable="true" type="xsd:string"/>
     <element name="type" type="xsd:int"/>
     <element name="userID" nillable="true" type="xsd:string"/>

I made my .NET client point to the modified WSDL. I still get the same error. My .NET client
cant serialize the beans after top level.

I didn't change the java code on server side though. All I did was changed WSDL manually and
added this webreference on .NET side.



  ----- Original Message ----- 
  From: Eugene Shershnev 
  Sent: Wednesday, February 16, 2005 1:08 PM
  Subject: Re: array of recursive beans (doc/literal style)

  Try changing your WSDL so there is no additional ArrayOd_tns1_ContainerBean type.
  Basically, the definition of ContainerBean:

      <complexType name="ContainerBean">
        . . .
        <element maxOccurs="unbounded" name="item" type="tns1:ContainerBean"/>

  Not sure if this is valid though, it's just my guess.

    ----- Original Message ----- 
    From: Praveen Peddi 
    Sent: Wednesday, February 16, 2005 12:39p
    Subject: Re: array of recursive beans (doc/literal style)

    Thanks for the response Dino. 
    I am using Axis rc1.2 nightly build from Feb 8th.
    I think you are right regarding desinging the interfaces. Its better to work on WSDL and
schema before working on java code but I have all the java classes built. These are not new
services. I have all these services for long time and everything was working great until I
moved to doc/literal style. I was using rpc/encoded style before.

    I looked at the WSDL generated by Axis and it looked fine to me. May be somone can look
at my WSDL and see where it is wrong. Two elements that need to look at are:
         <complexType name="ArrayOf_tns1_ContainerBean">
      <element maxOccurs="unbounded" minOccurs="0" name="item" type="tns1:ContainerBean"


         <element name="getRootContainersResponse">
      <element maxOccurs="unbounded" name="item" type="tns1:ContainerBean" /> 

    Both have the right definitions for array of beans. Looks like getRootContainerResponse
defines namespace properly but not the ArrayOf_tns1_ContainerBean (look at the soap response

    Also, I am attaching the soap response. It looks like the problem is due to the namespace
of each array element.Namespaces are defined properly for the top level elements array  but
for the recursive elements, namespace is empty.

    Any help is appreciated.


      ----- Original Message ----- 
      From: Dino Chiesa 
      Sent: Wednesday, February 16, 2005 11:59 AM
      Subject: RE: array of recursive beans (doc/literal style)

      Is this a v1.2 RC thing, or are you using AXIS v1.1? 

      And, how are you designing the interface?  
      There is a line of thinking that says, if you want interop, then start by designing
the interface in a platform-independent manner.  In other words, WSDL and W3C XML Schema.
  This applies whether you are using AXIS, .NET, or something else.  Some people call this
"contract first" or "schema-first design". 

      Schema-first design is a hassle you don't need if you are doing like-to-like communications.
 So don't do it.  AXIS-to-AXIS is easy.  .NET-to-.NET is easy.  Just define your Interface
in actual code (write your Java interface), specify some magic in the WSDD, and boom, you
can connect. 
      It's when you want to mix and match clients and servers that this approach falls down.
 Simple cases are ok, but nested arrays and structs don't work.   In other words, starting
with a .net server-side class and expecting the dynamically-generated WSDL to give good interop
with an AXIS client, is wishful thinking.  Likewise for the converse. or any other combination
of unlike webservices stacks. 

      It sounds like you started with a Java class, and you are using Java2WSDL on it.  I
would suggest that you start with the schema and WSDL, then generate the server-side Java
interfaces and support classes with WSDL2Java.  Then provide the server-side implementations.
 You may need adapters between the classes generated from the schema, and the existing application
 on the server side.  

      Likewise, generate the .NET (client-side) proxies from the WSDL.  



      From: Praveen Peddi [] 
      Sent: Tuesday, February 15, 2005 9:52 PM
      Subject: array of recursive beans (doc/literal style)

      I have a method getRootContainers that returns array of ContainerBean[]. Each ContainerBean
has reference to an array of child ContainerBean[]. With Eugene's help I could make the array
stuff work. the method sucessfully returns the array of COntainerBean[] and .NET reads it
fine. But .NET client doesn't read them recursively. It only build the top level array fine
but each ContainerBean has array of other ContainerBean. My service in wsdd looks as follows:

      <service name="CMISOAPContainerService" provider="java:RPC" style="wrapped" use="literal">

      <parameter name="allowedMethods" value="copyContainer createContainer deleteContainer
getContainer getContainerIcon getContainerProperties getRootContainers getContainerObjects
getContentObjectsForContainer getRootContainers moveContainer updateContainer createQueryContainer
updateQueryContainer createTaxonomy"/>

      <parameter name="scope" value="session"/> 

      <parameter name="className" value="com.contextmedia.ip.session.soap.CMISOAPContainerService"/>

      <operation name="getRootContainers" qname="ns:getRootContainers" xmlns:ns=""
    returnQName="ns:item" returnType="ns:ContainerBean[]" >

          <parameter name="depth" qname="ns:depth" type="xsd:int" mode="IN" />


      <typemapping languageSpecificType="java:com.contextmedia.ip.session.soap.ContainerBean[]"
qname="soapenc:Array" deserializer="org.apache.axis.encoding.ser.ArrayDeserializerFactory"
serializer="org.apache.axis.encoding.ser.ArraySerializerFactory" encodingStyle="" xmlns:soapenc=""/>

      <beanMapping qname="bean:ContainerBean" xmlns:bean=""


      I had to add <operation> and <typeMapping> tags after seeing Eugene's sample.
w/o those two tags, even the first level of ContainerBean[] was not working.

      Not sure what else I am missing, How do I make the recursive bean stuff work? Is there
any special configuration in WSDD file to make array of recursive beans work.


      Praveen Peddi
      Sr Software Engg, Context Media, Inc. 
      Tel:  401.854.3475 
      Fax:  401.861.3596 
      Context Media- "The Leader in Enterprise Content Integration" 

View raw message