Jody Petroni

Hi All,

I have created a Class base on a schema (using xsd.exe) and I want to get at some of the message fields inside a .net component.

I have a helper class with a method as such

public XLANGMessage getMessageFields(XLANGMessage myXlangMessage)

{

...

MySechemaType typedMessage = (MySechemaType)myXlangMessage[0].RetrieveAs(typeof(MySechemaType));

...

}

I get an error castiing to my typedMessage. Whats going wrong

I have an expresion shape in biztalk where I pass a message (based on the same schema as the typedMessage in my component) to the method.

Thanks

Jody




Re: BizTalk R2 General Problem with RetrieveAs() in .net component using Schema Class

Jon Flanders

Jody - either your message type in the Orchestration needs to be of type MySchemaType (a .NET message type) - or you need to use the XmlSerializer yourself.

pseudo-code:

XmlSerializer xs = new XmlSerializer(typeof(MySchemaType));

MySchemaType st = (MySchemaType)xs.Deserializer(myXlangMessage[0].RetrieveAs(typeof(XmlReader)));






Re: BizTalk R2 General Problem with RetrieveAs() in .net component using Schema Class

Jody Petroni

Thanks Jon,

I ended up going with the above pseudo-code.

Jody