Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / Web Services / October 2005

Tip: Looking for answers? Try searching our database.

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

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Mike Logan - 25 Oct 2005 17:47 GMT
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#getApplicationList"
               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

Signature

Mike Logan

Mike Logan - 25 Oct 2005 18:27 GMT
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>

Signature

Mike Logan

> 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
[quoted text clipped - 101 lines]
>     Public applications As application
> End Class

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.