.NET Web ServicesDiscussions about .NET XML Web Service technologies including ASMX files, WSDL and SOAP.
Welcome to the p2p.wrox.com Forums.
You are currently viewing the .NET Web Services section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
My web service has class clsDemo. The class has method methodTry (public string methodTry).
Create class proxy for this web service. Receive class has not methodTry() method, only has properties public and variables public
WHY???
Help me! Thanks for your help!
Thank you very much
The method mentioned aboved does not belong to the ws but to a class in that ws. It is here
File DataType.asmx.cs
//...
public class DataType : System.Web.Services.WebService
{
//
public class clsName
{
public string m_ID = "";
public string m_Comment = "";
private string m_Hide = "";
public string methodTry() // It has not in proxy class
{
return (m_Hide);
}
}
File proxy class DataType.cs
//...
public class DataType : System.Web.Services.Protocols.SoapHttpClientProtoc ol
{
/// <remarks/>
public DataType()
{
this.Url = "http://localhost/Ws/DataType.asmx";
}
//...
}
/// <remarks/>
[System.Xml.Serialization.XmlTypeAttribute(Namespac e="http://tempuri.org/")]
public class clsName
{
/// <remarks/>
public string m_ID;
The WSDL for a web service is only going to define the data structures and web methods available. The idea of a web service is to have the web service do the work and just return data. It makes little sense to have a web service return you code. That kind of defeats the purpose of the service.
Perhaps what you are intending here is to create a property accessor. Public properties of classes will show up in the web service data structures. Set up your class like this:
public class clsName
{
public string m_ID = "";
public string m_Comment = "";
private string m_Hide = "";
public string methodTry() // It has not in proxy class
{
get
{
return (m_Hide);
}
}
}
And you should end up with something like this in your proxy class:
public class clsName
{
/// <remarks/>
public string m_ID;
/// <remarks/>
public string m_Comment;
/// <remarks/>
public string methodTry;
}
I'm not sure what will actually happen with a readonly property in the proxy class so I might be wrong on this.
Peter
------------------------------------------------------
Work smarter, not harder.
Thank you, Peter!
Because, I read documment to see WS supports a significant number of data types and there is class type. I think it also supports for methods of class. Then it limit, class only use to contain data.