[prev in list] [next in list] [prev in thread] [next in thread] 

List:       xmlbeans-user
Subject:    RE: Validating unique constraint with WSDLtoXMLBeans
From:       "Radu Preotiuc-Pietro" <radup () bea ! com>
Date:       2008-04-25 0:22:23
Message-ID: BF6B6CA032BA0A429BD924F96765147DBF2F35 () repbex02 ! amer ! bea ! com
[Download RAW message or body]

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:onural@nortel.com] 
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.


[Attachment #3 (text/html)]

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE>Validating unique constraint with WSDLtoXMLBeans</TITLE>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.2900.3314" name=GENERATOR></HEAD>
<BODY>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN 
class=796131000-25042008>Gul, </SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN 
class=796131000-25042008></SPAN></FONT>&nbsp;</DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN 
class=796131000-25042008>Your "unique" declaration is not in fact correct. Given 
your type definitions, I think what you mean is that, given a list of 
&lt;userName&gt; elements, all their values are distinct. So you selector needs 
to be the list of "userName" elements like this:</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN 
class=796131000-25042008></SPAN></FONT>&nbsp;</DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN 
class=796131000-25042008>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
 &lt;unique 
name="nameOfUser"&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
 &lt;selector 
xpath="impl:userNames/impl:userName"/&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp \
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;field \
 xpath="."/&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
 &lt;/unique&gt;<BR></SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN 
class=796131000-25042008>Radu</DIV></SPAN></FONT>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN 
class=796131000-25042008></SPAN></FONT>&nbsp;</DIV>
<DIV dir=ltr align=left>
<HR tabIndex=-1>
</DIV>
<DIV dir=ltr align=left><FONT face=Tahoma size=2><B>From:</B> Gul Onural 
[mailto:onural@nortel.com] <BR><B>Sent:</B> Saturday, April 12, 2008 7:29 
PM<BR><B>To:</B> user@xmlbeans.apache.org<BR><B>Subject:</B> Validating unique 
constraint with WSDLtoXMLBeans<BR></FONT><BR></DIV>
<BLOCKQUOTE dir=ltr 
style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #0000ff 2px solid; \
MARGIN-RIGHT: 0px">  <DIV></DIV><!-- Converted from text/rtf format --><BR>
  <P><FONT face=Arial size=2>Hi,</FONT> </P>
  <P><FONT face=Arial size=2>I am using XMLBeans to generate code from a WSDL 
  and validating the SOAP request using validate. So far,</FONT> <BR><FONT 
  face=Arial size=2>I was able to get validation properly working for many 
  schema constraints. However, I couldn't get "unique"</FONT> <BR><FONT 
  face=Arial size=2>constraint working.</FONT> </P>
  <P><FONT face=Arial size=2>My WSDL snippet is shown below. What I am trying to 
  do is to make sure each user name in the removeUsersRequest is 
  </FONT><BR><FONT face=Arial size=2>unique. The WSDL is properly parsed and XML 
  beans are properly generated. But the duplicate user names are not 
  detected</FONT> <BR><FONT face=Arial size=2>in the SOAP request. </FONT></P>
  <P><FONT face=Arial size=2>What is wrong in my usage if "unique" here ? Why is 
  the XMLBean validation doesn't detect the duplicates while my other</FONT> 
  <BR><FONT face=Arial size=2>schema constraints work correctly?</FONT> </P>
  <P><FONT face=Arial size=2>Thanks,</FONT> </P>
  <P><FONT face=Arial size=2>Gul</FONT> </P>
  <P><FONT face=Arial size=2>&nbsp;&nbsp;&nbsp;&nbsp; &lt;wsdl:definitions 
  xmlns:impl="<A 
  href="http://www.mycompany.com">http://www.mycompany.com</A>"</FONT> 
  <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT face=Arial 
  size=2>xmlns:intf="<A 
  href="http://www.mycompany.com">http://www.mycompany.com</A>"</FONT> 
  <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT face=Arial 
  size=2>xmlns:wsdl="<A 
  href="http://schemas.xmlsoap.org/wsdl/">http://schemas.xmlsoap.org/wsdl/</A>"</FONT> \
  <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT face=Arial 
  size=2>xmlns:wsdlsoap="<A 
  href="http://schemas.xmlsoap.org/wsdl/soap/">http://schemas.xmlsoap.org/wsdl/soap/</A>"</FONT> \
  <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT face=Arial 
  size=2>xmlns:wsi="<A 
  href="http://ws-i.org/profiles/basic/1.1/xsd">http://ws-i.org/profiles/basic/1.1/xsd</A>" \
  xmlns:xsd="<A 
  href="http://www.w3.org/2001/XMLSchema">http://www.w3.org/2001/XMLSchema</A>"</FONT> \
  <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT face=Arial 
  size=2>targetNamespace="<A 
  href="http://www.mycompany.com">http://www.mycompany.com</A>" 
  elementFormDefault="qualified"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
  </FONT><BR><FONT face=Arial 
  size=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
  attributeFormDefault="unqualified"&gt;</FONT> 
  <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <BR><FONT face=Arial 
  size=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp \
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
  &lt;complexType name="UserNamesT"&gt;</FONT> 
  <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT face=Arial 
  size=2>&lt;sequence&gt;</FONT> <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT face=Arial size=2>&lt;element 
  maxOccurs="50" minOccurs="1" name="userName" nillable="false"</FONT> 
  <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT face=Arial 
  size=2>type="impl:nonEmptyString"/&gt;</FONT> 
  <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT face=Arial 
  size=2>&lt;/sequence&gt;</FONT> <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT face=Arial 
  size=2>&lt;/complexType&gt;</FONT> </P>
  <P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT face=Arial size=2>&lt;element 
  name="removeUsersRequest"&gt;</FONT> 
  <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT face=Arial 
  size=2>&lt;complexType&gt;</FONT> 
  <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT face=Arial 
  size=2>&lt;sequence&gt;</FONT> <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT face=Arial size=2>&lt;element 
  name="userNames" nillable="false" type="impl:UserNamesT"/&gt;</FONT> 
  <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT face=Arial 
  size=2>&lt;/sequence&gt;</FONT> <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT face=Arial 
  size=2>&lt;/complexType&gt;<B></B></FONT> <BR><B><FONT face=Arial 
  size=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp \
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;& \
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
  &lt;unique name="nameOfUser"&gt;</FONT></B> 
  <BR><B>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT face=Arial 
  size=2>&lt;selector xpath="impl:userNames"/&gt;</FONT></B> <BR><B><FONT 
  face=Arial 
  size=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp \
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;& \
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb \
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
  &lt;field xpath="@userName"/&gt;</FONT></B> <BR><B><FONT face=Arial 
  size=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp \
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;& \
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
  &lt;/unique&gt;</FONT></B> <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT face=Arial 
  size=2>&lt;/element&gt;</FONT> </P></BLOCKQUOTE></BODY></HTML>
<br>
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.



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic