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 / December 2005

Tip: Looking for answers? Try searching our database.

An error in XML document - identity constraint is not declared

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
bkriznar - 04 May 2005 20:16 GMT
I've stoumbled over this Exception when I installed WSE 2.0 SP2 on my machine
and called Wse WEB Service.
Non-Wse WEB Service worked fine.

The bug could be reproduced like this:

1.
    DataColumn[] arrKey = new DataColumn[1];;
    arrKey[0] = ds.Tables["Request"].Columns["RequestID"];
    ds.Tables["Request"].PrimaryKey = arrKey;

    DataColumn[] arrKey2 = new DataColumn[1];;
    arrKey2[0] = ds.Tables["Package"].Columns["PackageID"];
    ds.Tables["Package"].PrimaryKey = arrKey2;
    ds.Tables["Package"].Columns[arrKey2[0].ColumnName].AutoIncrement = true;
    ds.Tables["Package"].Columns[arrKey2[0].ColumnName].AutoIncrementSeed = -1;
    ds.Tables["Package"].Columns[arrKey2[0].ColumnName].AutoIncrementStep = -1;

...

In this case the exception would be:

There is an error in XML document (1, 4321).  --> The
'http://tempuri.org/:Request_Constraint1' identity constraint is not
declared.  An error occurred at , (1, 3905)."}

When I saved ds in XML file it looked like:

<?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>

2.

    DataColumn[] arrKey2 = new DataColumn[1];;
    arrKey2[0] = ds.Tables["Package"].Columns["PackageID"];
    ds.Tables["Package"].PrimaryKey = arrKey2;
    ds.Tables["Package"].Columns[arrKey2[0].ColumnName].AutoIncrement = true;
    ds.Tables["Package"].Columns[arrKey2[0].ColumnName].AutoIncrementSeed = -1;
    ds.Tables["Package"].Columns[arrKey2[0].ColumnName].AutoIncrementStep = -1;

    DataColumn[] arrKey = new DataColumn[1];;
    arrKey[0] = ds.Tables["Request"].Columns["RequestID"];
    ds.Tables["Request"].PrimaryKey = arrKey;

...

The XML DataSet representation was the same except Package_Constratint1 was
not declared and the following exception was thrown:

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)."}

It looks like XML parser always skips Constraint Definition for the first
table and WSE2.0 just reports the error and throws the exception.
Dilip Krishnan - 06 May 2005 16:37 GMT
You need to be very careful using datasets over the wire because
1. It is not interoperable with other technologies (it may or may not
apply in you case, nevertheless)
2. Not all dataset elements are serializable and thats what you're
running into out here.

> I've stoumbled over this Exception when I installed WSE 2.0 SP2 on my machine
> and called Wse WEB Service.
[quoted text clipped - 168 lines]
> It looks like XML parser always skips Constraint Definition for the first
> table and WSE2.0 just reports the error and throws the exception.

Signature

HTH
Regards,
Dilip Krishnan
MCAD, MCSD.net
dilip.krishnan AT apdiya DOT com

bkriznar - 09 May 2005 14:16 GMT
Could you be more specific, please?

Which dataset elements are not serializable?

What do you mean “to be very careful using datasets over the wire”? Does it
mean that you do not recommend using datasets in Distributed interNet
Architecture?

Thanks,
Bojan

> You need to be very careful using datasets over the wire because
> 1. It is not interoperable with other technologies (it may or may not
[quoted text clipped - 174 lines]
> > It looks like XML parser always skips Constraint Definition for the first
> > table and WSE2.0 just reports the error and throws the exception.
Dilip Krishnan - 09 May 2005 16:02 GMT
To be more specific... Constraints are not XmlSerializable. That is they
cannot be serialized by the .net xml serializer.

And the xml representation of datasets are not a standard accross
languages and platforms. So if a Java application were to consume the
service, it wouldnt knwo what to do with the xml it received (i.e.
dataset). Secondly Datasets are intrinsically very heavy and will drag
the performance of your system in large loads. So IMO I would not
recommend Datasets unless your systems are only .net based and loads are
not that high on the services.

> Could you be more specific, please?
>
[quoted text clipped - 185 lines]
>>>It looks like XML parser always skips Constraint Definition for the first
>>>table and WSE2.0 just reports the error and throws the exception.

Signature

HTH
Regards,
Dilip Krishnan
MCAD, MCSD.net
dilip.krishnan AT apdiya DOT com

bkriznar - 09 May 2005 16:57 GMT
By definition, DataSet object constraints should be serializable.

From Applied XML Programming for Microsoft® .NET

"When you serialize a DataSet object, schema information is important for
two reasons. First, it adds structured information about the layout of the
constituent tables and their relations and constraints..."

Does it mean that .net xml serializer has a bug?

> To be more specific... Constraints are not XmlSerializable. That is they
> cannot be serialized by the .net xml serializer.
[quoted text clipped - 196 lines]
> >>>It looks like XML parser always skips Constraint Definition for the first
> >>>table and WSE2.0 just reports the error and throws the exception.
bkriznar - 10 Jun 2005 20:35 GMT
Can I disable "identity constraint" check, somehow?

Bojan
egomolka - 10 Aug 2005 23:39 GMT
Was there a resolution to this?
I am having the same problem.
It only manifests itself when encryption is used.
When I encrypt the message body, and use an X.509 certificate, the exception
is raised. When I remove the encryption, but still use WSE, everything works
great.

Ed

> Can I disable "identity constraint" check, somehow?
>
> Bojan
Pablo Cibraro - 17 Aug 2005 00:07 GMT
Hi Bojan,
I don't understand the question well. What do you mean with "identity
constraint" ?.

Thanks
Pablo Cibraro
www.lagash.com

> Was there a resolution to this?
> I am having the same problem.
[quoted text clipped - 10 lines]
>>
>> Bojan
bkriznar - 04 Oct 2005 15:50 GMT
Hi Pablo,

You can find more about "Identity constraint" at

http://forums.java.net/jive/thread.jspa?messageID=12174&tstart=0

Bojan

> Hi Bojan,
> I don't understand the question well. What do you mean with "identity
[quoted text clipped - 18 lines]
> >>
> >> Bojan
bkriznar - 05 Dec 2005 19:00 GMT
I've just tested the issue on VS.NET 2005, WSE 3.0 platform and it seems that
it has no 'identity constraint is not declared' problem any more.

Thanks,

Bojan Kriznar
kriznar@hotmail.com

> I've stoumbled over this Exception when I installed WSE 2.0 SP2 on my machine
> and called Wse WEB Service.
[quoted text clipped - 168 lines]
> It looks like XML parser always skips Constraint Definition for the first
> table and WSE2.0 just reports the error and throws the exception.

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.