473,657 Members | 2,436 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1751
"Vaughn Haybittle" <vh********@mwe b.co.zawrote in
news:ud******** ******@TK2MSFTN GP03.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
2047
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 at the module level for the entire project to access as well as collections defined within different objects. Currently, I'm updating Object 1 manually in all the different collections but there surely must be a better way. Thanks! NJ
2
2888
by: Howard Swope | last post by:
Could someone help explain thread safety issues in the System.Collections classes? The documentation states: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Thread Safety Public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Instance members are not guaranteed to be thread-safe. A SortedList can support multiple readers concurrently,...
1
276
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 at the module level for the entire project to access as well as collections defined within different objects. Currently, I'm updating Object 1 manually in all the different collections but there surely must be a better way. Thanks! NJ
2
250
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 at the module level for the entire project to access as well as collections defined within different objects. Currently, I'm updating Object 1 manually in all the different collections but there surely must be a better way. Thanks! NJ
0
8310
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8826
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8732
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8503
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7330
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5632
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4306
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1955
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1615
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.