BlackBerry Forums Support Community
              

Closed Thread
 
LinkBack Thread Tools
Old 09-02-2008, 10:33 AM   #1 (permalink)
Talking BlackBerry Encyclopedia
 
Join Date: Jan 2008
Location: France
Model: 8310
PIN: N/A
Carrier: Vodafone
Posts: 217
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default Send date with ksoap

Please Login to Remove!

Hi everyone.

I want to know how I can send a date with Ksoap.

I can send primitive types and complex but not yet the date.

I try :

itineraryOption.addProperty("date" , new SoapPrimitive( "http://www.w3.org/2001/XMLSchema","date",datefinal));

and

itineraryOption.addProperty("date" , (Object)date1);

For the first I have a JavaClassCastException. I build this with the same way I build double and this last works perfectly.

And for the second the program tell me that it can serialize the date1

Edit => I try this :

itineraryOption.addProperty("date" , new SoapPrimitive( "http://www.w3.org/2001/XMLSchema","date",date1.toString()));

And then I have :

java.lang.NumberFormatException: Invalid date

Any idea???

Last edited by goulamass : 09-02-2008 at 10:36 AM.
Offline  
Old 09-03-2008, 04:17 AM   #2 (permalink)
Talking BlackBerry Encyclopedia
 
Join Date: Jan 2008
Location: France
Model: 8310
PIN: N/A
Carrier: Vodafone
Posts: 217
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

No one has an idea??

I try a lot of thing but for the moment I'm still unsuccesfull
Offline  
Old 09-03-2008, 04:55 AM   #3 (permalink)
Thumbs Must Hurt
 
Join Date: Apr 2008
Model: 8130
PIN: N/A
Carrier: US Cellular
Posts: 82
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Are you sure the format used by date::toString (yyyy-mm-dd) is what the soap library requires?
Offline  
Old 09-03-2008, 07:45 AM   #4 (permalink)
Talking BlackBerry Encyclopedia
 
Join Date: Jan 2008
Location: France
Model: 8310
PIN: N/A
Carrier: Vodafone
Posts: 217
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

In fact when I create a date I specify for the soapPrimitive the url where the structure is defined, the name of the Object I want and the value I want in String.

I try a lot of different format for the date and I have allways :

java.lang.NumberFormatException: Invalid date
Offline  
Old 09-03-2008, 10:58 AM   #5 (permalink)
Thumbs Must Hurt
 
Join Date: Apr 2008
Model: 8130
PIN: N/A
Carrier: US Cellular
Posts: 82
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

ksoap is opensource. Take a look at the source to see what is throwing that exception and why.
Offline  
Old 09-04-2008, 04:24 AM   #6 (permalink)
Talking BlackBerry Encyclopedia
 
Join Date: Jan 2008
Location: France
Model: 8310
PIN: N/A
Carrier: Vodafone
Posts: 217
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

I think you missunderstanding me.

I have no problem with ksoap and all the other call to web service work very fine.

The web service that I want to connect now is waiting a xsd:dateTime.

So i try to construct it. I show you some try and some result :

<date i:type="d:date">2008-09-03T08:24:45.3600</date>
<faultstring>java.lang.IllegalArgumentException: java.lang.ClassCastException@4760c050</faultstring>


<date i:type="d:date">Wed Sep 03 08:27:48 GMT 2008</date>
<faultstring>java.lang.NumberFormatException: Invalid date</faultstring>

<date i:type="d:date">03/09/08 08:33:20</date>
<faultstring>java.lang.NumberFormatException: Invalid date</faultstring>


<date i:type="d:dateTime">03/09/08 08:37:54</date>
<faultstring>java.lang.NumberFormatException: Invalid date/time</faultstring>

<date i:type="d:dateTime">Wed Sep 03 08:40:44 GMT 2008</date>
<faultstring>java.lang.NumberFormatException: Invalid date</faultstring>


