hi,
this should be a bug. we have to use the connvertToString method
of the ConverterUtil class. which properly out put the string values.
On 9/27/07, WJ Krpelan <[EMAIL PROTECTED]> wrote:
>
> Hi
> from an XSD point of view, it is possible to
> forbid certain kinds of date-formatting by using
> patterns. of course, those patterns would have to be
> applied to the original xml-content.
ok from this we can only valid this at the parsing time. i.e when getting an
xml.
how about the serilizing? i.e we have to produce the xml from the object. so
there must be a way
to valide using the object.
Amila.
Cheers
> Wolfgang
>
> --- Jozef Krssak <[EMAIL PROTECTED]> wrote:
>
> > Hi
> >
> > We have several wsdl and xsd files from customer and
> > we are using
> > Axis2 v1.3WSDL2Java task to create client part of
> > Java classes to call
> > Web Services.
> >
> > One problematic part of generated code commes from
> > XSD code:
> >
> > <xsd:simpleType name="WSTypeDate">
> > <xsd:restriction base="xsd:date">
> > <xsd:pattern
> > value='[0-9]{4}-[0-9]{2}-[0-9]{2}'/>
> > </xsd:restriction>
> > </xsd:simpleType>
> >
> > <xsd:simpleType name="WSTypeTime8">
> > <xsd:restriction base="xsd:string">
> > <xsd:maxLength value="6"/>
> > <xsd:pattern
> > value='[0-9]{2}:[0-9]{2}:[0-9]{2}'/>
> > </xsd:restriction>
> > </xsd:simpleType>
> >
> > <xsd:simpleType name="WSTypeDateTime">
> > <xsd:restriction base="xsd:dateTime">
> > <xsd:pattern
> >
> value='[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}'/>
> > </xsd:restriction>
> > </xsd:simpleType>
> >
> > <xsd:simpleType name="WSTypeUID38">
> > <xsd:restriction base="xsd:string">
> > <xsd:pattern
> >
> value='\{[0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12}\}'/>
> > </xsd:restriction>
> > </xsd:simpleType>
> >
> >
> >
> > Created classes WSTypeDate, WSTypeTime8,
> > WSTypeDateTime, WSTypeUID38 have
> > setter methods like:
> >
> > public void setWSTypeDate(java.util.Date param)
> > {
> > if
> >
> (java.lang.String.valueOf(param).matches("[0-9]{4}-[0-9]{2}-[0-9]{2}"))
> > {
> > this.localWSTypeDate = param;
> > } else {
> > throw new java.lang.RuntimeException();
> > }
> > }
> >
> > public void setWSTypeTime8(java.lang.String
> > param) {
> > if
> >
> (java.lang.String.valueOf(param).matches("[0-9]{2}:[0-9]{2}:[0-9]{2}"))
> > {
> > this.localWSTypeTime8 = param;
> > } else {
> > throw new java.lang.RuntimeException();
> > }
> > }
> >
> > public void setWSTypeDateTime(java.util.Calendar
> > param) {
> > if (java.lang.String.valueOf(param)
> >
> >
> .matches("[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}"))
> > {
> > this.localWSTypeDateTime = param;
> > } else {
> > throw new java.lang.RuntimeException();
> > }
> > }
> >
> > public void setWSTypeUID38(java.lang.String
> > param) {
> > if (java.lang.String.valueOf(param)
> >
> >
>
> .matches("\\{[0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12}\\}"))
> > {
> > this.localWSTypeUID38 = param;
> > } else {
> > throw new java.lang.RuntimeException();
> > }
> > }
> >
> >
> > When given parameter is String, then the matching of
> > pattern is OK, BUT if
> > it is Date or Calendar then it is problem due to
> > used String.valueOf(param)
> > because Date.toString() and Calendar.toString()
> > alaways use same String
> > pattern which never match given pattern and
> > furthermore in that case there
> > is no sense to check any pattern.
> >
> > My question is: Is it a bug of WSDL2Java task to
> > create this part of code
> > when XSD use restriction base xsd:date or
> > xsd:dateTime or is it a feature? I
> > think it is a bug.
> >
> > Thank you
> > Regards
> >
> > --
> > Jozef Krššák
> >
>
>
>
>
>
> ____________________________________________________________________________________
> Need a vacation? Get great deals
> to amazing places on Yahoo! Travel.
> http://travel.yahoo.com/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
--
Amila Suriarachchi,
WSO2 Inc.