[prev in list] [next in list] [prev in thread] [next in thread] 

List:       xmlrpc-user
Subject:    Re: generate String data type for dateTime.iso8601 rather than a date
From:       zeyad farouk <zeyadfarouk () gmail ! com>
Date:       2013-12-02 15:16:37
Message-ID: CAMRR6=Ag_w5nD59wR3WXW2hqP5RPoYod2Ut=Y5d2DZ=JzaMv8w () mail ! gmail ! com
[Download RAW message or body]

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
>
>

[Attachment #3 (text/html)]

<div dir="ltr"><div>hello <span name="Jochen Wiedmann">Jochen</span></div><div><span \
name="Jochen Wiedmann"> </span><br>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.</div> <div> </div><div>For \
ex. if the server return the following response <br><font color="#000000" face="Times \
New Roman" size="3">

</font></div><p class="MsoNormal" style="margin:0in 0in 0pt"><font size="3"><font \
face="Calibri"><span style="color:rgb(31,73,125)">&lt;&lt;&lt; \
&lt;member&gt;</span></font></font></p><div><font color="#000000" face="Times New \
Roman" size="3">

</font></div><p class="MsoNormal" style="margin:0in 0in 0pt"><font size="3"><font \
face="Calibri"><span \
style="color:rgb(31,73,125)">&lt;name&gt;startDate&lt;/name&gt;</span></font></font></p><div><font \
color="#000000" face="Times New Roman" size="3">

</font></div><p class="MsoNormal" style="margin:0in 0in 0pt"><font size="3"><font \
face="Calibri"><span \
style="color:rgb(31,73,125)">&lt;value&gt;&lt;dateTime.iso8601&gt;<span \
style="background:yellow">99991231T00:00:00+1200</span>&lt;/dateTime.iso8601&gt;&lt;/value&gt;</span></font></font></p>
 <div><font color="#000000" face="Times New Roman" size="3">

</font></div><p class="MsoNormal" style="margin:0in 0in 0pt"><font size="3"><font \
face="Calibri"><span \
style="color:rgb(31,73,125)">&lt;/member&gt;</span></font></font></p><div><font \
color="#000000" face="Times New Roman" size="3">

</font></div><p class="MsoNormal" style="margin:0in 0in 0pt"><font size="3"><font \
face="Calibri"><span \
style="color:rgb(31,73,125)">&lt;member&gt;</span></font></font></p><div></div><font \
color="#000000" face="Times New Roman"><div> <font size="3">

<br>what we got from the xml-rpc would be converted to date type with the default \
country timezone in this case would be

</font><font size="3"><font face="Calibri">(99991230T12:00:00+0300). <span> \
</span></font></font><font size="3">

<font color="#000000"> </font>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 ?<br></font></div> <div><font \
size="3">thanks in advance.</font></div><div><font size="3">zeyad \
<br></font></div></font></div><div class="gmail_extra"><br><br><div \
class="gmail_quote">On Mon, Dec 2, 2013 at 4:59 PM, Jochen Wiedmann <span \
dir="ltr">&lt;<a href="mailto:jochen.wiedmann@gmail.com" \
target="_blank">jochen.wiedmann@gmail.com</a>&gt;</span> wrote:<br> <blockquote \
class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc \
solid;padding-left:1ex"><div dir="ltr"><div><div><div><br><br></div>Quoting one of \
the unit tests, namely \
org.apache.xmlrpc.test.CustomTypesTest.testCustomDateFormat:<br> <br>        final \
DateFormat format = new SimpleDateFormat(&quot;yyyy-MM-dd HH:mm:ss.SSS&quot;);<br>

        XmlRpcClient client = pProvider.getClient();<br>        \
XmlRpcClientConfigImpl config = getConfig(pProvider);<br>        \
client.setConfig(config);<br>        TypeFactory typeFactory = \
getCustomDateTypeFactory(client, format);<br>


        client.setTypeFactory(typeFactory);<br>        Calendar cal1 = \
Calendar.getInstance();<br>        XmlRpcRequest request = new \
XmlRpcClientRequestImpl(config, &quot;DateConverter.tomorrow&quot;, new \
Object[]{cal1.getTime()});<br>


        final String got = XmlRpcTestCase.writeRequest(client, request);<br>        \
final String expect = &quot;&lt;?xml version=\&quot;1.0\&quot; \
encoding=\&quot;US-ASCII\&quot;?&gt;&quot;<br>            + \
&quot;&lt;methodCall&gt;&lt;methodName&gt;DateConverter.tomorrow&lt;/methodName&gt;&quot;<br>



            + &quot;&lt;params&gt;&lt;param&gt;&lt;value&gt;&lt;dateTime.iso8601&gt;&quot; \
+ format.format(cal1.getTime())<br>            + \
&quot;&lt;/dateTime.iso8601&gt;&lt;/value&gt;&lt;/param&gt;&lt;/params&gt;&lt;/methodCall&gt;&quot;;<br>



        assertEquals(expect, got);<br><br></div>As you can see, the magic is done in \
client.setTypeFactory.<span class="HOEnZb"><font \
color="#888888"><br><br><br></font></span></div><span class="HOEnZb"><font \
color="#888888">Jochen</font></span><div> <div class="h5"><br><div><div><div \
class="gmail_extra"><br><br><div class="gmail_quote">On Sun, Dec 1, 2013 at 5:54 PM, \
zeyad farouk <span dir="ltr">&lt;<a href="mailto:zeyadfarouk@gmail.com" \
target="_blank">zeyadfarouk@gmail.com</a>&gt;</span> wrote:<br>


<blockquote class="gmail_quote" style="margin:0px 0px 0px \
0.8ex;padding-left:1ex;border-left-color:rgb(204,204,204);border-left-width:1px;border-left-style:solid"><p \
dir="ltr">Hello Jochen,<br> Thanks so much for the quick response, however i \
couldn&#39;t figure out how that can help to read the dateTime.iso8601 value as a \
string at the client side (actually we don&#39;t have control over the server \
side).<br> 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.</p> <p dir="ltr">Thanks so much in advance<br>
Zeyad<br>
</p>
<div class="gmail_quote">On Dec 1, 2013 6:29 PM, &quot;Jochen Wiedmann&quot; &lt;<a \
href="mailto:jochen.wiedmann@gmail.com" \
target="_blank">jochen.wiedmann@gmail.com</a>&gt; wrote:<br \
type="attribution"><blockquote class="gmail_quote" style="margin:0px 0px 0px \
0.8ex;padding-left:1ex;border-left-color:rgb(204,204,204);border-left-width:1px;border-left-style:solid">




<div dir="ltr"><div>See<br> <a href="http://ws.apache.org/xmlrpc/advanced.html" \
target="_blank">http://ws.apache.org/xmlrpc/advanced.html</a><br></div>section on \
&quot;Custom data types&quot;.<br><br></div><div class="gmail_extra">



<br><br>

<div class="gmail_quote">On Sun, Dec 1, 2013 at 5:08 PM, zeyad farouk <span \
dir="ltr">&lt;<a href="mailto:zeyadfarouk@gmail.com" \
target="_blank">zeyadfarouk@gmail.com</a>&gt;</span> wrote:<br><blockquote \
class="gmail_quote" style="margin:0px 0px 0px \
0.8ex;padding-left:1ex;border-left-color:rgb(204,204,204);border-left-width:1px;border-left-style:solid">






<div dir="ltr"><div>Hello gurus,</div><div>how can we generate a string data type for \
<span>dateTime</span>.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 ?</div>






<div><span style="color:rgb(31,73,125);font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;font-size:11pt"></span> \
</div><div><span style="color:rgb(31,73,125);font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;font-size:11pt">thanks \
for your quick help,</span></div>






<div><span style="color:rgb(31,73,125);font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;font-size:11pt"><span>Zeyad</span> \
</span></div></div> </blockquote></div><br><br clear="all"><span><font \
color="#888888"><br>-- <br>&quot;That&#39;s what prayers are ... it&#39;s frightened \
people trying to make friends with the bully!&quot;<br><br>Terry Pratchett. The Last \
Hero<br>


<br>
</font></span></div>
</blockquote></div>
</blockquote></div><br><br clear="all"><br>-- <br>&quot;That&#39;s what prayers are \
... it&#39;s frightened people trying to make friends with the \
bully!&quot;<br><br>Terry Pratchett. The Last Hero<br><br> \
</div></div></div></div></div></div> </blockquote></div><br></div>



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic