Hi Friends,
I have requirement to pass the XlangMessage to the .Net Method and do some complex validations and return the modified Xlang or XmlDoc message back to Biztalk.
I have done following steps
1). I have Schema that has generated instance as shown below
<ns0:Airtime xmlns:ns0="http://PassXLangMesgToClasses.Airtime"> <AirId>AirId_0</AirId> <AirName>AirName_0</AirName> </ns0:Airtime>
2). i have created serialized class using following syntax
XSD C:\Biztalk_Projects\PassXLangMesgToClasses\PassXLangMesgToClasses\Airtime.xsd /c /o:C:\Biztalk_Projects\PassXLangMesgToClasses\PassXLangMesgToClasses
3). Added serialized class to My Class Library Project
4). I have added a class to the class library project and added following 2 methods to the class
public static XmlDocument UpdateMessage(XLANGMessage lMsg) { Airtime objAirtime = (Airtime)lMsg[0].RetrieveAs(typeof(Airtime)); try { //Update Book Object objAirtime.AirId = "U :" + objAirtime.AirId; objAirtime.AirName = "U :" + objAirtime.AirName; } catch (XLANGsException xlngEx) { throw xlngEx; } catch (Exception ex) { throw ex; } //return book object return CreateXML(objAirtime); } public static XmlDocument CreateXML(Airtime airtime) { XmlDocument xmlDoc = new XmlDocument(); XmlSerializer xmlSerializer = new XmlSerializer(airtime.GetType(), ""); using (MemoryStream xmlStream = new MemoryStream()) { xmlSerializer.Serialize(xmlStream, airtime); xmlStream.Position = 0; xmlDoc.Load(xmlStream); return xmlDoc; } }
5). Now i have added Orchestration to the project and it has receive shape and and message assignment shape and send shape.
6). I have also created 2 messages of type msgAirtimeIn, msgAirtimeOut of same type Airtime, a variable of type XmLDoc
now in Assignment shape i have following code that calls the external Library to update the Airtime Object.
Variable_1= UpdateAirtimeProject.UpdateAirMessage.UpdateMessage(msgAirtimeIn); msgAirtimeOut=Variable_1;
Sorry for long story. But my problem is when i return XMlDoc from .NET it is returning with empty xmlns="" tags to each element as shown below. I have tried on internet but there is no much help. Can anyone suggest me why am i getting that and how to get-rid of that.
<?xml version="1.0"?> <Airtime xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://PassXLangMesgToClasses.Airtime"> <AirId xmlns="">U :AirId_0</AirId> <AirName xmlns="">U :AirName_0</AirName> </Airtime>
- Edited by Venu Manchikanti 9 hours 56 minutes ago