You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by Zhang zhongliang <zz...@163.com> on 2007/08/21 04:52:22 UTC

axis2:how to validate soap message against wsdl?

    Hi,I am the beginner to use this mailing list,so,any mistakes that I made,I hope I can be forgiven.
    I have a problem when I using apache-axis2-1.1.1,the web service my team developed will be accessed by other client,although we provided the wsdl to the client,but errors may also exist with the format of the soap message.
    I choose the wsdl:types elements out and form the xsd schema file(.xsd),and then use it to validate the soap message(Which is an OMElement object).
    Now I want to ask whether there is a flag that I can configure to make axis2 validate the soap message against wsdl for me automatically?
     Thanks so much!

Re: axis2:how to validate soap message against wsdl?

Posted by Amila Suriarachchi <am...@gmail.com>.
On 8/22/07, Boon Ooi <bo...@itree.com.au> wrote:
>
>  Hi Amila,
>
>
>
> I'm having the same challenge faced by Zhang zhongliang, to validate an
> incoming soap message based on given XML schema.
>
>
>
> Instead of ADB, I'm using xmlbeans for data binding. Currently invalid
> SOAP messages such as a message without one or more mandatory data item(s)
> are getting pass the request parsing stage of AXIS2 and propagate right
> through to the back-end.
>
>
>
> A temporary quick fix we have now is to have the backend perform these
> unwarranted message validations which suppose to be handled and detected by
> AXIS2 during request message parsing.
>
>
>
> Could you please advise is there a way such validation can be made to
> perform during the request message parsing stage of AXIS2, if it is
> possible, what is the approach/method to do/implement such validation.
>
>
>
> A Configuration based setting that can trigger such validation would be
> great, however if that is not possible, programmatically handling such
> validation using approach like having a new module/handler would be also
> welcome, if need to be done programmatically, kindly advise what is the best
> method/approach to do that as the current API available from AXIS2 document
> model (AXIOM) do not seem to provide any methods to do that.
>
>
>
> We are using AXIS2 1.3.
>
>
>
> Your prompt reply if possible would be very very much appreciated.
>

One thing you can do is to first ask from the xmlbeans list that whether
they have this validation functionality or not.
I think there may be a switch to on validation.
if so then you can regenrate the xmlbeans code using the scomp utility which
comes with the xmlbean.
then you can replaced the existing (i.e. axis2 generated) xmlbeans code with
the xmlbeans generated code.

Amila.

Thank you very much in advance.
>
> Boon
>
>
>
>
>  ------------------------------
>
> *From:* Amila Suriarachchi [mailto:amilasuriarachchi@gmail.com]
> *Sent:* Tuesday, August 21, 2007 1:04 PM
> *To:* axis-dev@ws.apache.org
> *Subject:* Re: axis2:how to validate soap message against wsdl?
>
>
>
> Is there any reason to deal with the OMElement directly?
>
> if you generate the data bind code for wsdl using ADB then when the
> request parsing time ADB validates the request and give you the object
> structure.
>
> you can use wsdl2java.sh tool to generate ADB code.
>
> Amila.
>
> On 8/21/07, *Zhang zhongliang* <zz...@163.com> wrote:
>
> Hi,I am the beginner to use this mailing list,so,any mistakes that I
> made,I hope I can be forgiven.
> I have a problem when I using apache-axis2-1.1.1,the web service my team
> developed will be accessed by other client,although we provided the wsdl to
> the client,but errors may also exist with the format of the soap message.
> I choose the wsdl:types elements out and form the xsd schema
> file(.xsd),and then use it to validate the soap message(Which is an
> OMElement object).
> Now I want to ask whether there is a flag that I can configure to make
> axis2 validate the soap message against wsdl for me automatically?
> Thanks so much!
>
>  ------------------------------
>
> 全 国 万 名 职 场 女 性,齐 聚 非 常 美 女,惊 艳 2 0 0 7
> <http://event.mail.163.com/chanel/click.htm?from=NO_14&domain=163>
>
>
>
>
> --
> Amila Suriarachchi,
> WSO2 Inc.
>



