Hm
I don't really know what the
problem is, then.
I started with the WSDL you
sent me, and removed the weird, redundant ArrayOf_tns1_ContainerBean
type, and introduced a new named complexType in its place. Like so:
<element
name="getRootContainersResponse" type="tns1:ArrayOfContainerBean" />
<complexType name="ArrayOfContainerBean">
<sequence>
<element maxOccurs="unbounded" name="item" type="tns1:ContainerBean"/>
</sequence>
</complexType>
and then of course the
ContainerBean itself specified the type of the childContainers
element to be the ArrayOfContainerBean complexType. ya follow me?
Then I did the wsdl2Java
--server-side dance,
not using --noWrapped,
and provided an implementation
of the service that generates random data,
which is important because you
are sending xsd:date and .NET doesn't like nil Dates.
Whoops ! no
ArrayOfContainerBean.java is generated. Using --noWrapped, it is? So
in the end I ran wsdl2Java twice, first with noWrapped, then without,
and got the required classes to be generated.
After taking that brief detour,
I deployed the service to Jetty, using the generated deploy.wsdd.
I also built a simple .NET
client that calls the getRootContainers() method.
I get back an array of
ContainerBeans
and each ContainerBean has a
child array of ContainerBeans.
It works for me. I am using
your wsdl and schema, modified as above.
I can send you any of these
files or a zip of all of them.
I tried it with AXIS v1.1
first, which I have had good success with. It worked.
Then I tried it with AXIS
1.2RC2. I expected this to not work because you all are saying that
arrays are broken in v1.2RC2. It necessitated lots of changes to my
makefile due to changes in the names of generated classes.?? also the
weirdness with failing to generate the ArrayOfContainerBean.
But in the end it worked. In
both cases the client was .NET v1.1.
I double-checked the axis jars
in the jetty webapp, they are from Nov 16 2004, whiich I guess is the
release date of v1.2RC2. so it really is working. I did not apply
Eric's patch. I don't even know what Eric's patch is.
Just for grins I generated a
.NET server-side implementation, too. The same client works with both
the AXIS server and the .NET server. Just change the URL. There's
no difference. Except the .NET version is faster and better looking.
;)
"WSDL first, a good idea. (tm)"
I don't really like the option 1.
And I don't know how to go for option 2 :). I am trying to apply Eric's
patch and see if it fixes my problem (assuming that this patch will be
applied to Axis's cvs :) ).
Praveen
-----
Original Message -----
Sent:
Wednesday, February 16, 2005 5:06 PM
Subject:
RE: array of recursive beans (doc/literal style)
yes, our most recent messages
crossed in the ether.
The main problem seems to be in
the axis response anyway. So I am not sure if changing the WSDL would
fix the problem on .NET side.Axis response has a blank namespace for
the second level elements (see the green text and red text. I think
they both should have similar attributes and namespaces). thats what I
have to fix I think. But how do I fix is the question.
<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<getRootContainersResponse xmlns="http://soap.session.ip.contextmedia.com">
<item xsi:type="ns1:ContainerBean"
xmlns:ns1="http://soap.session.ip.contextmedia.com">
<ID>9C5B3C608B5D151B6F87E368CC8AF182</ID>
<accessPermissions>7</accessPermissions>
<accountID>7F1CB4C5C87072FA8D6C21133A642EAB</accountID>
<childContainers>
<item xmlns="">
<ID>163C42F9BC87CB1CEBC14C0A45820DED</ID>
<accessPermissions>7</accessPermissions>
<accountID>7F1CB4C5C87072FA8D6C21133A642EAB</accountID>
<childContainers xsi:nil="true"/>
<creationDate>2005-02-09T17:21:44.000Z</creationDate>
<deliveryPermissions>0</deliveryPermissions>
<description/>
<lastModifiedDate>2005-02-09T17:21:44.000Z</lastModifiedDate>
<name>test</name>
<parentID>9C5B3C608B5D151B6F87E368CC8AF182</parentID>
<type>4</type>
<userID>8E89C8D2583DCB99812FC94FDE15AFE1</userID>
</item>
</childContainers>
<creationDate>2005-01-27T21:21:33.000Z</creationDate>
<deliveryPermissions>0</deliveryPermissions>
<description/>
<lastModifiedDate>2005-02-08T22:18:03.000Z</lastModifiedDate>
<name>My Content</name>
<parentID xsi:nil="true"/>
<type>1</type>
<userID>8E89C8D2583DCB99812FC94FDE15AFE1</userID>
</item>
<item xsi:type="ns3:ContainerBean" xmlns:ns3="http://soap.session.ip.contextmedia.com">
<ID>829E600249C07064F73569782FF801EC</ID>
<accessPermissions>7</accessPermissions>
<accountID>7F1CB4C5C87072FA8D6C21133A642EAB</accountID>
<childContainers>
<item xmlns="">
<ID>F142D17B950A2A70E0DF6E777B8D39D4</ID>
<accessPermissions>7</accessPermissions>
<accountID>7F1CB4C5C87072FA8D6C21133A642EAB</accountID>
<childContainers/>
<creationDate>2005-01-27T21:24:18.000Z</creationDate>
<deliveryPermissions>0</deliveryPermissions>
<description/>
<lastModifiedDate>2005-01-27T21:24:18.000Z</lastModifiedDate>
<name>2</name>
<parentID>829E600249C07064F73569782FF801EC</parentID>
<type>4</type>
<userID xsi:nil="true"/>
</item>
</childContainers>
<creationDate>2005-01-27T21:21:29.000Z</creationDate>
<deliveryPermissions>0</deliveryPermissions>
<description/>
<lastModifiedDate>2005-01-27T21:38:41.000Z</lastModifiedDate>
<name>Enterprise Library</name>
<parentID xsi:nil="true"/>
<type>1</type>
<userID xsi:nil="true"/>
</item>
</getRootContainersResponse>
</soapenv:Body>
</soapenv:Envelope>
-----
Original Message -----
Sent:
Wednesday, February 16, 2005 2:20 PM
Subject:
Re: array of recursive beans (doc/literal style)
I changed the wsdl.
ContainerBean is now defined as (my changes are in blue):
<complexType name="ContainerBean">
<sequence>
<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">
<complexType>
<sequence>
<element maxOccurs="unbounded" name="item"
type="tns1:ContainerBean"/>
</sequence>
</complexType>
</element>
<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"/>
</sequence>
</complexType>
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.
Thx
Praveen
-----
Original Message -----
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">
<sequence>
. . .
<element maxOccurs="unbounded" name="item"
type="tns1:ContainerBean"/>
</sequence>
</complexType>
Not sure if this is valid though, it's just
my guess.
Eugene
-----
Original Message -----
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">
<sequence>
<element maxOccurs="unbounded"
minOccurs="0" name="item"
type="tns1:ContainerBean" />
</sequence>
</complexType>
AND
<element name="getRootContainersResponse">
<complexType>
<sequence>
<element maxOccurs="unbounded"
name="item" type="tns1:ContainerBean" />
</sequence>
</complexType>
</element>
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 file).
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.
Thanks
Praveen
-----
Original Message -----
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.
-Dino
MS
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="http://soap.session.ip.contextmedia.com"
returnQName="ns:item" returnType="ns:ContainerBean[]" >
<parameter name="depth" qname="ns:depth"
type="xsd:int" mode="IN" />
</operation>
<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="http://schemas.xmlsoap.org/soap/encoding/"/>
<beanMapping qname="bean:ContainerBean"
xmlns:bean="http://soap.session.ip.contextmedia.com"
languageSpecificType="java:com.contextmedia.ip.session.soap.ContainerBean"/>
</service>
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.
Thanks,
Praveen
**************************************************************
Praveen Peddi
Sr Software Engg, Context Media, Inc.
email:[EMAIL PROTECTED]
Tel: 401.854.3475
Fax: 401.861.3596
web: http://www.contextmedia.com
**************************************************************
Context Media- "The Leader in Enterprise Content Integration"