473,323 Members | 1,589 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,323 software developers and data experts.

Collections, Multiple classes interacting and Web Services!?

Hi,

I have a few questions relating to web services. First some Background:

I have developed two classes in ASP.Net (VB):
1) The first is a class that contains some fields that represent header
information. This class also contains a strongly typed collection. This is
'Object A'
2) The second class represents the line items for each record. For each
line item I would expect the consumer of the web service to create an object
from this class. Ideally each of these objects will be added to the
collection of the object created ion 1 above. The entire object in 1 above
will then be passed to a web service which will save the header information
and process each item in the collection to a database. This is 'Object B'

My questions are:

A) How do I structre the WebService. I know a I need a webmethod that
takes the 'Object A' above and saves its data to a database. However Unless
I create a webmethod that has the two classes as arguements (i.e. 'Object A'
and 'Object B') My WSDL file does not reflect the two classes which means
that they can not be instabtiated by the consumer of the web service.

B) I have written a test page. In this page I instantiate a new instance
of the item in Object A (via the web reference) above and a new instance of
the 'Object B' above. I then attempt to add 'Object B' to the collection in
the 'Object A'.

I need some aqdvice on how to structure my web class and how to consume the
classes from the test page (aspx) page.

C) Another question I have is that when I try to reference the Collection
via the web service it appears as though it is an array rather than a
collection. why is this?

Fundamentally I am wanting to allow consumers to create an instance of
Object B for every line item in a database table and to add that to a
collection in Object A. Object A also has a few additional header fields
which will then be populated. I then want to pass the populated 'Object A'
to a web service that will write the header informatiuo and each item in the
collection to a database.

At present I can not seem to achieve this as either:
i) My WSDL file does not reflect my classes
ii) I am unable to populate the collection with multiple 'Object B's'
iii) I am not consuming the web service correctly from my test page.
(should I instantiate Object A and Object B in my web page and then add
Object B to Oject A;'s collection in the consuming page or can I do this
behind the scenes via private communication between Object A and Object B?

Any suggestions or help wwould be appreciated.

Warm Regards,

Vaughn
Aug 3 '07 #1
2 1739
"Vaughn Haybittle" <vh********@mweb.co.zawrote in
news:ud**************@TK2MSFTNGP03.phx.gbl:
I need some aqdvice on how to structure my web class and how to
consume the classes from the test page (aspx) page.
Web services can take in an array of simple objects. Perhaps you can
pass in an array of of Object A's. Each object A has a property with
Object B.

Or you can pass in XML - and validate the XML server side to ensure the
proper structure.

Another caveat - Web Services don't support readonly properties.
C) Another question I have is that when I try to reference the
Collection via the web service it appears as though it is an array
rather than a collection. why is this?
Web services don't support collecftions.

If you need rich objects, use Remoting/WCF.
Fundamentally I am wanting to allow consumers to create an instance of
Object B for every line item in a database table and to add that to a
collection in Object A. Object A also has a few additional header
fields which will then be populated. I then want to pass the
populated 'Object A' to a web service that will write the header
informatiuo and each item in the collection to a database.
At present I can not seem to achieve this as either:
i) My WSDL file does not reflect my classes
It won't - because WSDL only supports a subset of data structures.

http://msdn2.microsoft.com/en-us/library/3003scdt.aspx
ii) I am unable to populate the collection with multiple 'Object B's'
Pass in an array?
Aug 4 '07 #2
Spam Catcher wrote:
>C) Another question I have is that when I try to reference the
Collection via the web service it appears as though it is an array
rather than a collection. why is this?

Web services don't support collecftions.
Many, many thanks for this info. I've been blocked by this issue for weeks now. How are you supposed to know it, unless you happen to find this particular page you mentioned? And even that is not explicit about collections. The wsdl.exe tool and Add Web Reference wizard ought to produce a warning whenever it finds an object array!

Gustaf
Aug 8 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: njp | last post by:
BlankHi, How do I create a tightly coupled Object 1 such that when I update it in one collection, it is simultaneously and automatically updated in other collections? The collections are defined...
2
by: Howard Swope | last post by:
Could someone help explain thread safety issues in the System.Collections classes? The documentation states:...
1
by: njp | last post by:
BlankHi, How do I create a tightly coupled Object 1 such that when I update it in one collection, it is simultaneously and automatically updated in other collections? The collections are defined...
2
by: njp | last post by:
BlankHi, How do I create a tightly coupled Object 1 such that when I update it in one collection, it is simultaneously and automatically updated in other collections? The collections are defined...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.