473,396 Members | 1,892 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

arrays indices, xml schema, web services, C#

Hi All,
I have an xml schema exposed through a web service and I am testing it with entering different values into 3 array indices. But when I run it it just enters the last array index values 3 times instead. Can anyone tell me how I am supposed to enter all the values at once into each of the different indices? Here is the onButton_Click function I wrote with C#:

localhost.PurchaseOrder oPO;
localhost.PurchaseOrderArticlesArticle oPOAA;

localhost.ApprovePurchaseOrder_Orchestration_1_WS_ PO_Port oWSMethodCall;

oPO = new localhost.PurchaseOrder();
oPOAA = new localhost.PurchaseOrderArticlesArticle();
oPO.Articles = new localhost.PurchaseOrderArticlesArticle[10];
oWSMethodCall = new localhost.ApprovePurchaseOrder_Orchestration_1_WS_ PO_Port();

oPO.PONum = System.Guid.NewGuid().ToString();
oPO.Total = 2.00M;
oPO.ToSupplier = System.Guid.NewGuid().ToString();
oPO.ApprovalState = 0;
oPO.IssuedBy = "yuyyy@yahoo.co.uk";


oPOAA.SupplierArticleGUID = System.Guid.NewGuid().ToString();
oPOAA.SupplierArticlePriceGUID = System.Guid.NewGuid().ToString();
oPOAA.Quantity = 9;
oPO.Articles[0] = oPOAA;

oPOAA.SupplierArticleGUID = System.Guid.NewGuid().ToString();
oPOAA.SupplierArticlePriceGUID = System.Guid.NewGuid().ToString();
oPOAA.Quantity = 2;
oPO.Articles[1] = oPOAA;

oPOAA.SupplierArticleGUID = System.Guid.NewGuid().ToString();
oPOAA.SupplierArticlePriceGUID = System.Guid.NewGuid().ToString();
oPOAA.Quantity = 55;
oPO.Articles[2] = oPOAA;

oWSMethodCall.Operation_1(oPO);

I would appreciate any help!
Thanks
Sep 1 '07 #1
2 2278
jkmyoung
2,057 Expert 2GB
Since you have 3 different localhost.PurchaseOrderArticlesArticle oPOAA;
you either need to declare 3 different variables, or initialize a new one each time you add it. I suggest initializing each one before you use it:
Expand|Select|Wrap|Line Numbers
  1. oPOAA = new localhost.PurchaseOrderArticlesArticle();
  2. oPOAA.SupplierArticleGUID = System.Guid.NewGuid().ToString();
  3. oPOAA.SupplierArticlePriceGUID = System.Guid.NewGuid().ToString();
  4. oPOAA.Quantity = 9;
  5. oPO.Articles[0] = oPOAA;
  6.  
  7. oPOAA = new localhost.PurchaseOrderArticlesArticle();
  8. oPOAA.SupplierArticleGUID = System.Guid.NewGuid().ToString();
  9. oPOAA.SupplierArticlePriceGUID = System.Guid.NewGuid().ToString();
  10. oPOAA.Quantity = 2;
  11. oPO.Articles[1] = oPOAA;
  12.  
  13. oPOAA = new localhost.PurchaseOrderArticlesArticle();
  14. oPOAA.SupplierArticleGUID = System.Guid.NewGuid().ToString();
  15. oPOAA.SupplierArticlePriceGUID = System.Guid.NewGuid().ToString();
  16. oPOAA.Quantity = 55;
  17. oPO.Articles[2] = oPOAA;
Sep 4 '07 #2
Hi,
Well I did what you said and it worked, then I incorporated it with a datagrid and that also worked, but now I was wondering if it is possible the other way around, using this exact example from a web service exposing an xml schema to populate a datagrid?

I appreciate any advice!!
Shaz
Sep 10 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: Cant Think Today | last post by:
I have multi-dimesional arrays that can be specifed by the user, e.g 1,2,3,4,5 1,2,3,4,5,6,7,8,9,10 1,2,3,4,5,6 I think a bit of code that will iterate over these arrays to print out the...
34
by: Christopher Benson-Manica | last post by:
If an array is sparse, say something like var foo=; foo=4; foo='baz'; foo='moo'; is there a way to iterate through the entire array? --
2
by: Ali | last post by:
I am having problem compiling schema contained in WSDL file when analyzing schema types contained in it (for example http://www.ebout.net/net/GoogleSearch.wsdl). Following code demonstrates my...
3
by: parrot toes | last post by:
Summary: I have been trying to make requests of a web service provided by Axis using a dotnet client with code generated by wsdl.exe and have been getting exceptions when trying to process the...
0
by: billmiami2 | last post by:
I'm creating an ASP.NET web service with a number of web methods. The consumers of these web services are developers using Macromedia Flash which comes with its own interface for web services. In...
1
by: amir | last post by:
Hi, When compiling a page in VS2005 this morning I received 101 messages regarding schema problems in my web.config file. When I go to view an aspx page in my IIS, IE just displays a blank...
41
by: Rene Nyffenegger | last post by:
Hello everyone. I am not fluent in JavaScript, so I might overlook the obvious. But in all other programming languages that I know and that have associative arrays, or hashes, the elements in...
0
by: vpal61 | last post by:
Hello, I have an Excel/VBA web service client with SOAP Toolkit, consuming Apache Tomcat webservice, which is working fine. Now I am trying to migrate to .NET, and build client in VS2005 with...
0
by: =?Utf-8?B?TGFzdGJ1aWxkZXJz?= | last post by:
Hi all, I have a weird problem which has been causing me a headache for the last two days. I have to dynamicly generate a schema in memory and load it into a dataset in memory to be returned...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.