Gul, Your "unique" declaration is not in fact correct. Given your type definitions, I think what you mean is that, given a list of <userName> elements, all their values are distinct. So you selector needs to be the list of "userName" elements like this: <unique name="nameOfUser"> <selector xpath="impl:userNames/impl:userName"/> <field xpath="."/> </unique>
Radu ________________________________ From: Gul Onural [mailto:[EMAIL PROTECTED] Sent: Saturday, April 12, 2008 7:29 PM To: user@xmlbeans.apache.org Subject: Validating unique constraint with WSDLtoXMLBeans Hi, I am using XMLBeans to generate code from a WSDL and validating the SOAP request using validate. So far, I was able to get validation properly working for many schema constraints. However, I couldn't get "unique" constraint working. My WSDL snippet is shown below. What I am trying to do is to make sure each user name in the removeUsersRequest is unique. The WSDL is properly parsed and XML beans are properly generated. But the duplicate user names are not detected in the SOAP request. What is wrong in my usage if "unique" here ? Why is the XMLBean validation doesn't detect the duplicates while my other schema constraints work correctly? Thanks, Gul <wsdl:definitions xmlns:impl="http://www.mycompany.com" xmlns:intf="http://www.mycompany.com" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsi="http://ws-i.org/profiles/basic/1.1/xsd" xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.mycompany.com" elementFormDefault="qualified" attributeFormDefault="unqualified"> <complexType name="UserNamesT"> <sequence> <element maxOccurs="50" minOccurs="1" name="userName" nillable="false" type="impl:nonEmptyString"/> </sequence> </complexType> <element name="removeUsersRequest"> <complexType> <sequence> <element name="userNames" nillable="false" type="impl:UserNamesT"/> </sequence> </complexType> <unique name="nameOfUser"> <selector xpath="impl:userNames"/> <field xpath="@userName"/> </unique> </element> Notice: This email message, together with any attachments, may contain information of BEA Systems, Inc., its subsidiaries and affiliated entities, that may be confidential, proprietary, copyrighted and/or legally privileged, and is intended solely for the use of the individual or entity named in this message. If you are not the intended recipient, and have received this message in error, please immediately return this by email and then delete it.