M
Marty McDonald
Using Visual Studio.Net...
I have two classes, one derives from the other.
My web service accepts the base class as input, it returns the derived class
as the return value.
When I set a web reference to that web service, the web service proxy is
incorrect! It creates its own version of the base class fine, but when it
creates its own version of the derived class, it shows it as simply deriving
from the base, but its own members are not there.
Here are my classes, then I'll show the web proxy portion...
using System;
///TODO: write comments.
namespace FunHouse.Business
{
/// <summary>
/// This class serves as input parameters for the Fun.
/// </summary>
public class FunParameters
{
private string _transId = "";
private string _refereeYYYYMMDD = "";
private float _arm = 0f;
private float _srmp = 0f;
private string _rahYYYYMMDD = "";
public string TransId
{
get{return _transId;}
set{_transId = value;}
}
public string RefereeYYYYMMDD
{
get{return _refereeYYYYMMDD;}
set{_refereeYYYYMMDD = value;}
}
public System.Single ARM
{
get{return _arm;}
set{_arm = value;}
}
public System.Single SRMP
{
get{return _srmp;}
set{_srmp = value;}
}
public string RahYYYYMMDD
{
get{return _rahYYYYMMDD;}
set{_rahYYYYMMDD = value;}
}
}//end class
/// <summary>
/// Serves as Fun output parameters. Extends FunParameters.
/// </summary>
public class FunParametersOut : FunParameters
{
private string _testingYYYYMMDD = "";
private Int32 _calculationReturnCode = 0;
private string _calculationReturnMessage = "";
public FunParametersOut()
{
_testingYYYYMMDD = "";
_calculationReturnCode = 0;
_calculationReturnMessage = "";
}
public string testingYYYYMMDD
{
get
{
return _testingYYYYMMDD;
}
}
public Int32 CalculationReturnCode
{
get{return _calculationReturnCode;}
}
public string CalculationReturnMessage
{
get{return _calculationReturnMessage;}
}
protected internal void SettestingYYYYMMDD(string realignmentDate)
{
_testingYYYYMMDD = realignmentDate;
}
protected internal void SetCalculationReturnCode(Int32 returnCode)
{
_calculationReturnCode = returnCode;
}
protected internal void SetCalculationReturnMessage(string returnMessage)
{
_calculationReturnMessage = returnMessage;
}
}
}//end namespace
Here is the proxy generated by Visual Studio.Net...
//--------------------------------------------------------------------------
----
// <autogenerated>
// This code was generated by a tool.
// Runtime Version: 1.0.3705.288
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </autogenerated>
//--------------------------------------------------------------------------
----
//
// This source code was auto-generated by Microsoft.VSDesigner, Version
1.0.3705.288.
//
namespace Fun33.localhost {
using System.Diagnostics;
using System.Xml.Serialization;
using System;
using System.Web.Services.Protocols;
using System.ComponentModel;
using System.Web.Services;
/// <remarks/>
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Web.Services.WebServiceBindingAttribute(Name="Service1Soap",
Namespace="http://tempuri.org/")]
public class Service1 :
System.Web.Services.Protocols.SoapHttpClientProtocol {
/// <remarks/>
public Service1() {
this.Url = "http://localhost/websvc1/service1.asmx";
}
/// <remarks/>
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.o
rg/HaveFun", RequestNamespace="http://tempuri.org/",
ResponseNamespace="http://tempuri.org/",
Use=System.Web.Services.Description.SoapBindingUse.Literal,
ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
public FunParametersOut HaveFun(FunParameters input) {
object[] results = this.Invoke("HaveFun", new object[] {
input});
return ((FunParametersOut)(results[0]));
}
/// <remarks/>
public System.IAsyncResult BeginHaveFun(FunParameters input,
System.AsyncCallback callback, object asyncState) {
return this.BeginInvoke("HaveFun", new object[] {
input}, callback, asyncState);
}
/// <remarks/>
public FunParametersOut EndHaveFun(System.IAsyncResult asyncResult)
{
object[] results = this.EndInvoke(asyncResult);
return ((FunParametersOut)(results[0]));
}
}
/// <remarks/>
[System.Xml.Serialization.XmlTypeAttribute(Namespace="http://tempuri.org/")]
[System.Xml.Serialization.XmlIncludeAttribute(typeof(FunParametersOut))]
public class FunParameters {
/// <remarks/>
public string TransId;
/// <remarks/>
public string RefereeYYYYMMDD;
/// <remarks/>
public System.Single ARM;
/// <remarks/>
public System.Single SRMP;
/// <remarks/>
public string RahYYYYMMDD;
}
/// <remarks/>
HERE IS THE ERROR, THE DERIVED CLASS IS INCOMPLETE
[System.Xml.Serialization.XmlTypeAttribute(Namespace="http://tempuri.org/")]
public class FunParametersOut : FunParameters {
}
}
-- Marty
I have two classes, one derives from the other.
My web service accepts the base class as input, it returns the derived class
as the return value.
When I set a web reference to that web service, the web service proxy is
incorrect! It creates its own version of the base class fine, but when it
creates its own version of the derived class, it shows it as simply deriving
from the base, but its own members are not there.
Here are my classes, then I'll show the web proxy portion...
using System;
///TODO: write comments.
namespace FunHouse.Business
{
/// <summary>
/// This class serves as input parameters for the Fun.
/// </summary>
public class FunParameters
{
private string _transId = "";
private string _refereeYYYYMMDD = "";
private float _arm = 0f;
private float _srmp = 0f;
private string _rahYYYYMMDD = "";
public string TransId
{
get{return _transId;}
set{_transId = value;}
}
public string RefereeYYYYMMDD
{
get{return _refereeYYYYMMDD;}
set{_refereeYYYYMMDD = value;}
}
public System.Single ARM
{
get{return _arm;}
set{_arm = value;}
}
public System.Single SRMP
{
get{return _srmp;}
set{_srmp = value;}
}
public string RahYYYYMMDD
{
get{return _rahYYYYMMDD;}
set{_rahYYYYMMDD = value;}
}
}//end class
/// <summary>
/// Serves as Fun output parameters. Extends FunParameters.
/// </summary>
public class FunParametersOut : FunParameters
{
private string _testingYYYYMMDD = "";
private Int32 _calculationReturnCode = 0;
private string _calculationReturnMessage = "";
public FunParametersOut()
{
_testingYYYYMMDD = "";
_calculationReturnCode = 0;
_calculationReturnMessage = "";
}
public string testingYYYYMMDD
{
get
{
return _testingYYYYMMDD;
}
}
public Int32 CalculationReturnCode
{
get{return _calculationReturnCode;}
}
public string CalculationReturnMessage
{
get{return _calculationReturnMessage;}
}
protected internal void SettestingYYYYMMDD(string realignmentDate)
{
_testingYYYYMMDD = realignmentDate;
}
protected internal void SetCalculationReturnCode(Int32 returnCode)
{
_calculationReturnCode = returnCode;
}
protected internal void SetCalculationReturnMessage(string returnMessage)
{
_calculationReturnMessage = returnMessage;
}
}
}//end namespace
Here is the proxy generated by Visual Studio.Net...
//--------------------------------------------------------------------------
----
// <autogenerated>
// This code was generated by a tool.
// Runtime Version: 1.0.3705.288
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </autogenerated>
//--------------------------------------------------------------------------
----
//
// This source code was auto-generated by Microsoft.VSDesigner, Version
1.0.3705.288.
//
namespace Fun33.localhost {
using System.Diagnostics;
using System.Xml.Serialization;
using System;
using System.Web.Services.Protocols;
using System.ComponentModel;
using System.Web.Services;
/// <remarks/>
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Web.Services.WebServiceBindingAttribute(Name="Service1Soap",
Namespace="http://tempuri.org/")]
public class Service1 :
System.Web.Services.Protocols.SoapHttpClientProtocol {
/// <remarks/>
public Service1() {
this.Url = "http://localhost/websvc1/service1.asmx";
}
/// <remarks/>
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.o
rg/HaveFun", RequestNamespace="http://tempuri.org/",
ResponseNamespace="http://tempuri.org/",
Use=System.Web.Services.Description.SoapBindingUse.Literal,
ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
public FunParametersOut HaveFun(FunParameters input) {
object[] results = this.Invoke("HaveFun", new object[] {
input});
return ((FunParametersOut)(results[0]));
}
/// <remarks/>
public System.IAsyncResult BeginHaveFun(FunParameters input,
System.AsyncCallback callback, object asyncState) {
return this.BeginInvoke("HaveFun", new object[] {
input}, callback, asyncState);
}
/// <remarks/>
public FunParametersOut EndHaveFun(System.IAsyncResult asyncResult)
{
object[] results = this.EndInvoke(asyncResult);
return ((FunParametersOut)(results[0]));
}
}
/// <remarks/>
[System.Xml.Serialization.XmlTypeAttribute(Namespace="http://tempuri.org/")]
[System.Xml.Serialization.XmlIncludeAttribute(typeof(FunParametersOut))]
public class FunParameters {
/// <remarks/>
public string TransId;
/// <remarks/>
public string RefereeYYYYMMDD;
/// <remarks/>
public System.Single ARM;
/// <remarks/>
public System.Single SRMP;
/// <remarks/>
public string RahYYYYMMDD;
}
/// <remarks/>
HERE IS THE ERROR, THE DERIVED CLASS IS INCOMPLETE
[System.Xml.Serialization.XmlTypeAttribute(Namespace="http://tempuri.org/")]
public class FunParametersOut : FunParameters {
}
}
-- Marty