ws-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zeyad farouk <zeyadfar...@gmail.com>
Subject Re: generate String data type for dateTime.iso8601 rather than a date
Date Mon, 02 Dec 2013 15:16:37 GMT
hello Jochen

thanks again for your continues help, however the issue is not in the
request that the client is sending to the server, it is in processing the
response we are getting form the server.

For ex. if the server return the following response

<<< <member>

<name>startDate</name>

<value><dateTime.iso8601>99991231T00:00:00+1200</dateTime.iso8601></value>

</member>

<member>

what we got from the xml-rpc would be converted to date type with the
default country timezone in this case would be
(99991230T12:00:00+0300).   Actually
we are interested to have the exact same what the server is sending in the
response, i.e how can we have the above yellow highlighted value out form
the server response ?
thanks in advance.
zeyad


On Mon, Dec 2, 2013 at 4:59 PM, Jochen Wiedmann
<jochen.wiedmann@gmail.com>wrote:

>
>
> Quoting one of the unit tests, namely
> org.apache.xmlrpc.test.CustomTypesTest.testCustomDateFormat:
>
>         final DateFormat format = new SimpleDateFormat("yyyy-MM-dd
> HH:mm:ss.SSS");
>         XmlRpcClient client = pProvider.getClient();
>         XmlRpcClientConfigImpl config = getConfig(pProvider);
>         client.setConfig(config);
>         TypeFactory typeFactory = getCustomDateTypeFactory(client, format);
>         client.setTypeFactory(typeFactory);
>         Calendar cal1 = Calendar.getInstance();
>         XmlRpcRequest request = new XmlRpcClientRequestImpl(config,
> "DateConverter.tomorrow", new Object[]{cal1.getTime()});
>         final String got = XmlRpcTestCase.writeRequest(client, request);
>         final String expect = "<?xml version=\"1.0\"
> encoding=\"US-ASCII\"?>"
>             + "<methodCall><methodName>DateConverter.tomorrow</methodName>"
>             + "<params><param><value><dateTime.iso8601>" +
> format.format(cal1.getTime())
>             + "</dateTime.iso8601></value></param></params></methodCall>";
>         assertEquals(expect, got);
>
> As you can see, the magic is done in client.setTypeFactory.
>
>
> Jochen
>
>
>
> On Sun, Dec 1, 2013 at 5:54 PM, zeyad farouk <zeyadfarouk@gmail.com>wrote:
>
>> Hello Jochen,
>> Thanks so much for the quick response, however i couldn't figure out how
>> that can help to read the dateTime.iso8601 value as a string at the client
>> side (actually we don't have control over the server side).
>> Could you please help with an example on how to override the default
>> package implementation and read the  dateTime.iso8601 as string rather than
>> a date.
>>
>> Thanks so much in advance
>> Zeyad
>>  On Dec 1, 2013 6:29 PM, "Jochen Wiedmann" <jochen.wiedmann@gmail.com>
>> wrote:
>>
>>> See
>>>  http://ws.apache.org/xmlrpc/advanced.html
>>> section on "Custom data types".
>>>
>>>
>>>
>>> On Sun, Dec 1, 2013 at 5:08 PM, zeyad farouk <zeyadfarouk@gmail.com>wrote:
>>>
>>>> Hello gurus,
>>>> how can we generate a string data type for dateTime.iso8601 rather
>>>> than date data type ? or how to enforce the library to return the  exact
>>>> XML tag date value without any timezone change/adaptation to the local
>>>> timezone ?
>>>>
>>>> thanks for your quick help,
>>>> Zeyad
>>>>
>>>
>>>
>>>
>>> --
>>> "That's what prayers are ... it's frightened people trying to make
>>> friends with the bully!"
>>>
>>> Terry Pratchett. The Last Hero
>>>
>>>
>
>
> --
> "That's what prayers are ... it's frightened people trying to make friends
> with the bully!"
>
> Terry Pratchett. The Last Hero
>
>

Mime
View raw message