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

<xs:choice> comsume webservice

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

✓ answered by jkmyoung

What the schema is saying is that the information in the DownloadRequestType 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 LastTransactionID 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.

3 3037
jkmyoung
2,057 Expert 2GB
? 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
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 Expert 2GB
What the schema is saying is that the information in the DownloadRequestType 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 LastTransactionID 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
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"...
6
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...
2
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
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"...
0
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...
5
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...
2
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...
2
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...
2
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...
1
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"...
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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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,...

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.