-- 
Amila Suriarachchi,
WSO2 Inc.

Re:Re: Re: axis2:how to validate soap message against wsdl?

Posted by Zhang zhongliang <zz...@163.com>.
Thanks a lot.
I just do not want to use the wsdl2java tool to generate code for me.For I use axis2 to develop commercial project,so I need to obey some rules,for example,the code conventions that the customer provided.
For example,I have a piece of code from wsdl:types like this:
<xsd:element name="CertSummaryRequest">
	<xsd:complexType>
		<xsd:choice>
			<xsd:element name="Name" type="xsd:string" />
			<xsd:element name="Email" type="xsd:string" />
		</xsd:choice>
	</xsd:complexType>
</xsd:element>
It is a kind of search,by name or email,So I them to a xsd file,named CertSummarySearch.xsd,then I use the xsd to validate soap message's payload part,for example,the following message is valid:
<tns:CertSummaryRequest xmlns:tns="http://example/">
	<tns:Name>keyword</tns:Name>
</tns:CertSummaryRequest>
and if the following message is invalid,because of it contains Name and Email elements at the same time:
<tns:CertSummaryRequest xmlns:tns="http://example/">
	<tns:Name>keyword</tns:Name>
	<tns:Email>keyword</tns:Email>
</tns:CertSummaryRequest>

That works for me,but I need to use the Schema,Validator class and related.
thanks for your help.

在2007-08-21,"Amila Suriarachchi" <am...@gmail.com> 写道:

There is no such a property. becuase to valide an soap message against a the schema it should complie the schema and do it accordling.

But if you have problems in understanding the ADB generated code. I can help you for that. 

Amila.


On 8/21/07, Zhang zhongliang <zz...@163.com> wrote: 
First of all,thanks for your advice.
Do you mean use ADB data binding,but if I use the wsdl2java tool to generate code,it will generate too much code lines,and which are not easy to understand,also the method of naming variables and methods. 
What I need is keeping the program simple,so I wonder whether there is a way to set a property in the configuration file,which will enable the axis2 to validate the soap message(payload part) against wsdl for me.For example,if I put the following part:<parameter name="useOriginalwsdl" locked="false">true</parameter> in the services.xml in META-INF folder,then when I want to view the wsdl file,then I will view my own wsdl,not the one that axis2 generates automatically.
So,Is there any properties that I can just configure in the configuration file( axis2.xml,services.xml) to get what I wanted?
Thanks a lot.




在2007-08-21,"Amila Suriarachchi" < amilasuriarachchi@gmail.com> 写道: 


Is there any reason to deal with the OMElement directly?

if you generate the data bind code for wsdl using ADB then when the request parsing time ADB validates the request and give you the object structure. 

you can use wsdl2java.sh tool to generate ADB code.

Amila.


On 8/21/07, Zhang zhongliang < zzl_5337@163.com> wrote: 
Hi,I am the beginner to use this mailing list,so,any mistakes that I made,I hope I can be forgiven. 
I have a problem when I using apache-axis2-1.1.1,the web service my team developed will be accessed by other client,although we provided the wsdl to the client,but errors may also exist with the format of the soap message. 
I choose the wsdl:types elements out and form the xsd schema file(.xsd),and then use it to validate the soap message(Which is an OMElement object).
Now I want to ask whether there is a flag that I can configure to make axis2 validate the soap message against wsdl for me automatically? 
Thanks so much!




全 国 万 名 职 场 女 性,齐 聚 非 常 美 女,惊 艳 2 0 0 7 



-- 
Amila Suriarachchi,
WSO2 Inc. 





网 易 Yeah.net 邮 箱 夏 日 大 变 脸,带 你 感 受 新 一 代 邮 箱 的 全 新 魅 力 >> 



-- 
Amila Suriarachchi,
WSO2 Inc.

Re: Re: axis2:how to validate soap message against wsdl?

Posted by Amila Suriarachchi <am...@gmail.com>.
There is no such a property. becuase to valide an soap message against a the
schema it should complie the schema and do it accordling.

But if you have problems in understanding the ADB generated code. I can help
you for that.

Amila.

