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 / February 2006

Tip: Looking for answers? Try searching our database.

specify attribute with element data too

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
arcofdescent@gmail.com - 20 Feb 2006 20:26 GMT
Hi,

I'm been trying like crazy but I'm not able to specify the correct WSDL
type definitions for the following:

i.e. the SOAP request XML is:

<status code="100">All Fine</status>

How do we write the WSDL definition for this XML?

I started by defining the status type.

So,

<xsd:element name="status" type="typens:statusType"/>

Then, i define the statusType to have an attribute

<xsd:complexType name="statusType">
 <xsd:attribute name="code" type="xsd:string"/>
</xsd:complexType>

But I'm stuck at how to specify that the status element also would need
to have a string data.

Thanks,
Rohan
Josh Twist - 21 Feb 2006 08:02 GMT
Hi Rohan,

In c# the type might look like this:

[XmlRoot("status")]
public class Status
{
    [XmlAttribute("code")]
    public int Code;

    [XmlText]
    public string Value;
}

Which wsdl.exe turns into

<s:complexType name="Status">
 <s:simpleContent>
   <s:extension base="s:string">
     <s:attribute name="code" type="s:int" use="required" />
   </s:extension>
 </s:simpleContent>
</s:complexType>

Josh
http://www.thejoyofcode.com/

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



©2009 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.