471,582 Members | 1,397 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,582 software developers and data experts.

WSDL.exe doesn't generate array of complex objects from WSDL & XSD

I have a schema that defines my messages and objects. I then have a WSDL
that defines the web services. I have my sample XSD, sample WSDL, and the
code generated from WSDL.exe. In the generated code from WSDL.exe, the
"applicationList" object is not a array or "application", which is what it
should be, correct?

Thanks for the help.

<?xml version="1.0" encoding="utf-8" ?>
<xs:schema targetNamespace="http://me.com/xml/xsd/AppSec1.xsd"
elementFormDefault="qualified"
xmlns="http://me.com/xml/xsd/AppSec1.xsd"
xmlns:mstns="http://me.com/xml/xsd/AppSec1.xsd"
xmlns:xs="http://www.w3.org/2001/XMLSchema" version="1">
<xs:complexType name="application">
<xs:sequence>
<xs:element name="appid" type="xs:int" />
<xs:element name="description" type="xs:string" />
<xs:element name="guid" type="xs:string" />
</xs:sequence>
</xs:complexType>
<xs:complexType name="applicationList">
<xs:sequence>
<xs:element name="applications" type="application" />
</xs:sequence>
</xs:complexType>
<xs:element name="getApplicationListRequest">
<xs:complexType>
<xs:sequence />
</xs:complexType>
</xs:element>
<xs:element name="getApplicationListResponse">
<xs:complexType>
<xs:sequence>
<xs:element name="apps" type="applicationList" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>

Here is the WSDL.

<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions
name="AppSec"
targetNamespace="http://www.your-company.com/AppSec.wsdl"
xmlns:as="http://www.vita.virginia.gov/xml/xsd/AppSec1.xsd"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:tns="http://www.your-company.com/AppSec.wsdl"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<wsdl:import
location="C:\VS.Net\AppSecTestAWSCF\AppSec.xsd"
namespace="http://me.com/xml/xsd/AppSec1.xsd"/>
<wsdl:message name="getApplicationListRequest">
<wsdl:part element="as:getApplicationListRequest" name="parameters"/>
</wsdl:message>
<wsdl:message name="getApplicationListResponse">
<wsdl:part element="as:getApplicationListResponse" name="parameters"/>
</wsdl:message>
<wsdl:portType name="AppSecPortType">
<wsdl:operation name="getApplicationList">
<wsdl:input message="tns:getApplicationListRequest"/>
<wsdl:output message="tns:getApplicationListResponse"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="AppSecBinding" type="tns:AppSecPortType">
<soap:binding style="rpc"
transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="getApplicationList">
<soap:operation

soapAction="capeconnect:AppSec:AppSecPortType#getA pplicationList"
style="document"/>
<wsdl:input>
<soap:body parts="parameters" use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body parts="parameters" use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="AppSec">
<wsdl:port binding="tns:AppSecBinding" name="AppSecPort">
<soap:address location="http://localhost/ccx/AppSec"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>

And here is the generated server code from WSDL.EXE.

<System.Xml.Serialization.XmlTypeAttribute([Namespace]:="http://www.vita.virginia.gov/xml/xsd/AppSec1.xsd")> _
Public Class application

Public appid As Integer
Public description As String
Public guid As String

End Class

<System.Xml.Serialization.XmlTypeAttribute([Namespace]:="http://www.vita.virginia.gov/xml/xsd/AppSec1.xsd")> _
Public Class applicationList

Public applications As application
End Class

--
Mike Logan
Nov 23 '05 #1
1 4891
Found the problem.

You must specify the complexType array with the following two properties.

maxOccurs="unbounded" minOccurs="0"

Therefore the modified section in the XSD would be.

<xs:complexType name="applicationList">
<xs:sequence>
<xs:element name="applications" type="application"
maxOccurs="unbounded" minOccurs="0"/>
</xs:sequence>
</xs:complexType>

