axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From WJ Krpelan <krpelan...@yahoo.com>
Subject Re: Problem with pattern restriction in XSD and WDSL2Java generated code
Date Fri, 28 Sep 2007 11:09:55 GMT
Hi,
"so there must be a way
to valide using the object"

Using the original REGEXP: Only AFTER serializing the
object to XML and applying
the REGEXP afterwards. Checking the object would have
to be done on a logical level, the REGEXP could do
anything, e.g. exclude todays date only.
Cheers,
Wolfgang

--- Amila Suriarachchi <amilasuriarachchi@gmail.com>
wrote:

> On 9/28/07, Amila Suriarachchi
> <amilasuriarachchi@gmail.com> wrote:
> >
> > hi,
> >
> > this should be a bug. we have to use the
> connvertToString method
> > of the ConverterUtil class. which properly out put
> the string values.
> 
> 
> please have a look at with a nightly build.
> 
> On 9/27/07, WJ Krpelan <krpelan_wj@yahoo.com> 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 <jozef.krssak@gmail.com> 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:
> axis-dev-unsubscribe@ws.apache.org
> > > For additional commands, e-mail:
> axis-dev-help@ws.apache.org
> > >
> > >
> 
=== message truncated ===



      ____________________________________________________________________________________
Luggage? GPS? Comic books? 
Check out fitting gifts for grads at Yahoo! Search
http://search.yahoo.com/search?fr=oni_on_mail&p=graduation+gifts&cs=bz

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org


Mime
View raw message