473,408 Members | 2,405 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

Use custom XmlSerializer

Hi!
We're creating flash websites, and we are now switching over to flash
9. We decided now to use webservices for the front end. And we have
already been using webservices for the CMS.

Now my problem is that I'd like to use the same objects in C# for both
CMS and website to send through the webservice via SOAP, with the
little exception, that several attributes should be hidden from the
website that should not be published, like personal details.

To give you an example:

public class User {

private String _userName;
public String userName
{
get { return _userName; }
set { _userName= value; }
}

private String _address;
public String address
{
get { return _address; }
set { _address= value; }
}
}

Having this class 'User', I'd like the CMS to be able to see every
data available about the user, but I'd like for the website only the
userName to be seen NOT the address.

Now my idea is, that ideally I could override the XmlSerializer class,
and ask soap to use my class instead of the standard XmlSerializer
class. My Class could then check whether the user calling the
webservice is logged in and is authorized to see the information. So
ideally I'd only have to mark the attribute as private, like this:

public class User {

private String _userName;
public String userName
{
get { return _userName; }
set { _userName= value; }
}

[XmlAccessibility(private)]
private String _address;
public String address
{
get { return _address; }
set { _address= value; }
}
}
Any idea how that could work? Especially how to make Soap use my
XmlSerializer class?

(I'm using standard WebService in a asmx site)

Thanks!!!
Jun 27 '08 #1
2 2141
I suggest you try Browsable[true/false] attribute on the properties you don't
want to appear in your GUI.

"bu*****@web.de" wrote:
Hi!
We're creating flash websites, and we are now switching over to flash
9. We decided now to use webservices for the front end. And we have
already been using webservices for the CMS.

Now my problem is that I'd like to use the same objects in C# for both
CMS and website to send through the webservice via SOAP, with the
little exception, that several attributes should be hidden from the
website that should not be published, like personal details.

To give you an example:

public class User {

private String _userName;
public String userName
{
get { return _userName; }
set { _userName= value; }
}

private String _address;
public String address
{
get { return _address; }
set { _address= value; }
}
}

Having this class 'User', I'd like the CMS to be able to see every
data available about the user, but I'd like for the website only the
userName to be seen NOT the address.

Now my idea is, that ideally I could override the XmlSerializer class,
and ask soap to use my class instead of the standard XmlSerializer
class. My Class could then check whether the user calling the
webservice is logged in and is authorized to see the information. So
ideally I'd only have to mark the attribute as private, like this:

public class User {

private String _userName;
public String userName
{
get { return _userName; }
set { _userName= value; }
}

[XmlAccessibility(private)]
private String _address;
public String address
{
get { return _address; }
set { _address= value; }
}
}
Any idea how that could work? Especially how to make Soap use my
XmlSerializer class?

(I'm using standard WebService in a asmx site)

Thanks!!!
Jun 27 '08 #2
On May 5, 11:22 pm, HA <H...@discussions.microsoft.comwrote:
I suggest you try Browsable[true/false] attribute on the properties you don't
want to appear in your GUI.

"butc...@web.de" wrote:
Hi!
We're creating flash websites, and we are now switching over to flash
9. We decided now to use webservices for the front end. And we have
already been using webservices for the CMS.
Now my problem is that I'd like to use the same objects in C# for both
CMS and website to send through the webservice via SOAP, with the
little exception, that several attributes should be hidden from the
website that should not be published, like personal details.
To give you an example:
public class User {
private String _userName;
public String userName
{
get { return _userName; }
set { _userName= value; }
}
private String _address;
public String address
{
get { return _address; }
set { _address= value; }
}
}
Having this class 'User', I'd like the CMS to be able to see every
data available about the user, but I'd like for the website only the
userName to be seen NOT the address.
Now my idea is, that ideally I could override the XmlSerializer class,
and ask soap to use my class instead of the standard XmlSerializer
class. My Class could then check whether the user calling the
webservice is logged in and is authorized to see the information. So
ideally I'd only have to mark the attribute as private, like this:
public class User {
private String _userName;
public String userName
{
get { return _userName; }
set { _userName= value; }
}
[XmlAccessibility(private)]
private String _address;
public String address
{
get { return _address; }
set { _address= value; }
}
}
Any idea how that could work? Especially how to make Soap use my
XmlSerializer class?
(I'm using standard WebService in a asmx site)
Thanks!!!
Hi HA!
Sorry, but this is not a solution for the problem I described.

Cheers
Jun 27 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Todd Beaulieu | last post by:
Hello, I'm using the configuration block to store user settings in the app.config file. As this exe will reside on a network drive, I can't have users trying to update the master app.config...
5
by: Ian Williamson | last post by:
Greetings, I have seen this question posted a few times, but the answers have not helped me. I have used the program xsd.exe to generate several c# classes from a client provided xsd...
4
by: Sasha | last post by:
Hi everyone, I would like to hear your opinions about a design solution I am contemplating. The problem I am following: Write an editor for a data structure that is recursive in nature. In...
3
by: Anthony Bouch | last post by:
Hi I've been reading using the XmlSerializer with custom collections. I've discovered that when serializing a custom collection (a class that implements ICollection, IList etc.) the...
3
by: jamie_m_ | last post by:
I have a custom collection ... clFile that INHERITS from NameObjectCollectionBase the problem is, when I try to create an xmlserializer instance i get an error You must implement a default...
1
by: Eric Workman | last post by:
Hi Everyone- I would like to implement the IFormatter class to create a custom formatter that essentially does exactly what the System.Xml.Serialization.XmlSerializer does, but also would allow...
4
by: Nick Gilbert | last post by:
Hi, I would like the ability to store the configuration settings for all versions of my site in a single web.config file by using different sections. Eg: <siteConfig> <machine name="XENON">...
1
by: Knecke | last post by:
Hi all. I have a problem with returning a custom Result object with webservice. The classes i use is described below (some fields and properties is removed) public class Result { int...
0
by: kentcb | last post by:
Hi there, I have generated some custom XML serializers using the sgen.exe tool. However, I can't for the life of me figure out how to get the XmlSerializer to actually use them! It insists on...
3
by: Tantr Mantr | last post by:
Hello , I have a class which I serialize using XMLSerializer. This class has public properties which are based on other interfaces. Because of this I am unable to serialize the object. Error :...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.