T
TS
am using asp.net to call a sharepoint web service. It returns the
following xml:
<listitems xmlns:s="uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882"
xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882"
xmlns:rs="urn:schemas-microsoft-com:rowset" xmlns:z="#RowsetSchema"
xmlns="http://schemas.microsoft.com/sharepoint/soap/";>
<rs:data ItemCount="5">
<z:row ows_Attachments="0" ows_LinkTitle="burns" ows_FirstName="Robert"
ows_Company="Texas" ows_WorkPhone="512-924-2056"
ows_Email="(e-mail address removed)" ows_County="Anderson"
ows_WorkCity="Abilene" ows_Phone_x0020_Extension="8056" ows_Title="burns"
ows_ID="2" ows_owshiddenversion="3" />
<z:row ows_Attachments="0" ows_LinkTitle="johnson" ows_FirstName="Mike"
ows_Company="Texass" ows_WorkPhone="5551212" ows_County="Anderson"
ows_WorkCity="Abilene" ows_Title="johnson" ows_ID="3"
ows_owshiddenversion="2" />
<z:row ows_Attachments="0" ows_LinkTitle="Mathews" ows_FirstName="John"
ows_Company="XXX" ows_WorkPhone="512-424-5498"
ows_Email="(e-mail address removed)" ows_County="Travis"
ows_WorkCity="Austin" ows_Phone_x0020_Extension="5498" ows_Title="Mathews"
ows_ID="6" ows_owshiddenversion="2" />
<z:row ows_Attachments="0" ows_LinkTitle="bris" ows_FirstName="Debbie"
ows_Company="YYY" ows_WorkPhone="2530" ows_County="Travis"
ows_WorkCity="Austin" ows_Title="bris" ows_ID="7" ows_owshiddenversion="1"
/>
<z:row ows_Attachments="-1" ows_LinkTitle="Carter" ows_FirstName="John"
ows_Company="ZZZ" ows_WorkPhone="5656465656" ows_County="Anderson"
ows_WorkCity="Abilene" ows_Title="Carter" ows_ID="8"
ows_owshiddenversion="3" />
</rs:data>
</listitems>
I am trying to load the xml into a dataset as follows:
nodListItems = L.GetListItems(contactList, String.Empty, Nothing, Nothing,
"1000", Nothing)
xd = New XmlDataDocument
ds = xd.DataSet
'Read in SCHEMA
ds.ReadXmlSchema(Request.MapPath("\commonControls\ContactPopUp.xsd"))
' Add an XML declaration to make the XmlNode a valid XML document
xd.LoadXml("<?xml version='1.0' ?>" & nodListItems.OuterXml)
I know that this code works, becuase I use it for another WS call and it
works. I think theres a problem with my schema. I tried to take the xml and
generate a schema using XML spy, it says "error: 'rs:data' cannot have a
namespace prefix. Please remove prefix or use 'ref=' instead", though it
says the schema below has no errors.
My schema is as follows:
<?xml version="1.0" encoding="utf-8"?>
<xs:schema id="ContactPopUp"
targetNamespace="http://schemas.microsoft.com/sharepoint/soap/"
xmlns="http://schemas.microsoft.com/sharepoint/soap/"
xmlns:mstns="http://schemas.microsoft.com/sharepoint/soap/"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xs:element name="listitems" msdata:IsDataSet="true">
<xs:complexType>
<xs:sequence>
<xs:element name="data">
<xs:complexType>
<xs:sequence>
<xs:element name="row">
<xs:complexType>
<xs:attribute name="ows_Attachments" form="unqualified"
type="xs:string" />
<xs:attribute name="ows_LinkTitle" form="unqualified"
type="xs:string" />
<xs:attribute name="ows_FirstName" form="unqualified"
type="xs:string" />
<xs:attribute name="ows_Company" form="unqualified"
type="xs:string" />
<xs:attribute name="ows_WorkPhone" form="unqualified"
type="xs:string" />
<xs:attribute name="ows_Email" form="unqualified"
type="xs:string" />
<xs:attribute name="ows_County" form="unqualified"
type="xs:string" />
<xs:attribute name="ows_WorkCity" form="unqualified"
type="xs:string" />
<xs:attribute name="ows_Phone_x0020_Extension"
form="unqualified" type="xs:string" />
<xs:attribute name="ows_Title" form="unqualified"
type="xs:string" />
<xs:attribute name="ows_ID" form="unqualified"
type="xs:string" />
<xs:attribute name="ows_owshiddenversion" form="unqualified"
type="xs:string" />
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="ItemCount" form="unqualified" type="xs:string"
/>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
No errors occur, just the dataset has 2 tables: a "row" and a "data", but
both have a rowcount of 0. They have the column names that match the
attribute names above (ows_LinkTitle,ows_FirstName, etc). A weird thing that
happens also is that it adds a column named "data_Id" to both tables. I
guess thats some kind of dataset thing???
Anyways, I would appreciate if someone could point me in the right
direction, this is my first try at a webservice, so I could be missing
something that I'm not aware of.
Thanks!
following xml:
<listitems xmlns:s="uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882"
xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882"
xmlns:rs="urn:schemas-microsoft-com:rowset" xmlns:z="#RowsetSchema"
xmlns="http://schemas.microsoft.com/sharepoint/soap/";>
<rs:data ItemCount="5">
<z:row ows_Attachments="0" ows_LinkTitle="burns" ows_FirstName="Robert"
ows_Company="Texas" ows_WorkPhone="512-924-2056"
ows_Email="(e-mail address removed)" ows_County="Anderson"
ows_WorkCity="Abilene" ows_Phone_x0020_Extension="8056" ows_Title="burns"
ows_ID="2" ows_owshiddenversion="3" />
<z:row ows_Attachments="0" ows_LinkTitle="johnson" ows_FirstName="Mike"
ows_Company="Texass" ows_WorkPhone="5551212" ows_County="Anderson"
ows_WorkCity="Abilene" ows_Title="johnson" ows_ID="3"
ows_owshiddenversion="2" />
<z:row ows_Attachments="0" ows_LinkTitle="Mathews" ows_FirstName="John"
ows_Company="XXX" ows_WorkPhone="512-424-5498"
ows_Email="(e-mail address removed)" ows_County="Travis"
ows_WorkCity="Austin" ows_Phone_x0020_Extension="5498" ows_Title="Mathews"
ows_ID="6" ows_owshiddenversion="2" />
<z:row ows_Attachments="0" ows_LinkTitle="bris" ows_FirstName="Debbie"
ows_Company="YYY" ows_WorkPhone="2530" ows_County="Travis"
ows_WorkCity="Austin" ows_Title="bris" ows_ID="7" ows_owshiddenversion="1"
/>
<z:row ows_Attachments="-1" ows_LinkTitle="Carter" ows_FirstName="John"
ows_Company="ZZZ" ows_WorkPhone="5656465656" ows_County="Anderson"
ows_WorkCity="Abilene" ows_Title="Carter" ows_ID="8"
ows_owshiddenversion="3" />
</rs:data>
</listitems>
I am trying to load the xml into a dataset as follows:
nodListItems = L.GetListItems(contactList, String.Empty, Nothing, Nothing,
"1000", Nothing)
xd = New XmlDataDocument
ds = xd.DataSet
'Read in SCHEMA
ds.ReadXmlSchema(Request.MapPath("\commonControls\ContactPopUp.xsd"))
' Add an XML declaration to make the XmlNode a valid XML document
xd.LoadXml("<?xml version='1.0' ?>" & nodListItems.OuterXml)
I know that this code works, becuase I use it for another WS call and it
works. I think theres a problem with my schema. I tried to take the xml and
generate a schema using XML spy, it says "error: 'rs:data' cannot have a
namespace prefix. Please remove prefix or use 'ref=' instead", though it
says the schema below has no errors.
My schema is as follows:
<?xml version="1.0" encoding="utf-8"?>
<xs:schema id="ContactPopUp"
targetNamespace="http://schemas.microsoft.com/sharepoint/soap/"
xmlns="http://schemas.microsoft.com/sharepoint/soap/"
xmlns:mstns="http://schemas.microsoft.com/sharepoint/soap/"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xs:element name="listitems" msdata:IsDataSet="true">
<xs:complexType>
<xs:sequence>
<xs:element name="data">
<xs:complexType>
<xs:sequence>
<xs:element name="row">
<xs:complexType>
<xs:attribute name="ows_Attachments" form="unqualified"
type="xs:string" />
<xs:attribute name="ows_LinkTitle" form="unqualified"
type="xs:string" />
<xs:attribute name="ows_FirstName" form="unqualified"
type="xs:string" />
<xs:attribute name="ows_Company" form="unqualified"
type="xs:string" />
<xs:attribute name="ows_WorkPhone" form="unqualified"
type="xs:string" />
<xs:attribute name="ows_Email" form="unqualified"
type="xs:string" />
<xs:attribute name="ows_County" form="unqualified"
type="xs:string" />
<xs:attribute name="ows_WorkCity" form="unqualified"
type="xs:string" />
<xs:attribute name="ows_Phone_x0020_Extension"
form="unqualified" type="xs:string" />
<xs:attribute name="ows_Title" form="unqualified"
type="xs:string" />
<xs:attribute name="ows_ID" form="unqualified"
type="xs:string" />
<xs:attribute name="ows_owshiddenversion" form="unqualified"
type="xs:string" />
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="ItemCount" form="unqualified" type="xs:string"
/>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
No errors occur, just the dataset has 2 tables: a "row" and a "data", but
both have a rowcount of 0. They have the column names that match the
attribute names above (ows_LinkTitle,ows_FirstName, etc). A weird thing that
happens also is that it adds a column named "data_Id" to both tables. I
guess thats some kind of dataset thing???
Anyways, I would appreciate if someone could point me in the right
direction, this is my first try at a webservice, so I could be missing
something that I'm not aware of.
Thanks!