开发者

Issue - referencing and using BizTalk Schema project from a standard .NET WCF project?

开发者 https://www.devze.com 2023-03-31 19:45 出处:网络
I’m new to BizTalk (2010). I have created a very simple BizTalk schema project with a scheam. The root record name of the schema is “Customer” which has couple of child filed elements (Name & A

I’m new to BizTalk (2010). I have created a very simple BizTalk schema project with a scheam. The root record name of the schema is “Customer” which has couple of child filed elements (Name & Age). I have a .NET project where I’m referencing the above BizTalk schema. This is how I initialize the schema object:

TestSchema.Customer request = new TestSchema.Customer();

For reasons, I don’t have visibility to any of the child filed elements available in the schema. For example, I’m expecting request.age & request.Name to work fine. But it’s giving compile time exception.

Here is my schema code:

<?xml version="1.0" encoding="utf-16"?>
<xs:schema xmlns="http://TestSchema.Customer"
 xmlns:b="http://schemas.microsoft.com/BizTalk/2003"   
targetNamespace="http://TestSchema.Customer" 
xmlns:xs="http://www开发者_如何学C.w3.org/2001/XMLSchema">
 <xs:element name="Root">
  <xs:complexType>
   <xs:sequence>
    <xs:element name="Name" type="xs:string" />
   </xs:sequence>
  </xs:complexType>
  </xs:element>
</xs:schema>

Am I doing anything wrong here? Please advice.


Can you provide more info on what you are trying to do?

It is unusual to instantiate schemas from code in a typical BizTalk scenario. Typically, you would use XLangMessage to represent instances of your schemas in BizTalk and manipulate properties here.

The only properties exposed from the XSD instance are XmlContent and RootNodes.


Have a look at the C# class generated as part of your BizTalk Schema project - in the IDE, click the "Show all Files" icon abd you'll see a .cs file for you .xsd.

Examine the class represenation of you schema and you should see exactly how its structured.

Also, your root element is still called "Root" not "Customer" and I'd expect that you'd get to Name by creating request.Customer.Name...

Hope this helps...

0

精彩评论

暂无评论...
验证码 换一张
取 消