I am trying write a small web app which inserts a purchase order through an xml schema that I have exposed through a web service(using Biztalk 2004). I have that the PO can have many articles but I am not sure how the code should be for inserting each article? Here is the xml schema and below that is the button_click function I have wrote in C#.
[HTML]
<xs:element name="PO">
<xs:complexType>
<xs:sequence>
<xs:element name="ToSupplier" type="xs:string" />
<xs:element minOccurs="1" maxOccurs="unbounded" name="Articles">
<xs:complexType>
<xs:sequence minOccurs="1" maxOccurs="unbounded">
<xs:element name="Article">
<xs:complexType>
<xs:sequence>
<xs:element name="SupplierArticleGUID" type="xs:string" />
<xs:element name="SupplierArticlePriceGUID" type="xs:string" />
<xs:element name="Quantity" type="xs:int" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="IssuedBy" type="xs:string" />
<xs:element name="ApprovalState" type="xs:int" />
</xs:sequence>
<xs:attribute name="OrderDate" type="xs:date" />
<xs:attribute name="Total" type="xs:decimal" />
</xs:complexType>
</xs:element>
[/HTML]
here is the function to insert the PO:
Expand|Select|Wrap|Line Numbers
- private void Button1_Click(object sender, System.EventArgs e)
- {
- localhost.PO oPO;
- localhost.POArticles oPOA;
- localhost.POArticlesArticle oPOAA;
- localhost.PurchaseOrderProcess_Orchestration_1_PurchaseOrderIN_Port oWSMethodCall;
- oPO = new localhost.PO();
- oPOA = new localhost.POArticles();
- oPOAA = new localhost.POArticlesArticle();
- oWSMethodCall = new localhost.PurchaseOrderProcess_Orchestration_1_PurchaseOrderIN_Port();
- oPO.OrderDate = System.DateTime.Now;
- oPO.Total = 11.50m;
- oPO.ToSupplier = System.Guid.NewGuid().ToString();
- oPO.ApprovalState = 1;
- oPO.IssuedBy = "Jane Doe";
- oPOAA.SupplierArticleGUID = System.Guid.NewGuid().ToString();
- oPOAA.SupplierArticlePriceGUID = System.Guid.NewGuid().ToString();
- oPOAA.Quantity = 3;
- oPOA.Article = oPOAA;
- oPO.Articles.Initialize();
- oPO.Articles.SetValue(oPOA,0);
- oWSMethodCall.Operation_1(oPO);
- }
I would appreciate any help!!