--
Mike Logan
"Mike Logan" wrote:
I have a schema that defines my messages and objects. I then have a WSDL
that defines the web services. I have my sample XSD, sample WSDL, and the
code generated from WSDL.exe. In the generated code from WSDL.exe, the
"applicationList" object is not a array or "application", which is what it
should be, correct?

Thanks for the help.

<?xml version="1.0" encoding="utf-8" ?>
<xs:schema targetNamespace="http://me.com/xml/xsd/AppSec1.xsd"
elementFormDefault="qualified"
xmlns="http://me.com/xml/xsd/AppSec1.xsd"
xmlns:mstns="http://me.com/xml/xsd/AppSec1.xsd"
xmlns:xs="http://www.w3.org/2001/XMLSchema" version="1">
<xs:complexType name="application">
<xs:sequence>
<xs:element name="appid" type="xs:int" />
<xs:element name="description" type="xs:string" />
<xs:element name="guid" type="xs:string" />
</xs:sequence>
</xs:complexType>
<xs:complexType name="applicationList">
<xs:sequence>
<xs:element name="applications" type="application" />
</xs:sequence>
</xs:complexType>
<xs:element name="getApplicationListRequest">
<xs:complexType>
<xs:sequence />
</xs:complexType>
</xs:element>
<xs:element name="getApplicationListResponse">
<xs:complexType>
<xs:sequence>
<xs:element name="apps" type="applicationList" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>

Here is the WSDL.

<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions
name="AppSec"
targetNamespace="http://www.your-company.com/AppSec.wsdl"
xmlns:as="http://www.vita.virginia.gov/xml/xsd/AppSec1.xsd"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:tns="http://www.your-company.com/AppSec.wsdl"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<wsdl:import
location="C:\VS.Net\AppSecTestAWSCF\AppSec.xsd"
namespace="http://me.com/xml/xsd/AppSec1.xsd"/>
<wsdl:message name="getApplicationListRequest">
<wsdl:part element="as:getApplicationListRequest" name="parameters"/>
</wsdl:message>
<wsdl:message name="getApplicationListResponse">
<wsdl:part element="as:getApplicationListResponse" name="parameters"/>
</wsdl:message>
<wsdl:portType name="AppSecPortType">
<wsdl:operation name="getApplicationList">
<wsdl:input message="tns:getApplicationListRequest"/>
<wsdl:output message="tns:getApplicationListResponse"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="AppSecBinding" type="tns:AppSecPortType">
<soap:binding style="rpc"
transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="getApplicationList">
<soap:operation

soapAction="capeconnect:AppSec:AppSecPortType#getA pplicationList"
style="document"/>
<wsdl:input>
<soap:body parts="parameters" use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body parts="parameters" use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="AppSec">
<wsdl:port binding="tns:AppSecBinding" name="AppSecPort">
<soap:address location="http://localhost/ccx/AppSec"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>

And here is the generated server code from WSDL.EXE.

<System.Xml.Serialization.XmlTypeAttribute([Namespace]:="http://www.vita.virginia.gov/xml/xsd/AppSec1.xsd")> _
Public Class application

Public appid As Integer
Public description As String
Public guid As String

End Class

<System.Xml.Serialization.XmlTypeAttribute([Namespace]:="http://www.vita.virginia.gov/xml/xsd/AppSec1.xsd")> _
Public Class applicationList

Public applications As application
End Class

--
Mike Logan

Nov 23 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

24 posts views Thread by Generic Usenet Account | last post: by
1 post views Thread by Emanuele Parati | last post: by
reply views Thread by saish | last post: by
5 posts views Thread by Mike Logan | last post: by
3 posts views Thread by Arpan | last post: by
7 posts views Thread by tobiah | last post: by
4 posts views Thread by newtonwong | last post: by
reply views Thread by leo001 | last post: by
reply views Thread by lumer26 | last post: by
reply views Thread by Vinnie | last post: by
1 post views Thread by lumer26 | last post: by
reply views Thread by lumer26 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.