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 st...@web.de on 2006/07/03 14:52:20 UTC

[axis2] Validating Messages :: WSDL ::

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
_____________________________________________________________________
Der WEB.DE SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen!
http://smartsurfer.web.de/?mc=100071&distributionid=000000000071


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