On 8/21/07, Zhang zhongliang <zz...@163.com> wrote:
>
> First of all,thanks for your advice.
> Do you mean use ADB data binding,but if I use the wsdl2java tool to
> generate code,it will generate too much code lines,and which are not easy to
> understand,also the method of naming variables and methods.
> What I need is keeping the program simple,so I wonder whether there is a
> way to set a property in the configuration file,which will enable the axis2
> to validate the soap message(payload part) against wsdl for me.Forexample,if I put the following part:<parameter name="useOriginalwsdl"
> locked="false">true</parameter> in the services.xml in META-INF
> folder,then when I want to view the wsdl file,then I will view my own
> wsdl,not the one that axis2 generates automatically.
> So,Is there any properties that I can just configure in the configuration
> file(axis2.xml,services.xml) to get what I wanted?
> Thanks a lot.
>
>
>
>
> 在2007-08-21,"Amila Suriarachchi" <am...@gmail.com> 写道:
>
> Is there any reason to deal with the OMElement directly?
>
> if you generate the data bind code for wsdl using ADB then when the
> request parsing time ADB validates the request and give you the object
> structure.
>
> you can use wsdl2java.sh tool to generate ADB code.
>
> Amila.
>
>
> On 8/21/07, Zhang zhongliang <zz...@163.com> wrote:
> Hi,I am the beginner to use this mailing list,so,any mistakes that I
> made,I hope I can be forgiven.
> I have a problem when I using apache-axis2-1.1.1,the web service my team
> developed will be accessed by other client,although we provided the wsdl to
> the client,but errors may also exist with the format of the soap message.
> I choose the wsdl:types elements out and form the xsd schema
> file(.xsd),and then use it to validate the soap message(Which is an
> OMElement object).
> Now I want to ask whether there is a flag that I can configure to make
> axis2 validate the soap message against wsdl for me automatically?
> Thanks so much!
>
>
>
>
> 全 国 万 名 职 场 女 性,齐 聚 非 常 美 女,惊 艳 2 0 0 7
>
>
>
> --
> Amila Suriarachchi,
> WSO2 Inc.
>
>
> ------------------------------
> 网 易 Yeah.net 邮 箱 夏 日 大 变 脸,带 你 感 受 新 一 代 邮 箱 的 全 新 魅 力 >>




-- 
Amila Suriarachchi,
WSO2 Inc.

Re:Re: axis2:how to validate soap message against wsdl?

Posted by Zhang zhongliang <zz...@163.com>.
    First of all,thanks for your advice.
    Do you mean use ADB data binding,but if I use the wsdl2java tool to generate code,it will generate too much code lines,and which are not easy to understand,also the method of naming variables and methods.
What I need is keeping the program simple,so I wonder whether there is a way to set a property in the configuration file,which will enable the axis2 to validate the soap message(payload part) against wsdl for me.For example,if I put the following part:<parameter name="useOriginalwsdl" locked="false">true</parameter> in the services.xml in META-INF folder,then when I want to view the wsdl file,then I will view my own wsdl,not the one that axis2 generates automatically.
    So,Is there any properties that I can just configure in the configuration file(axis2.xml,services.xml) to get what I wanted?
    Thanks a lot.




在2007-08-21,"Amila Suriarachchi" <am...@gmail.com> 写道:

Is there any reason to deal with the OMElement directly?

if you generate the data bind code for wsdl using ADB then when the request parsing time ADB validates the request and give you the object structure.

you can use wsdl2java.sh tool to generate ADB code.

Amila.


On 8/21/07, Zhang zhongliang <zz...@163.com> wrote: 
Hi,I am the beginner to use this mailing list,so,any mistakes that I made,I hope I can be forgiven. 
I have a problem when I using apache-axis2-1.1.1,the web service my team developed will be accessed by other client,although we provided the wsdl to the client,but errors may also exist with the format of the soap message. 
I choose the wsdl:types elements out and form the xsd schema file(.xsd),and then use it to validate the soap message(Which is an OMElement object).
Now I want to ask whether there is a flag that I can configure to make axis2 validate the soap message against wsdl for me automatically? 
Thanks so much!




