473,569 Members | 2,764 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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; }
}

[XmlAccessibilit y(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 2145
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; }
}

[XmlAccessibilit y(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...@discussio ns.microsoft.co mwrote:
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; }
}
[XmlAccessibilit y(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
908
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 file. I want each user to read/write to a file in their user directory. Does anyone know how to do this?
5
4681
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 template. I now wish take a sizeable amount of data and create an xml file based on these classes. My intent is to use xmldocument to build up the xml...
4
2763
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 other words it is a tree, where child nodes can contain links to parent nodes. And there multiple kind of nodes: Here is an example
3
6990
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 XmlSerializer will only serialize the collection items - with the default root as ArrayofMyItems etc. My custom collection class has some additional public...
3
12857
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 accessor on brWAP.clFile because it inherits from ICollectio I must be having a thick day because I dont have a clue what the error message means. (I...
1
7793
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 for the functionality of ISerializable (GetObjectData, and De-Serialization Constructor) so that I have more control over the Xml spit out and can...
4
1908
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"> <site url="/blog/"> <mode value="live">
1
7263
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 statusCode;
0
939
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 generating a temporary DLL with its own XML serializers. Is there some kind of manual registration I have to do in order for the custom serializers...
3
6527
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 : There was an error reflecting the type XXXX Is there any way to serialize this object w/o moving away from Interface based classes. Many Thanks! Eg....
0
7609
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7921
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7666
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7964
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6278
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5504
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5217
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3651
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
1208
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.