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 / November 2004

Tip: Looking for answers? Try searching our database.

Auto generated asmx web service documentation omits base class attributes

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Matt - 03 Nov 2004 01:03 GMT
I am working on a c# web service in VS 2003, .Net Framework version
1.1. My web method takes as input a complex data class derived from
another simple data class. Boiled down it looks like the following
code sample.

namespace MyService {
 public class MyBaseClass {
   public string s1;
   public string s2;
 }
 public class MyDerivedClass : MyBaseClass {
   public string s3;
   public string s4;
 }
 public class Service1 : System.Web.Services.WebService {
   [System.Web.Services.WebMethod]
   public string DoSomething(MyDerivedClass mdc){  
     return mdc.s1 + mdc.s2 + mdc.s3 + mdc.s4;
   }
 }
}

My problem is that when I view the auto generated documentation for
the DoSomething web method at MyService/Service1.asmx?op=DoSomething
it does not render the attributes of the base class, MyBaseClass in
the sample SOAP request. Why aren't <s1> and <s2> represented in the
DoSomething request below?

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
 <soap:Body>
   <DoSomething xmlns="http://tempuri.org/">
     <mdc>
       <s3>string</s3>
       <s4>string</s4>
     </mdc>
   </DoSomething>
 </soap:Body>
</soap:Envelope>

I have spent the day mucking about with DefaultWsdlHelpGenerator.aspx
to see if it might just be a presentation issue but it seems that the
.asmx handler is not providing the details of the base class in the
service description collections that the help generator draws from the
Context object. Anyone have any simular experiences or insights on how
to fix this issue?

For reference the MyService/Service1.asmx?WSDL presentation is below.
It shows MyDerivedClass extending MyBaseClass just as it should.

 <?xml version="1.0" encoding="utf-8" ?>
- <definitions xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:s="http://www.w3.org/2001/XMLSchema"
xmlns:s0="http://tempuri.org/"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/"
xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
targetNamespace="http://tempuri.org/"
xmlns="http://schemas.xmlsoap.org/wsdl/">
- <types>
- <s:schema elementFormDefault="qualified"
targetNamespace="http://tempuri.org/">
- <s:element name="DoSomething">
- <s:complexType>
- <s:sequence>
 <s:element minOccurs="0" maxOccurs="1" name="mdc"
type="s0:MyDerivedClass" />
 </s:sequence>
 </s:complexType>
 </s:element>
- <s:complexType name="MyDerivedClass">
- <s:complexContent mixed="false">
- <s:extension base="s0:MyBaseClass">
- <s:sequence>
 <s:element minOccurs="0" maxOccurs="1" name="s3" type="s:string" />
 <s:element minOccurs="0" maxOccurs="1" name="s4" type="s:string" />
 </s:sequence>
 </s:extension>
 </s:complexContent>
 </s:complexType>
- <s:complexType name="MyBaseClass">
- <s:sequence>
 <s:element minOccurs="0" maxOccurs="1" name="s1" type="s:string" />
 <s:element minOccurs="0" maxOccurs="1" name="s2" type="s:string" />
 </s:sequence>
 </s:complexType>
- <s:element name="DoSomethingResponse">
- <s:complexType>
- <s:sequence>
 <s:element minOccurs="0" maxOccurs="1" name="DoSomethingResult"
type="s:string" />
 </s:sequence>
 </s:complexType>
 </s:element>
 </s:schema>
 </types>
- <message name="DoSomethingSoapIn">
 <part name="parameters" element="s0:DoSomething" />
 </message>
- <message name="DoSomethingSoapOut">
 <part name="parameters" element="s0:DoSomethingResponse" />
 </message>
- <portType name="Service1Soap">
- <operation name="DoSomething">
 <input message="s0:DoSomethingSoapIn" />
 <output message="s0:DoSomethingSoapOut" />
 </operation>
 </portType>
- <binding name="Service1Soap" type="s0:Service1Soap">
 <soap:binding transport="http://schemas.xmlsoap.org/soap/http"
style="document" />
- <operation name="DoSomething">
 <soap:operation soapAction="http://tempuri.org/DoSomething"
style="document" />
- <input>
 <soap:body use="literal" />
 </input>
- <output>
 <soap:body use="literal" />
 </output>
 </operation>
 </binding>
- <service name="Service1">
- <port name="Service1Soap" binding="s0:Service1Soap">
 <soap:address location="http://localhost/MyService/Service1.asmx" />
 </port>
 </service>
 </definitions
Dan Rogers - 11 Nov 2004 23:32 GMT
Hi,

Full reflection across complexTypes is not a feature of the automatic
documentation.  In all cases, you'll only get the first element name for
return types or parameters that derive from complex types.  The automatic
documentation tool only "spells out" native types.

Best regards,

Dan Rogers
Microsoft Corporation
--------------------
>From: m_s_wilburn@hotmail.com (Matt)
>Newsgroups: microsoft.public.dotnet.framework.aspnet.webservices
>Subject: Auto generated asmx web service documentation omits base class
attributes
>Date: 2 Nov 2004 16:03:43 -0800
>Organization: http://groups.google.com
[quoted text clipped - 4 lines]
>Content-Transfer-Encoding: 8bit
>X-Trace: posting.google.com 1099440224 22081 127.0.0.1 (3 Nov 2004
00:03:44 GMT)
>X-Complaints-To: groups-abuse@google.com
>NNTP-Posting-Date: Wed, 3 Nov 2004 00:03:44 +0000 (UTC)
>Path:
cpmsftngxa10.phx.gbl!TK2MSFTFEED02.phx.gbl!tornado.fastwebnet.it!tiscali!new
sfeed1.ip.tiscali.net!news.glorb.com!postnews1.google.com!not-for-mail
>Xref: cpmsftngxa10.phx.gbl
microsoft.public.dotnet.framework.aspnet.webservices:26358
>X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webservices
>
[quoted text clipped - 129 lines]
>  </service>
>  </definitions

Rate this thread:







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.