全 国 万 名 职 场 女 性,齐 聚 非 常 美 女,惊 艳 2 0 0 7 



-- 
Amila Suriarachchi,
WSO2 Inc.

RE: axis2:how to validate soap message against wsdl?

Posted by Boon Ooi <bo...@itree.com.au>.
Hi Amila,

 

I’m having the same challenge faced by Zhang zhongliang, to validate an incoming soap message based on given XML schema.

 

Instead of ADB, I’m using xmlbeans for data binding. Currently invalid SOAP messages such as a message without one or more mandatory data item(s) are getting pass the request parsing stage of AXIS2 and propagate right through to the back-end.

 

A temporary quick fix we have now is to have the backend perform these unwarranted message validations which suppose to be handled and detected by AXIS2 during request message parsing.

 

Could you please advise is there a way such validation can be made to perform during the request message parsing stage of AXIS2, if it is possible, what is the approach/method to do/implement such validation. 

 

A Configuration based setting that can trigger such validation would be great, however if that is not possible, programmatically handling such validation using approach like having a new module/handler would be also welcome, if need to be done programmatically, kindly advise what is the best method/approach to do that as the current API available from AXIS2 document model (AXIOM) do not seem to provide any methods to do that.

 

We are using AXIS2 1.3.

 

Your prompt reply if possible would be very very much appreciated.

 

Thank you very much in advance.

Boon

 

 

  _____  

From: Amila Suriarachchi [mailto:amilasuriarachchi@gmail.com] 
Sent: Tuesday, August 21, 2007 1:04 PM
To: axis-dev@ws.apache.org
Subject: Re: axis2:how to validate soap message against wsdl?

 

Is there any reason to deal with the OMElement directly?

if you generate the data bind code for wsdl using ADB then when the request parsing time ADB validates the request and give you the object structure.

you can use wsdl2java.sh tool to generate ADB code.

Amila.

On 8/21/07, Zhang zhongliang <zz...@163.com> wrote: 

Hi,I am the beginner to use this mailing list,so,any mistakes that I made,I hope I can be forgiven. 
I have a problem when I using apache-axis2-1.1.1,the web service my team developed will be accessed by other client,although we provided the wsdl to the client,but errors may also exist with the format of the soap message. 
I choose the wsdl:types elements out and form the xsd schema file(.xsd),and then use it to validate the soap message(Which is an OMElement object).
Now I want to ask whether there is a flag that I can configure to make axis2 validate the soap message against wsdl for me automatically? 
Thanks so much!



  _____  

 <http://event.mail.163.com/chanel/click.htm?from=NO_14&domain=163> 全 国 万 名 职 场 女 性,齐 聚 非 常 美 女,惊 艳 2 0 0 7 




-- 
Amila Suriarachchi,
WSO2 Inc. 


Re: axis2:how to validate soap message against wsdl?

Posted by Amila Suriarachchi <am...@gmail.com>.
Is there any reason to deal with the OMElement directly?

if you generate the data bind code for wsdl using ADB then when the request
parsing time ADB validates the request and give you the object structure.

you can use wsdl2java.sh tool to generate ADB code.

Amila.

On 8/21/07, Zhang zhongliang <zz...@163.com> wrote:
>
> Hi,I am the beginner to use this mailing list,so,any mistakes that I
> made,I hope I can be forgiven.
> I have a problem when I using apache-axis2-1.1.1,the web service my team
> developed will be accessed by other client,although we provided the wsdl to
> the client,but errors may also exist with the format of the soap message.
> I choose the wsdl:types elements out and form the xsd schema
> file(.xsd),and then use it to validate the soap message(Which is an
> OMElement object).
> Now I want to ask whether there is a flag that I can configure to make
> axis2 validate the soap message against wsdl for me automatically?
> Thanks so much!
>
>
> ------------------------------
> 全 国 万 名 职 场 女 性,齐 聚 非 常 美 女,惊 艳 2 0 0 7
> <http://event.mail.163.com/chanel/click.htm?from=NO_14&domain=163>




-- 
Amila Suriarachchi,
WSO2 Inc.