473,606 Members | 3,100 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

<xs:choice> comsume webservice

3 New Member
I'm using Visual Basic to consume a webservice.
One of the elements that I need to pass is nested in <xs:choice>.
How do I reference it?
Thanks
Mar 17 '10 #1
3 3040
jkmyoung
2,057 Recognized Expert Top Contributor
? Are you reading in a schema?

Could you show how you're consuming the other things in your webservice? (eg, what set of xml classes are you using?)
Mar 17 '10 #2
naomisilv
3 New Member
Here's the VBcode:
Expand|Select|Wrap|Line Numbers
  1. Dim downloadRequestType As New ServiceReference1.DownloadRequestType
  2.  
  3. Dim LNPDownloadRequest As New ServiceReference1.LNPDownloadRequest
  4. Dim DownloadClient As New ServiceReference1.LNPDownloadClient
  5. Dim downloadResponseType As New ServiceReference1.DownloadResponseType
  6.  
  7. Dim obj As New ServiceReference1.ItemsChoiceType
  8. obj = ServiceReference1.ItemsChoiceType.LastTransactionI D
  9.  
  10. downloadRequestType.MaxNumberOfRecords = 10
  11. downloadRequestType.Context = "dummy"
Here's the snippet from the wsdl
Expand|Select|Wrap|Line Numbers
  1.       <xs:complexType name="DownloadRequestType">
  2.         <xs:sequence>
  3.           <xs:element name="Context" type="xs:string" />
  4.           <xs:choice>
  5.             <xs:element name="LastTransactionID" type="xs:unsignedLong" />
  6.             <xs:sequence>
  7.               <xs:element name="StartTime" type="xs:dateTime" />
  8.               <xs:element name="StopTime" type="xs:dateTime" />
  9.             </xs:sequence>
  10.           </xs:choice>
  11.           <xs:element name="MaxNumberOfRecords" type="xs:unsignedInt" />
  12.         </xs:sequence>
Mar 17 '10 #3
jkmyoung
2,057 Recognized Expert Top Contributor
What the schema is saying is that the information in the DownloadRequest Type type of elements can come in like:

Expand|Select|Wrap|Line Numbers
  1. <Context>
  2.   <LastTransactionID>390224</LastTransactionID>
  3. </Context>
  4. <MaxNumberOfRecords>32</MaxNumberOfRecords>
  5. OR 
  6. <Context>
  7.   <StartTime>2002-05-30T09:00:00</StartTime>
  8.   <StopTime>2002-05-30T12:00:00</StopTime>
  9. </Context>
  10. <MaxNumberOfRecords>32</MaxNumberOfRecords>
You need to check if the LastTransaction ID node exists before loading it's value. If it doesn't then try to load StartTime and StopTime values instead. Not sure if this is what you're asking.
Mar 17 '10 #4

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

Similar topics

3
4550
by: Kimmo J?rvikangas | last post by:
Dear XML (Schema) experts, As an example I have the following schema: <?xml version="1.0" encoding="UTF-8"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified"> <xs:element name="ROOT_ELEMENT"> <xs:complexType> <xs:choice>
6
2447
by: Wole Ogunremi | last post by:
I guess this is a well asked question but it is tripping me up! I'm putting a forum together allowing xhtml markup content. I am validating against a schema but getting "Could not find schema information for element <elementName>... I would appreciate if anyone could advice where I am going wrong. TIA Here's my xsd:
2
4035
by: nosferatu_1_1 | last post by:
Hi, I would like to create a schema that validate the following xml: <music> <pop/> <rock/> <pop/> </music>
0
1271
by: Anders Ljusberg | last post by:
Hi! I have a problem.. I'm trying to get the XML from a dataset to conform to an XSD, but it keeps rearranging some elements. Try this schema: &lt;xs:schema id="test" targetNamespace="http://tempuri.org/test.xsd"
0
3022
by: keith bannister via .NET 247 | last post by:
(Type your message here) -------------------------------- From: keith bannister Hi, I'm new to .net (as of last week) but here goes. I want to serialize/deserialize a file the conforms to an XML schema (xsd).
5
7280
by: Keith Bannister | last post by:
I'm new to .net so here goes. I'm tying to deserialize a class that is associated with an XML schema. I created the C# class with xsd.exe as below: xsd.exe /c /n:somenamespace properties.xsd this creates properties.cs
2
3123
by: mavis | last post by:
The usage of <xs:choice maxOccurs="unbounded"> When we want to define a set of elements that could be in any order and with any occurences (0-unbounded), we can use <xs:choice maxOccurs="unbounded"> But I alway think that is not a good schema definition for XML files, and it must influence the writing and reading performance of these set of elements if there are large amounts of sub-elements. We can imagine that the retrieval of any...
2
1664
by: hooomee | last post by:
Given: <xs:choice maxOccurs=5> <xs:element name="Foo" type="bar" /> <xs:element name="Foo1" type="bar" /> <xs:element name="Foo2" type="bar" /> </xs:choice> Is the choice made once and then the choosen element can occur 5 times, or is the choice made once for each occurance?
2
3714
by: Aray | last post by:
I googled for it for few houres, but didn't resolve it, any hints will be thinkfull. I want to use the following XSD file to guarantee <element1is unique, but it doesn't work. The following is my XSD file and XML file: ----------- test.xsd ---------------- <?xml version="1.0" encoding="UTF-8"?>
1
1889
by: s123 | last post by:
Hi, I am using the sequence tag under the choice tag. the code part of this is : <xs:choice> <xs:sequence> <xs:element name="values" type="ValuesType" minOccurs="0" maxOccurs="unbounded"/> <!-- Adding enum type for enum rules --> <xs:element name="enum" type="EnumType" minOccurs="0"/> </xs:sequence> <xs:sequence> <xs:element name="enum"...
0
7978
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
8461
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
6796
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...
1
5987
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5470
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
4010
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2454
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1572
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1313
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.