Question regarding webservices (xsd)

S

steen

Hey,

I've run into a little problem when trying to create a small
webservice.

I want my service to take, as input, an object with a few basic
properties and a List of other objects, but I cant seem to get my xsd
definition right.

In my xsd-file I have the following :

<xsd:complexType name="avlsparti-indberetning-request">
<xsd:sequence>
<xsd:element name="arealAdresse" type="xsd:string"/>
<xsd:element name="udlaegsAar" type="xsd:date"/>
....(u get the idea of "basic" properties)
(*)
</xsd:sequence>
</xsd:complexType>
<xsd:element name="indgaaende" type="indgaaende" />
<xsd:complexType name="indgaaende">
<xsd:sequence>
<xsd:element name="string" type="xsd:string" />
<xsd:element name="date" type="xsd:date" />
</xsd:sequence>
</xsd:complexType>

but I would also like to add a list (1-n) of my "indgaaende" type to
the "avlsparti-indberetning-request" at (*). How would one go about
doing that?

When I run WSDL2Java on my wsdl file, I either get an error, or my
AvlspartiIndberetningRequest object only has a single "private String
string" and "private Date date" at the end. What I would like to see
was a "private List<Indgaaende> indgaaende" type of thing. Is it
possible ?

/Steen
 
R

Rogan Dawes

steen said:
Hey,

I've run into a little problem when trying to create a small
webservice.

I want my service to take, as input, an object with a few basic
properties and a List of other objects, but I cant seem to get my xsd
definition right.

In my xsd-file I have the following :

<xsd:complexType name="avlsparti-indberetning-request">
<xsd:sequence>
<xsd:element name="arealAdresse" type="xsd:string"/>
<xsd:element name="udlaegsAar" type="xsd:date"/>
...(u get the idea of "basic" properties)
(*)
</xsd:sequence>
</xsd:complexType>
<xsd:element name="indgaaende" type="indgaaende" />
<xsd:complexType name="indgaaende">
<xsd:sequence>
<xsd:element name="string" type="xsd:string" />
<xsd:element name="date" type="xsd:date" />
</xsd:sequence>
</xsd:complexType>

but I would also like to add a list (1-n) of my "indgaaende" type to
the "avlsparti-indberetning-request" at (*). How would one go about
doing that?

When I run WSDL2Java on my wsdl file, I either get an error, or my
AvlspartiIndberetningRequest object only has a single "private String
string" and "private Date date" at the end. What I would like to see
was a "private List<Indgaaende> indgaaende" type of thing. Is it
possible ?

/Steen

Maybe try using an array of your object, rather than a List?

Rogan
 
S

steen

I would love to.
List or Array, either will work for me, but how would I write that in
the xsd ?

/Steen
 
S

steen

Oooh, wait...I think I just solved it..:)

First I added

<xsd:complexType name="indgaaendeMaengder">
<xsd:sequence>
<xsd:element name="indgaaende" maxOccurs="unbounded"
type="indgaaendeMaengde" />
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="indgaaendeMaengde">
<xsd:sequence>
<xsd:element name="parti" type="fcs:partirefnum" />
<xsd:element name="maengde" type="xsd:decimal" />
</xsd:sequence>
</xsd:complexType>

Then I just added
<xsd:element name="udlaegspartier" type="fcs:indgaaendeMaengder" />
to my object, and voila..
"private dk.pdir.fcs.ws.globaltypes.IndgaaendeMaengde[]
udlaegspartier;"
which was exactly what I was looking for..:):)

Now I can finish up these xsd's and go on weekend..:)

Have a nice one all....

/Steen
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,901
Latest member
Noble71S45

Latest Threads

Top