Ask a Question related to ASP.NET Web Services, Design and Development.
-
Chris #1
custom types: classes
Hi,
I'm new to web services and I'm having some trouble figuring out how to
define a custom object that works through the webservice.
For example, I have the following on the server side:
public class Token
{
private string firstID;
private string secondID;
public string getFirstD() { return firstID; }
public string getSecondID() { return secondID; }
public void setFirstID(string id) { firstID= id; }
public void setSecondID(string id) { secondID= id; }
}
[WebMethod]
public bool GetResellerList2(Token token, string languageisocode)
{
return true;
}
When I view the object on the client side, I can't see any of the properties
or methods defined in the Token class. What am I missing?
Thanks,
Chris
Chris Guest
-
casting custom classes
Namespace system.web.ui Public Class ReplacableControlCollection Inherits ControlCollection End Class End Namespace... -
Custom types
Which is the best and convenient way to send/retrun custom types to/from Web Service? Serialization? The web service is not to be public... -
Custom classes with web services
I have a custom class called User with fields like Name, Address, etc. This is compiled into a .dll. I also have a Windows app that will... -
Creating custom classes
Hi all, I have a problem where I am creating objects in a loop. I have the problem that when setting instance properties, the properties of the... -
Custom Classes with loadmovie, help!
Hi everyone, this is my first post here on board so please be kind. I have been studying real hard over the past few months so that I can try to get... -
Nassos #2
Re: custom types: classes
Hi Chris,
if inside the asmx file of the ws do not use the custom class it did not
publish it. to check if it is published go to the web reference of the
project that you reference the ws and press "show all files"
expand the reference of the ws and expand the Reference.map in there it is a
Reference.cs open it, if your custom class is not in there
/// <remarks/>Web Service Class
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("c ode")]
[System.Web.Services.WebServiceBindingAttribute(Nam e="LiveUpdateSoap",
Namespace="http://orama-tech.gr/WebServices/")]
public class LiveUpdate :
System.Web.Services.Protocols.SoapHttpClientProtoc ol {
}
/// <remarks/>
///Custom class
/// <remarks/>
[System.Xml.Serialization.XmlTypeAttribute(Namespac e="http://localhost/WebServices/")]
public class DownloadInfo {
}
as the ws class
then you can do anything with it. You can add in the Reference.cs
programmably.
Hope that Helps.
"Chris" <chris@no-spam.com> wrote in message
news:eNC$EZodFHA.688@TK2MSFTNGP14.phx.gbl...> Hi,
>
> I'm new to web services and I'm having some trouble figuring out how to
> define a custom object that works through the webservice.
>
> For example, I have the following on the server side:
>
> public class Token
> {
>
> private string firstID;
>
> private string secondID;
>
> public string getFirstD() { return firstID; }
>
> public string getSecondID() { return secondID; }
>
> public void setFirstID(string id) { firstID= id; }
>
> public void setSecondID(string id) { secondID= id; }
>
> }
>
> [WebMethod]
>
> public bool GetResellerList2(Token token, string languageisocode)
>
> {
>
> return true;
>
> }
>
>
> When I view the object on the client side, I can't see any of the
> properties
> or methods defined in the Token class. What am I missing?
>
> Thanks,
>
> Chris
>
>
Nassos Guest
-
Nassos #3
Re: custom types: classes
So put in the Reference.cs the following:
/// <remarks/>
[System.Xml.Serialization.XmlTypeAttribute(Namespac e="http://orama-tech.gr/WebServices/")]
public class Token
{
private string firstID;
private string secondID;
public string getFirstD() ;
public string getSecondID() ;
public void setFirstID(string id) ;
public void setSecondID(string id) ;
}
"Chris" <chris@no-spam.com> wrote in message
news:eNC$EZodFHA.688@TK2MSFTNGP14.phx.gbl...> Hi,
>
> I'm new to web services and I'm having some trouble figuring out how to
> define a custom object that works through the webservice.
>
> For example, I have the following on the server side:
>
> public class Token
> {
>
> private string firstID;
>
> private string secondID;
>
> public string getFirstD() { return firstID; }
>
> public string getSecondID() { return secondID; }
>
> public void setFirstID(string id) { firstID= id; }
>
> public void setSecondID(string id) { secondID= id; }
>
> }
>
> [WebMethod]
>
> public bool GetResellerList2(Token token, string languageisocode)
>
> {
>
> return true;
>
> }
>
>
> When I view the object on the client side, I can't see any of the
> properties
> or methods defined in the Token class. What am I missing?
>
> Thanks,
>
> Chris
>
>
Nassos Guest
-
Marvin Smit #4
Re: custom types: classes
Hi,
ehhh... Web Services expose the public properties and WebMethod
annotated functions.
Since you use "Token" as a parameter, and the "Token" class only
contains private properties (don't get serialized) and public methods!
nothing of this class will be available in the WebService call.
if you change you data-class as follows
public class Token
{
private string firstID;
private string lastID;
public string FirstID
{
get
{
return firstID;
}
set
{
firstID = value;
}
}
public string LastID
{
get
{
return lastID;
}
set
{
lastID = value;
}
}
}
and use that in your WebService you'll see the availability of
"FirstID" and "LastID" within the generated proxy of this service on
the client side.
Hope this helps,
Marvin Smit
On Tue, 21 Jun 2005 10:25:48 -0700, "Chris" <chris@no-spam.com> wrote:
>Hi,
>
>I'm new to web services and I'm having some trouble figuring out how to
>define a custom object that works through the webservice.
>
>For example, I have the following on the server side:
>
>public class Token
>{
>
>private string firstID;
>
>private string secondID;
>
>public string getFirstD() { return firstID; }
>
>public string getSecondID() { return secondID; }
>
>public void setFirstID(string id) { firstID= id; }
>
>public void setSecondID(string id) { secondID= id; }
>
>}
>
>[WebMethod]
>
>public bool GetResellerList2(Token token, string languageisocode)
>
>{
>
>return true;
>
>}
>
>
>When I view the object on the client side, I can't see any of the properties
>or methods defined in the Token class. What am I missing?
>
>Thanks,
>
>Chris
>Marvin Smit Guest
-
Chris #5
Re: custom types: classes
Hmm ... what if I wanted the actual method calls rather than property
getters? I'm currently mocking out a temporary .net webservice.
Unfortunately, when it makes it into production, it will be a Java based
webservice where we'll be doing method calls on custom objects provided by
the webservice. I just want to mimic the same functionality here and I
don't think properties are going to work ... is there another solution?
Thanks,
Chris
"Marvin Smit" <marvin.smit@gmail.com> wrote in message
news:do2lb1127tc63hefe3c5t6l9f5tttqmm2h@4ax.com...properties> Hi,
>
> ehhh... Web Services expose the public properties and WebMethod
> annotated functions.
>
> Since you use "Token" as a parameter, and the "Token" class only
> contains private properties (don't get serialized) and public methods!
> nothing of this class will be available in the WebService call.
>
> if you change you data-class as follows
>
> public class Token
> {
> private string firstID;
> private string lastID;
>
> public string FirstID
> {
> get
> {
> return firstID;
> }
>
> set
> {
> firstID = value;
> }
> }
>
> public string LastID
> {
> get
> {
> return lastID;
> }
>
> set
> {
> lastID = value;
> }
> }
>
> }
>
>
> and use that in your WebService you'll see the availability of
> "FirstID" and "LastID" within the generated proxy of this service on
> the client side.
>
>
> Hope this helps,
>
> Marvin Smit
>
>
>
> On Tue, 21 Jun 2005 10:25:48 -0700, "Chris" <chris@no-spam.com> wrote:
>> >Hi,
> >
> >I'm new to web services and I'm having some trouble figuring out how to
> >define a custom object that works through the webservice.
> >
> >For example, I have the following on the server side:
> >
> >public class Token
> >{
> >
> >private string firstID;
> >
> >private string secondID;
> >
> >public string getFirstD() { return firstID; }
> >
> >public string getSecondID() { return secondID; }
> >
> >public void setFirstID(string id) { firstID= id; }
> >
> >public void setSecondID(string id) { secondID= id; }
> >
> >}
> >
> >[WebMethod]
> >
> >public bool GetResellerList2(Token token, string languageisocode)
> >
> >{
> >
> >return true;
> >
> >}
> >
> >
> >When I view the object on the client side, I can't see any of the>> >or methods defined in the Token class. What am I missing?
> >
> >Thanks,
> >
> >Chris
> >
Chris Guest
-
Chris #6
Re: custom types: classes
Hmm ... I see what you mean, but if I add this class to References.cs, it's
added on the client side. Everytime I update the web reference, the changes
that were made would disappear. Is there any way to ensure that the methods
get published on the server side?
Chris
"Nassos" <nasos@orama-tech.gr> wrote in message
news:%23gDZZSydFHA.3836@tk2msftngp13.phx.gbl...[System.Xml.Serialization.XmlTypeAttribute(Namespac e="http://orama-tech.gr/W> So put in the Reference.cs the following:
> /// <remarks/>
>
>
ebServices/")]>
> public class Token
> {
>
> private string firstID;
>
> private string secondID;
>
> public string getFirstD() ;
>
> public string getSecondID() ;
>
> public void setFirstID(string id) ;
> public void setSecondID(string id) ;
> }
>
>
> "Chris" <chris@no-spam.com> wrote in message
> news:eNC$EZodFHA.688@TK2MSFTNGP14.phx.gbl...>> > Hi,
> >
> > I'm new to web services and I'm having some trouble figuring out how to
> > define a custom object that works through the webservice.
> >
> > For example, I have the following on the server side:
> >
> > public class Token
> > {
> >
> > private string firstID;
> >
> > private string secondID;
> >
> > public string getFirstD() { return firstID; }
> >
> > public string getSecondID() { return secondID; }
> >
> > public void setFirstID(string id) { firstID= id; }
> >
> > public void setSecondID(string id) { secondID= id; }
> >
> > }
> >
> > [WebMethod]
> >
> > public bool GetResellerList2(Token token, string languageisocode)
> >
> > {
> >
> > return true;
> >
> > }
> >
> >
> > When I view the object on the client side, I can't see any of the
> > properties
> > or methods defined in the Token class. What am I missing?
> >
> > Thanks,
> >
> > Chris
> >
> >
>
Chris Guest



Reply With Quote

