Alright...I have kind of a big quesstion...ok here goes...Usually if i understand it well...web services work in a way that i write a method to get some data from the database and then some other user/client adds a reference and calls my service and gets the data...now in my case i have to get the data and actually post it to the user/client in xml(in soap maybe) i guess....so here is what i do...
[Serializable]
public class MyClass
{ [SoapAttribute]
public int id;
[SoapIgnore]
public int ToSkip;
}
String XmlizedString = null;
MyClass obj= new MyClass ();
MemoryStream memoryStream = new MemoryStream ( );
XmlTypeMapping myMapping =
(new SoapReflectionImporter().ImportTypeMapping
(typeof(MyClass)));
XmlSerializer xs = new XmlSerializer (myMapping);
XmlTextWriter xmlTextWriter = new XmlTextWriter ( memoryStream, Encoding.UTF8 );
xs.Serialize ( xmlTextWriter, obj );
memoryStream = ( MemoryStream ) xmlTextWriter.BaseStream;
XmlizedString = UTF8ByteArrayToString ( memoryStream.ToArray ( ) );
using (System.Net.WebClient client = new System.Net.WebClient())
{
// performs an HTTP POST
status= client.UploadString("http:/somewebservice.com/" + webServiceName, XmlizedString);
}
So basically....I serialize it to xml(and soap) and convert it to string and then upload this string to the web service url...... I just want to know if what i am doing is right?...i want to basically get the data convert it to soap xml and then send it over to the user's web service url....please help me out...