Re: Big-Picture Question (Web Services, RegNow)
- From: "Jonathan Wood" <jwood@xxxxxxxxxxxxxxxx>
- Date: Sun, 19 Nov 2006 10:31:57 -0700
Laurent,
Show the code. Accepting custom types as parameters should also be
supported.
However, note that there are all kind of clients able to send a request to
a web service. The given client is responsible for serializing (i.e.
transforming into XML) the given parameters, and for deserialiazing (i.e.
transforming from XML) the returned value.
If your client is a .NET application, you don't have to worry too much
about it, because the serialization/deserialization mechanism is
automatically provided (by the web reference, also called web service
proxy).
My code is like what is shown below but while it may be supported by some
clients, Visual Studio won't run it for me. If I change the arguments to be
the members of RegArgs, then VS has no trouble with it. Note that while I
may want to access this service from a .NET application, I certainly want it
available to clients using different platforms as well.
[WebService(Namespace = "https://www.mydomain.com/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
public class ProductRegistration : System.Web.Services.WebService
{
public class RegArgs
{
public string name = "";
public string password = "";
public int productId = 0;
public int cpus = 1;
public string custName = "";
public string custCompany = "";
public string custAddress1 = "";
public string custAddress2 = "";
public string custCountry = "";
public string custPhone = "";
public string custEmail = "";
}
[WebMethod(Description = "Returns registration information for a
product.")]
public string RegisterProduct(RegArgs args)
{
return "BlahBlahBlah";
}
}
In the case 3, you make sure that the attributes are always initialized.
There is no default constructor. (The examples 1 and 2 also don't have an
explicit default constructor, but the compiler provides one when no
constructor is defined.)
I understood the part about making variables private and exposing them
through properties, and also why that might be beneficial.
I just wasn't used to initializing member variables in place rather than in
the constructor. As you probably know, you cannot initialize a member
variable like that in a C++ class. I wasn't aware you could do it that way
in a C# class. I'm assuming the effect of this is the same as initializing
the variable in a constructor: i.e. the variable is initialized to the
specified value when an instance is created.
Thanks!
--
Jonathan Wood
SoftCircuits Programming
http://www.softcircuits.com
.
- Follow-Ups:
- Re: Big-Picture Question (Web Services, RegNow)
- From: Laurent Bugnion
- Re: Big-Picture Question (Web Services, RegNow)
- References:
- Big-Picture Question (Web Services, RegNow)
- From: Jonathan Wood
- Re: Big-Picture Question (Web Services, RegNow)
- From: Mark Rae
- Re: Big-Picture Question (Web Services, RegNow)
- From: Jonathan Wood
- Re: Big-Picture Question (Web Services, RegNow)
- From: Laurent Bugnion
- Re: Big-Picture Question (Web Services, RegNow)
- From: Jonathan Wood
- Re: Big-Picture Question (Web Services, RegNow)
- From: Laurent Bugnion
- Re: Big-Picture Question (Web Services, RegNow)
- From: Jonathan Wood
- Re: Big-Picture Question (Web Services, RegNow)
- From: Laurent Bugnion
- Big-Picture Question (Web Services, RegNow)
- Prev by Date: Re: Adding reference from one web application to another??
- Next by Date: Embed Resource. I can't figure this out.
- Previous by thread: Re: Big-Picture Question (Web Services, RegNow)
- Next by thread: Re: Big-Picture Question (Web Services, RegNow)
- Index(es):
Relevant Pages
|
Loading