Axis makes no attempt to validate messages. (It's very expensive
process that would significantly degrade performance). A databinding
system will catch many validation issues, but it also does not do true
validation. If you pass in elements that it doesn't expect, it will
reject the request. But as long as the message matches what the
databinding system can deal with, it will pass.

If you want to validate the message, then use a handler or
intermediary to do so.

Anne

On 7/7/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
Since there was no reply, I'll try again...

Thanks for your time

Bille

-----Ursprüngliche Nachricht-----
Von: [EMAIL PROTECTED]
Gesendet: 03.07.06 14:52:54
An: [email protected]
Betreff: [axis2] Validating Messages :: WSDL :: <choice>

Hi everbody,

I encounter the following:

- specified the request-message for my service-method as the following 
(WSDL-File):
...

<xsd:element name="getSingleUserRequest">
<xsd:complexType>
<xsd:choice>
<xsd:element ref="xsd1:kid" minOccurs="1" maxOccurs="1"/>
<xsd:element name="names" type="xsd1:names" minOccurs="1" maxOccurs="1"/>
</xsd:choice>
</xsd:complexType>
</xsd:element>

where kid-Element and names-type are:

<xsd:element name="myFault" type="xsd:string"/>

<xsd:complexType name="names">
<xsd:sequence>
<xsd:element name="sn" type="xsd:string" minOccurs="1" maxOccurs="1"/>
<xsd:element name="givenname" type="xsd:string" minOccurs="0" maxOccurs="1"/>
</xsd:sequence>
</xsd:complexType>
...

As using the <choice>-keyword I exspect the request being just a 'kid'-element 
OR a 'names'-type.

- I use doc/lit style for the SOAP-messages
- I now built 2 sort of clients to query the service, just to check what's 
going on there

a) Client using AXIOM: What I encountered here, is that I could send messages, 
that send 'kid' AND 'names' AND also some other elements I like (didn't define 
in WSDL).
So the request is never validated against the schema. It seems, that Axis2 
doens't do any validating job.

b) Code generated client (Stubs with XMLBeans), which uses documents, that are 
filled before sending over the wire:
While using this, it's clear that I can only set 'kid' and 'names' - that's 
what the xxxDocument-Interfaces propose ;).
If my client sets both type 'kid' AND 'names' the request only takes the first 
element to be set. So the further settings are ignored. This somehow makes sense, as 
<choice> accepts only ONE of its elements.
So far, with using stubs and the XMLBeans there seems to happen some 
'validation', because of the databinding.
What I wonder about, there's no hint of the schema rejecting the second 
parameter.
Is this the wanted behaviour af Axis2 ?

The second question is:
Does AXIOM propose a possibilty to validate the messages?

Since using document/literal SOAP-Messages there's the general possibility to 
validate messages against the schema-definition.
If Axis doens't has such a feature, I suggest placing my validating component 
in the MessageReceiver - am I right ?
If I now include my 'manual' messagevalidation, I have to parse the whole 
message (in case of a valid one ;) ), which then takes off the smart advantages 
of the pull-parsing, that is given with AXIOM.
As I haven't implemented such a validating mechanism; I would appreciate any 
hints, of how this can be done in a performant way. Do I have to use StaX (or 
DOM), assuming AXIOM does not provide such techniques.

I hope I made myself somehow clear...


Thanks for any advice

Bille
______________________________________________________________________________
Mit WEB.DE iNews werden Sie über die Ergebnisse der wichtigsten WM-Begegnungen
per SMS informiert: http://freemail.web.de/features/inews.htm/?mc=021202


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to