Auto generated asmx web service documentation omits base class attributes

M

Matt

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:eek:peration 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>
 
D

Dan Rogers

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: (e-mail address removed) (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
Lines: 131
Message-ID: <[email protected]>
NNTP-Posting-Host: 24.1.160.14
Content-Type: text/plain; charset=ISO-8859-1
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: (e-mail address removed)
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

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:eek:peration 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>
 

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,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top