You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Marcin Okraszewski <ok...@o2.pl> on 2003/09/21 20:13:36 UTC

XML Schama message validation.

Hi,
I would like to validate incoming messages against XML Schema 
definition, but unfortunately I don't know to do it.

Could you tell me how to do it?

Thanks in advance.
Marcin Okraszewski



Re: XML Schama message validation.

Posted by Marcin Okraszewski <ok...@o2.pl>.
>2) You can write a message style service with below signature.
>
> public Element [] method(Element [] bodies);
> public SOAPBodyElement [] method (SOAPBodyElement [] bodies);
> public Document method(Document body);
> public void method(SOAPEnvelope req, SOAPEnvelope resp);
>
>And then you can validate it using xerces within the body.

Yes, this is exactly what I need. But how to run xerces validation on a 
DOM document? I see methods for validating document while parsing it, 
but not for validating a previously built DOM document.

Thank you for help.
Marcin

-- 
-------------------------------------------------------------
                       Marcin Okraszewski
okrasz@o2.pl                                       GG: 341942
okrasz@vlo.ids.gda.pl          PGP: www.okrasz.prv.pl/pgp.asc
-------------------------------------------------------------



Re: XML Schama message validation.

Posted by Dimuthu Leelarathne <mu...@vijayaba.cse.mrt.ac.lk>.
----- Original Message -----
From: "Dimuthu Leelarathne" <mu...@vijayaba.cse.mrt.ac.lk>
To: <ax...@ws.apache.org>
Sent: Sunday, September 22, 2002 9:46 AM
Subject: Re: XML Schama message validation.


> Hi Marcin,
>
> I guess you manually want to validate. I point out two ways of doing it.
>
> 1) You can write a handler. Get the SOAPBody from the MessageContext. Then
> you can parse it with xerces.
>
> 2) You can write a message style service with below signature.
>
>  public Element [] method(Element [] bodies);
>  public SOAPBodyElement [] method (SOAPBodyElement [] bodies);
>  public Document method(Document body);
>  public void method(SOAPEnvelope req, SOAPEnvelope resp);
>
> And then you can validate it using xerces within the body.
>
> Regards,
> Dimuthu.
>
>
> ----- Original Message -----
> From: "Marcin Okraszewski" <ok...@o2.pl>
> To: <ax...@ws.apache.org>
> Sent: Monday, September 22, 2003 12:13 AM
> Subject: XML Schama message validation.
>
>
> > Hi,
> > I would like to validate incoming messages against XML Schema
> > definition, but unfortunately I don't know to do it.
> >
> > Could you tell me how to do it?
> >
> > Thanks in advance.
> > Marcin Okraszewski
> >
> >
> >
>
>
>



Re: XML Schama message validation.

Posted by Dimuthu Leelarathne <mu...@vijayaba.cse.mrt.ac.lk>.
Hi Marcin,

I guess you manually want to validate. I point out two ways of doing it.

1) You can write a handler. Get the SOAPBody from the MessageContext. Then
you can parse it with xerces.

2) You can write a message style service with below signature.

 public Element [] method(Element [] bodies);
 public SOAPBodyElement [] method (SOAPBodyElement [] bodies);
 public Document method(Document body);
 public void method(SOAPEnvelope req, SOAPEnvelope resp);

And then you can validate it using xerces within the body.

Regards,
Dimuthu.


----- Original Message -----
From: "Marcin Okraszewski" <ok...@o2.pl>
To: <ax...@ws.apache.org>
Sent: Monday, September 22, 2003 12:13 AM
Subject: XML Schama message validation.


> Hi,
> I would like to validate incoming messages against XML Schema
> definition, but unfortunately I don't know to do it.
>
> Could you tell me how to do it?
>
> Thanks in advance.
> Marcin Okraszewski
>
>
>



Re: XML Schama message validation.

Posted by Tony Opatha <to...@yahoo.com>.
Isn't there an approach to include XSD Schema Validation Interceptor
to support validation of incoming and outgoing SOAP message payload
document instances?
 
Thanks.


Marcin Okraszewski <ok...@o2.pl> wrote:
But in this way I can only parse some input stream. Axis provides 
already built DOM document (not an input stream), so I would have to 
write a message somewhere and than read it again. I suppose that there 
is some better solution!

Marcin


U?ytkownik Stephen Gordon napisa?:
> This isn't really an axis question, but i think that this should get you 
> on the way:
> 
> SAXParserFactory spf = new SAXParserFactory();
> spf.setValidating(true);
> 
> SAXParser saxp = spf.newInstance();
> 
> saxp.parse(WHATEVER);
> 
> For further help read the Xerces API docs: 
> http://xml.apache.org/xerces2-j/api.html
> 
> stephen
> 
> 
> 
> Marcin Okraszewski wrote:
> 
>> Hi,
>> I would like to validate incoming messages against XML Schema 
>> definition, but unfortunately I don't know to do it.
>>
>> Could you tell me how to do it?
>>
>> Thanks in advance.
>> Marcin Okraszewski
>>
>>
>>
> 
> 
> 

-- 
-------------------------------------------------------------
Marcin Okraszewski
okrasz@o2.pl GG: 341942
okrasz@vlo.ids.gda.pl PGP: www.okrasz.prv.pl/pgp.asc
-------------------------------------------------------------



---------------------------------
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software

Re: XML Schama message validation.

Posted by Marcin Okraszewski <ok...@o2.pl>.
But in this way I can only parse some input stream. Axis provides 
already built DOM document (not an input stream), so I would have to 
write a message somewhere and than read it again. I suppose that there 
is some better solution!

Marcin


Użytkownik Stephen Gordon napisał:
> This isn't really an axis question, but i think that this should get you 
> on the way:
> 
> SAXParserFactory spf = new SAXParserFactory();
> spf.setValidating(true);
> 
> SAXParser saxp = spf.newInstance();
> 
> saxp.parse(WHATEVER);
> 
> For further help read the Xerces API docs: 
> http://xml.apache.org/xerces2-j/api.html
> 
> stephen
> 
> 
> 
> Marcin Okraszewski wrote:
> 
>> Hi,
>> I would like to validate incoming messages against XML Schema 
>> definition, but unfortunately I don't know to do it.
>>
>> Could you tell me how to do it?
>>
>> Thanks in advance.
>> Marcin Okraszewski
>>
>>
>>
> 
> 
> 

-- 
-------------------------------------------------------------
                       Marcin Okraszewski
okrasz@o2.pl                                       GG: 341942
okrasz@vlo.ids.gda.pl          PGP: www.okrasz.prv.pl/pgp.asc
-------------------------------------------------------------



Re: XML Schama message validation.

Posted by Stephen Gordon <st...@student.usyd.edu.au>.
This isn't really an axis question, but i think that this should get you 
on the way:

SAXParserFactory spf = new SAXParserFactory();
spf.setValidating(true);

SAXParser saxp = spf.newInstance();

saxp.parse(WHATEVER);

For further help read the Xerces API docs: 
http://xml.apache.org/xerces2-j/api.html

stephen



Marcin Okraszewski wrote:

> Hi,
> I would like to validate incoming messages against XML Schema 
> definition, but unfortunately I don't know to do it.
> 
> Could you tell me how to do it?
> 
> Thanks in advance.
> Marcin Okraszewski
> 
> 
>