473,398 Members | 2,120 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,398 software developers and data experts.

XmlSerialization Problem

Dear:

I'm working web application that expect to pass an class object to DLL(Class
Lib) I just Attached the DLL File into Web Solution ( DLL is located in other
machine), inside the class library I'm calling a webservice function with the
parameter object class , but I just knew that the parameter should be
serializable , so I build class with two functions serialize/derserialize .
in the DLL I did serialize and pass string to the webmethod in webservice
and there a deserialize it and do the rest of work .
the problem I have when serialize the object inside the Component (which is
in other solution) the serialized representation differs and return with
errors than I serialized the object in same web application solution, what
could cause that?

My Serialiazation /Derserialization funcitons:

public string SerializeObject(object oClassObject,System.Type oClassType)
{
XmlSerializer oSerializer = new XmlSerializer(oClassType);

System.Text.StringBuilder strBuilder = new System.Text.StringBuilder();
System.IO.TextWriter writer = new System.IO.StringWriter(strBuilder);
oSerializer.Serialize(writer,oClassObject);
return strBuilder.ToString();

}

public object DeSerializeObject(string ObjectString,System.Type oClassType)
{
XmlSerializer oSerializer = new XmlSerializer(oClassType);
System.IO.TextReader reader = new System.IO.StringReader ObjectString);
XmlReader xmlReader = new XmlTextReader(reader);
return oSerializer.Deserialize(xmlReader);
}
inside my webapplication
Note : MessageClass in Class Library DLL ( All DLL and WebService are in
standalone machine) and web application in other machine.)
public void PutMessageInQueue(MessageClass oMessage)
{
mail.PutInQueue(oMessage);

}

inside my class library that calls the webservice method
public void PutInQueue(MessageClass Msg)
{

string strSerializedObject = string.Empty;

EW_message.Utility.ObjectHandler oObjectHandler = new
EW_message.Utility.ObjectHandler();
strSerializedObject =
oObjectHandler.SerializeObject(Msg,typeof(EW_Messa ge.MessageClass));

//here i called the webservice method
localEW_MassagingService.PutInQueue(strSerializedO bject);

}

WebService Method

[WebMethod]
public void PutInQueue(string strMsg)
{
EW_message.Utility.ObjectHandler oObjectHandler =
new EW_message.Utility.ObjectHandler();
MessageClass Msg = (MessageClass)
oObjectHandler.DeSerializeObject(strMsg,typeof(EW_ Message.MessageClass));
Random rd=new Random ();
string filename= QueuePath + User + "-" + rd.Next (1,100) +
System.Guid.NewGuid();
StreamWriter QWrite =new StreamWriter(filename);
QWrite.Write (Msg.Message);
QWrite.Close ();
File.Move (filename,filename+".msg");

}

the exception generated inside the DLL before calling the webmethod.
and as I said I copy the serialize/deserialize inside the web application
and everything worked perfectly but when pass it to the dll exception
occured while serializing object.

any Ideas.
Nov 18 '05 #1
0 1056

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

Similar topics

0
by: Omkar Singh | last post by:
I have a problem while using XmlSerialization. XmlSerializaion creates a lot of 'href' and namespaces while serializing a complex object. Can we control serialization to stop href and namespaces. ...
0
by: Ian | last post by:
I've got this problem with overriding attributes on an inheritance chain where the XmlSerializer is concerned. For example: public class A { private string aWord = String.Empty(); public...
2
by: STom | last post by:
I have just started reading up on XMLSerialization and still do not understand the practical use of this technology. For example, if I have to know the class type on the client and on the web...
0
by: A programmer desperatly needing help! | last post by:
I use the xmlserialization on asp.net pages and on previous machines it never gave a problem. But now i somethings get a: Timed out waiting for a program to execute. The command being executed was...
2
by: Curious | last post by:
Hi, I am trying to send data over the network using XmlSerialization. The code shown below is what I am executing. My problem is that no message is arriving in the Server method, and the...
4
by: pfrisbie | last post by:
I am developing a Web Services interface with C# and our partner is using Java (Axis 1.1). They require me to include xsi:types in the SOAP Messages I send them. For example: <Partner...
0
by: jwtulp | last post by:
Hello, I have a question about XmlSerialization. I have a class with a private field called createDate of the type DateTime. In the constructor of my class I use DateTime. Now to create a...
3
by: LW | last post by:
Hi! I am getting the following error message for my fairly simple web service. I have classes and have two DataSets that reference the same classes. The error is: The XML element named...
1
by: Frank | last post by:
Hi, Let's say I have a file named myFile.xml Within that file I have blocks of data which I'd like to add at different times during the day. e.g. <LogEntry>
0
by: IanWright | last post by:
This is a little bit more of an advanced topic for serialization. For those who don't know what XML serialization is, then this probably isn't for you just yet. For those that do, you may have come...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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...
0
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,...
0
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...

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.