<date i:type="d:dateTime">2008-09-03T17:23:44.3600</date>
<faultstring>java.lang.IllegalArgumentException: java.lang.ClassCastException@77efda1</faultstring>

<date i:type="d:dateTime">2008-09-04T09:53:00;Europe/Brussels</date>
<faultstring>java.lang.NumberFormatException: Unexpected characters</faultstring>

<date i:type="d:dateTime">2008-09-04T10:22:12.Z</date>
<faultstring>java.lang.IllegalArgumentException: java.lang.ClassCastException@7f4e0e39</faultstring>

<date i:type="d:dateTime">2008-09-04T11:01:34</date>
<faultstring>java.lang.IllegalArgumentException: java.lang.ClassCastException@63b90190</faultstring>

<date i:type="d:dateTime">2008-09-04T11:15:34.Europe/Brussels</date>
<faultstring>java.lang.NumberFormatException: Unexpected characters</faultstring>


I know that the web service need something like this :
<date xsi:type="xsd:dateTime">2008-03-14T00:00:00.3600</date>
Offline  
Old 09-05-2008, 10:49 AM   #7 (permalink)
Talking BlackBerry Encyclopedia
 
Join Date: Jan 2008
Location: France
Model: 8310
PIN: N/A
Carrier: Vodafone
Posts: 217
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Allright I have the right format that the web service is waiting for :
<date xsi:type="xsd:dateTime">2008-09-04T16:14:09.522Z</date>

And it's the format I send
<date i:type="d:dateTime">2008-09-05T17:46:10.963Z</date>

Maybe the problem come from that I have i:type="d:dateTime" instead of xsi:type="xsd:dateTime"???

But how can I fix it???
Offline  
Old 09-10-2008, 04:17 AM   #8 (permalink)
Talking BlackBerry Encyclopedia
 
Join Date: Jan 2008
Location: France
Model: 8310
PIN: N/A
Carrier: Vodafone
Posts: 217
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

no one can answer me???
Offline  
Old 09-10-2008, 08:58 AM   #9 (permalink)
Talking BlackBerry Encyclopedia
 
Join Date: Jan 2008
Location: France
Model: 8310
PIN: N/A
Carrier: Vodafone
Posts: 217
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hum I correct some error I made.

Now I have this :

java.lang.NumberFormatException: empty String

But I don't know where it comes from.

Any one can give me a hand and explain me what is really this kind of error.

I check my request and I don't see where it bugs
Offline  
Old 09-11-2008, 09:47 AM   #10 (permalink)
Talking BlackBerry Encyclopedia
 
Join Date: Jan 2008
Location: France
Model: 8310
PIN: N/A
Carrier: Vodafone
Posts: 217
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Allright I find my way.

To resume some options of the request were decleared as Optionnal so I put null for their value and in fact they aren't optionnal ^^

So the subject is close
Offline  
Closed Thread


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

10set CH341A 24 25 Series EEPROM Flash BIOS USB Programmer With Software
$43.87
10set CH341A 24 25 Series EEPROM Flash BIOS USB Programmer With Software picturePack 12 Biotage Flash KP-SIL Cartridges 32-63um FKO-1107-17024
$45.95
Pack 12 Biotage Flash  KP-SIL Cartridges 32-63um FKO-1107-17024  pictureVSpeed VS4800 USB Universal Programmer Bios GAL EPROM FLASH 51 AVR PIC MCU SPI
$68.0
VSpeed VS4800 USB Universal Programmer Bios GAL EPROM FLASH 51 AVR PIC MCU SPI pictureSIEMENS FLASH 256 KBYTE/16 BIT 6ES5 374-1KH21 6ES5374-1KH21 6ES53741KH21
$125.0
SIEMENS FLASH 256 KBYTE/16 BIT 6ES5 374-1KH21 6ES5374-1KH21  6ES53741KH21 pictureVictor flash arrestors
$20.0
Victor flash arrestors picture






Copyright 2004-2016 BlackBerryForums.com.
The names RIM and BlackBerry are registered Trademarks of BlackBerry Inc.