I think I’m gonna go with the handler to
intercept the SOAP message. How do I go about creating my own handler and
setting up AXIS to use it.
From:
[EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Tuesday, December 14, 2004
1:15 PM
To: [EMAIL PROTECTED]
Subject: RE: data validation
Custom serializers and custom deserializers are part of Axis. I've done a
little work with them but you should try to learn about them yourself. I'm not
sure if throwing a runtime exception is the best way to handle invalid objects,
in the serializer, but it looks like it should work.
The Axis Live document, from www.sourcebeat.com, has some information on custom
serializers and deserializers, though it doesn't go into much depth. The book
"Building Web Services with Java" also has a section on them. Axis
comes with a number of serializers, which you can look at, if you download the
source code. Also, check the latest user-guide on the Axis site. This didn't
have much on custom serializers but it may have been updated.
If your objects follow JavaBean conventions, you probably want to avoid custom
serializers, since Axis provides a BeanSerializer which does the job. However,
if you don't use a custom serializer, you'd need a handler to intercept the
SOAP message. In this case, you'd have to look through your SOAP message for
null fields, in your handler, and throw an exception if a null field shouldn't
be there. If the class is not too complex, this won't be too hard.
Of course, you can always let the message go through to the Web service and
check for nulls there, throwing an exception if you find any invalid null
values. This would be the easiest option.
Tony
"Jairam,
Roopnaraine" <[EMAIL PROTECTED]> wrote on 14/12/2004
17:10:58:
> Do you know how to use a custom serializer
>
>
> From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]
> Sent: Tuesday, December 14, 2004 10:46 AM
> To: [EMAIL PROTECTED]
> Subject: RE: data validation
>
> If that
doesn't work, there are two other possibilities. Use a
> custom serializer for the type. If there are
invalid properties,
> throw a runtime exception in the serialize()
method. Or write a
> handler that you configure into the request
chain on the client. The
> handler would have to examine the SOAP body, to
determine if any
> elements are empty, and throw an exception if
any are invalid. I've
> never tried to do anything like this, but
either should work.
> Tony
>
> "Jairam, Roopnaraine"
<[EMAIL PROTECTED]> wrote on
> 14/12/2004 15:27:29:
>
> > So after I use Java2WSDL to generate the
wsdl, I can just manually
> > edit the wsdl and change the property to
nillable=”false” and then
> > run wsdl2java to generate the java stub
code and this will require
> > that the element be sent assuming it is
fixed in axis.
> >
> >
> >
> > From: Sheptunov, Bogdan
[mailto:[EMAIL PROTECTED]
> > Sent: Tuesday, December 14, 2004 10:12
AM
> > To: [EMAIL PROTECTED]
> > Subject: RE: data validation
> >
> > It is supposed to be implemented via
nillable="false" in WSDL, but I
> > don't think it is working right in
1.2RC1.
> > -----Original Message-----
> > From: Jairam, Roopnaraine
[mailto:[EMAIL PROTECTED]
> > Sent: Tuesday, December 14, 2004 9:05 AM
> > To: [EMAIL PROTECTED]
> > Subject: RE: data validation
> > Does anyone know how to do this???
> >
> >
> > From: Jairam, Roopnaraine
> > Sent: Thursday, December 09, 2004 10:30
AM
> > To: [EMAIL PROTECTED]
> > Subject: data validation
> >
> > Hi:
> >
> > Is there a way for axis to validate data
before it is sent to the
> > web service. Basically the data the
client sends should not be null.
> > When it comes to my web service all the
required parameters should
> > not be null. E.g. if the client is supposed
to send a struct that
> > identifies a client e.g. first name,
last name, address1, address2,
> > city,state,zip1,zip2. All the members of
the struct can’t be null
> > except for address2 & zip2. Is there
a way to do this?
> >
> > Thanks in advance.
> >
> > Vince.