How to validate a Request before sending it via WCF service agaisnt xml schemas

n00bish

New Member
I have referenced a webservice (java) in my application from https://mailxmltem.uspspostalone.com/Transportation/WebServices/wsdl/Transportation.wsdlin my application there is requirement to first validate the request before calling it.What i tried is first save the request via xmlserlialization and then try to validate the xml file.But resultant xml are note prefixing the schema correctly.Like after using following code\[code\]XmlSerializer ser = new XmlSerializer(objRequest.GetType()); FileStream fs = File.Open( "xmlpath", FileMode.OpenOrCreate, FileAccess.Write, FileShare.ReadWrite); ser.Serialize(fs,objRequest);\[/code\]and after calling my request object to save\[code\]<AllDeliveryApptCloseoutRequest xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" d1p1:SchedulerCRID="435345" d1p1:SchedulerID="5345345" d1p1:CreatorSchedulerCorpID="345345345" d1p1:SchedulerCorpID="345345" xmlns:d1p1="http://idealliance.org/Specs/mailxml12.0a/mailxml_tm"> <d1p1:SubmittingParty d2p1:MailerID6="345345" d2p1:CRID="345345" d2p1:MaildatUserLicense="ABC1" xmlns:d2p1="http://idealliance.org/Specs/mailxml12.0a/mailxml_defs" /></AllDeliveryApptCloseoutRequest>\[/code\]in which my xsd validator failed to recognize even root elementbut if it is \[code\]<d1p1:AllDeliveryApptCloseoutRequest xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" d1p1:SchedulerCRID="435345" d1p1:SchedulerID="5345345" d1p1:CreatorSchedulerCorpID="345345345" d1p1:SchedulerCorpID="345345" xmlns:d1p1="http://idealliance.org/Specs/mailxml12.0a/mailxml_tm"> <d1p1:SubmittingParty d2p1:MailerID6="345345" d2p1:CRID="345345" d2p1:MaildatUserLicense="ABC1" xmlns:d2p1="http://idealliance.org/Specs/mailxml12.0a/mailxml_defs" /> </d1p1:AllDeliveryApptCloseoutRequest>\[/code\]my validator works perfectly.How can i force every element to be prefixed by it's schema name
 
Back
Top