Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / Web Services / March 2005

Tip: Looking for answers? Try searching our database.

WSE2 identity constraint is not declared problem

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Bojan - 02 Mar 2005 13:37 GMT
Microsoft WSE 2 0 SP2 msi Problem

When I installed WSE 2.0 SP2 and called Wse WEB Service function with
DataSet as a parameter, I've got the following exception (non-WSE call is
Okay) :

System.SystemException  {"Server was unable to read request.  --> There is
an error in XML document (1, 4321).  --> The
'http://tempuri.org/:Package_Constraint1' identity constraint is not
declared.  An error occurred at , (1, 3905)."}

The DataSet is result of .Net GetChanges function and looks like this:

<?xml version="1.0" standalone="yes"?>
<NewDataSet>
 <xs:schema id="NewDataSet" xmlns=""
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
   <xs:element name="NewDataSet" msdata:IsDataSet="true"
msdata:Locale="en-CA">
     <xs:complexType>
       <xs:choice maxOccurs="unbounded">
         <xs:element name="Request">
           <xs:complexType>
             <xs:sequence>
               <xs:element name="RequestID" type="xs:string" />
             </xs:sequence>
           </xs:complexType>
         </xs:element>
         <xs:element name="Package">
           <xs:complexType>
             <xs:sequence>
               <xs:element name="PackageID" msdata:AutoIncrement="true"
msdata:AutoIncrementSeed="-1" msdata:AutoIncrementStep="-1" type="xs:int" />
               <xs:element name="RequestID" type="xs:string" minOccurs="0"
/>
               <xs:element name="PackageName" type="xs:string"
minOccurs="0" />
               <xs:element name="PackageDescription" type="xs:string"
minOccurs="0" />
               <xs:element name="DueDate" type="xs:dateTime" minOccurs="0"
/>
               <xs:element name="PackageTypeID" type="xs:int" minOccurs="0"
/>
               <xs:element name="UserID" type="xs:int" minOccurs="0" />
               <xs:element name="NoOfConsultees" type="xs:int"
minOccurs="0" />
               <xs:element name="NoOfPages" type="xs:int" minOccurs="0" />
               <xs:element name="Timestamp" type="xs:base64Binary"
minOccurs="0" />
               <xs:element name="ApproveDate" type="xs:dateTime"
minOccurs="0" />
             </xs:sequence>
           </xs:complexType>
         </xs:element>
         <xs:element name="Consultee">
           <xs:complexType>
             <xs:sequence>
               <xs:element name="PackageID" type="xs:int" />
               <xs:element name="UserID" type="xs:int" />
               <xs:element name="IsHost" type="xs:boolean" minOccurs="0" />
               <xs:element name="DisposedDate" type="xs:dateTime"
minOccurs="0" />
               <xs:element name="PackageStatusTypeID" type="xs:int"
minOccurs="0" />
               <xs:element name="Timestamp" type="xs:base64Binary"
minOccurs="0" />
               <xs:element name="PackageViewRightsTypeID" type="xs:int"
minOccurs="0" />
               <xs:element name="PackageCopyRightsTypeID" type="xs:int"
minOccurs="0" />
             </xs:sequence>
           </xs:complexType>
         </xs:element>
         <xs:element name="PackageStatusType">
           <xs:complexType>
             <xs:sequence>
               <xs:element name="PackageStatusTypeID" type="xs:int" />
               <xs:element name="PackageStatusTypeName" type="xs:string"
minOccurs="0" />
             </xs:sequence>
           </xs:complexType>
         </xs:element>
         <xs:element name="PackageApproval">
           <xs:complexType>
             <xs:sequence>
               <xs:element name="PackageApproveTypeID" type="xs:int"
minOccurs="0" />
               <xs:element name="UserID" type="xs:int" />
               <xs:element name="PackageID" type="xs:int" />
             </xs:sequence>
           </xs:complexType>
         </xs:element>
       </xs:choice>
     </xs:complexType>
     <xs:unique name="Constraint1" msdata:PrimaryKey="true">
       <xs:selector xpath=".//Request" />
       <xs:field xpath="RequestID" />
     </xs:unique>
     <xs:unique name="Package_Constraint1"
msdata:ConstraintName="Constraint1" msdata:PrimaryKey="true">
       <xs:selector xpath=".//Package" />
       <xs:field xpath="PackageID" />
     </xs:unique>
     <xs:unique name="Consultee_Constraint1"
msdata:ConstraintName="Constraint1" msdata:PrimaryKey="true">
       <xs:selector xpath=".//Consultee" />
       <xs:field xpath="PackageID" />
       <xs:field xpath="UserID" />
     </xs:unique>
     <xs:unique name="PackageStatusType_Constraint1"
msdata:ConstraintName="Constraint1" msdata:PrimaryKey="true">
       <xs:selector xpath=".//PackageStatusType" />
       <xs:field xpath="PackageStatusTypeID" />
     </xs:unique>
     <xs:unique name="PackageApproval_Constraint1"
msdata:ConstraintName="Constraint1" msdata:PrimaryKey="true">
       <xs:selector xpath=".//PackageApproval" />
       <xs:field xpath="PackageID" />
       <xs:field xpath="UserID" />
     </xs:unique>
     <xs:keyref name="R2" refer="Package_Constraint1">
       <xs:selector xpath=".//Consultee" />
       <xs:field xpath="PackageID" />
     </xs:keyref>
     <xs:keyref name="R3" refer="PackageStatusType_Constraint1">
       <xs:selector xpath=".//Consultee" />
       <xs:field xpath="PackageStatusTypeID" />
     </xs:keyref>
     <xs:keyref name="R1" refer="Constraint1">
       <xs:selector xpath=".//Package" />
       <xs:field xpath="RequestID" />
     </xs:keyref>
   </xs:element>
 </xs:schema>
 <Request>
   <RequestID>---</RequestID>
 </Request>
 <Package>
   <PackageID>-1</PackageID>
   <RequestID>---</RequestID>
   <PackageName>P3</PackageName>
   <PackageDescription />
   <DueDate>2005-02-21T00:00:00.0000000-05:00</DueDate>
   <PackageTypeID>1</PackageTypeID>
   <UserID>1</UserID>
 </Package>
</NewDataSet>



I discovered that

msdata:ConstraintName="Constraint1"

is always missing in between

<xs:unique name="Request_Constraint1"

and

msdata:PrimaryKey="true">

if a table is the first in DataSet Tables list.

For example, I've changed the order of Table list from previous example and
set PackageApproval table to be first, instead of Request:

<?xml version="1.0" standalone="yes"?>
<NewDataSet>
 <xs:schema id="NewDataSet" xmlns=""
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
   <xs:element name="NewDataSet" msdata:IsDataSet="true"
msdata:Locale="en-CA">
     <xs:complexType>
       <xs:choice maxOccurs="unbounded">
         <xs:element name="PackageApproval">

....

     <xs:unique name="Constraint1" msdata:PrimaryKey="true">
       <xs:selector xpath=".//PackageApproval" />
       <xs:field xpath="PackageID" />
       <xs:field xpath="UserID" />
     </xs:unique>

...

     <xs:unique name="Request_Constraint1"
msdata:ConstraintName="Constraint1" msdata:PrimaryKey="true">
       <xs:selector xpath=".//Request" />
       <xs:field xpath="RequestID" />
     </xs:unique>
Bojan - 30 Mar 2005 20:03 GMT
I found the bug in .NET Framework Assembly System.Data.dll

Declaring Type: System.Data.XmlTreeGen
Assembly: System.Data, Version=1.0.5000.0

method

private void GenerateConstraintNames(DataTable table)
{
     foreach (Constraint constraint1 in table.Constraints)
     {
           string text1 = constraint1.ConstraintName;
           for (int num1 = 0; this.ConstraintNames.Contains(text1); num1++)
           {
                 text1 = table.TableName + '_' + constraint1.ConstraintName;
                 if (num1 > 0)
                 {
                       text1 = text1 + '_' + num1.ToString();
                 }
           }
           this.ConstraintNames.Add(text1);
           constraint1.SchemaName = text1;
     }
}

by using Lutz Roeder's REFLECTOR tool.

> Microsoft WSE 2 0 SP2 msi Problem
>  
[quoted text clipped - 190 lines]
>         <xs:field xpath="RequestID" />
>       </xs:unique>

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.