I am trying to use dspsts.asmx to retrieve the contents of a list. I am using Visual Studio 2008. Below is the source code from my console app that uses both a web reference (2005?) and a service reference (2008?) to connect to the same server. The web reference works as expected. The service reference is returning an error. With the source code and app.config unmodified from what I have posted, I get this error ERROR: "Failed to verify user permissions." When I change the source code to point to a different server using a different login, I get this. ERROR: "Server was unable to process request. ---> Computer name could not be obtained." Below are the changes to source code to point to a remote server and login with a differnt username SharePointWebServiceDspsts.StsAdapterSoapClient stsAdapterClient = new ConsoleApplication2.SharePointWebServiceDspsts.StsAdapterSoapClient(); stsAdapterClient.Endpoint.Address = new System.ServiceModel.EndpointAddress(@"http://remoteserver.----.---/sites/-/_vti_bin/dspsts.asmx"); stsAdapterClient.ClientCredentials.Windows.ClientCredential.Domain = @"----"; stsAdapterClient.ClientCredentials.Windows.ClientCredential.UserName = @"---"; stsAdapterClient.ClientCredentials.Windows.ClientCredential.Password = @"----"; Somebody please help me get dspsts.asmx working as a service reference in 2008. Thanks in advance. Here is the SOURCE CODE: using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Xml; namespace ConsoleApplication2 { class Program { static void Main(string[] args) { WebService2008(); } private static void WebService2005() { com.genesishcc.devcentral.StsAdapter myStsAd = new com.genesishcc.devcentral.StsAdapter(); myStsAd.Credentials = new System.Net.NetworkCredential("....", "....", "...."); myStsAd.Url = @"http://devcentral.genesishcc.com/sites/mgallahe/_vti_bin/dspsts.asmx"; string[] vArray = new string[1]; vArray[0] = "1.0"; com.genesishcc.devcentral.Versions myVersion = new com.genesishcc.devcentral.Versions(); myVersion.version = vArray; myStsAd.versions = myVersion; com.genesishcc.devcentral.RequestHeader reqHeader = new com.genesishcc.devcentral.RequestHeader(); reqHeader.document = com.genesishcc.devcentral.DocumentType.content; reqHeader.method = com.genesishcc.devcentral.MethodType.query; myStsAd.request = reqHeader; com.genesishcc.devcentral.QueryRequest myRequest = new com.genesishcc.devcentral.QueryRequest(); com.genesishcc.devcentral.DSQuery sQuery = new com.genesishcc.devcentral.DSQuery(); sQuery.select = "/list[@id='{874707E2-....-4867-8D08-2D16866A5219}']"; myRequest.dsQuery = sQuery; com.genesishcc.devcentral.DspQuery spQuery = new com.genesishcc.devcentral.DspQuery(); myRequest.dsQuery.Query = spQuery; try { XmlNode myNode = myStsAd.Query(myRequest); Console.WriteLine(myNode.OuterXml); Console.ReadLine(); } catch (System.Web.Services.Protocols.SoapException ex) { Console.WriteLine(ex.Message + ex.StackTrace); } } private static void WebService2008() { SharePointWebServiceDspsts.StsAdapterSoapClient stsAdapterClient = new ConsoleApplication2.SharePointWebServiceDspsts.StsAdapterSoapClient(); SharePointWebServiceDspsts.Authentication a = new SharePointWebServiceDspsts.Authentication(); SharePointWebServiceDspsts.DataRoot dr = new SharePointWebServiceDspsts.DataRoot(); SharePointWebServiceDspsts.RequestHeader rh = new SharePointWebServiceDspsts.RequestHeader(); SharePointWebServiceDspsts.Versions v = new SharePointWebServiceDspsts.Versions(); SharePointWebServiceDspsts.QueryRequest qr = new SharePointWebServiceDspsts.QueryRequest(); rh.document = SharePointWebServiceDspsts.DocumentType.content; rh.method = SharePointWebServiceDspsts.MethodType.query; v.version = new String[] { "1.0" }; SharePointWebServiceDspsts.DSQuery squery = new SharePointWebServiceDspsts.DSQuery(); squery.select = "list[@id='{7AE69674-....-491D-8AD1-721518E16C1D}']"; qr.dsQuery = squery; SharePointWebServiceDspsts.DspQuery spquery = new SharePointWebServiceDspsts.DspQuery(); XmlDocument xmldoc = new XmlDocument(); XmlElement ndquery = xmldoc.CreateElement("And"); ndquery.InnerXml = "<Eq><FieldRef Name=\"Title\"/><Value>test1</Value></Eq>"; spquery.Where = ndquery; qr.dsQuery.Query = spquery; XmlNode mynode = stsAdapterClient.Query(a, dr, rh, ref v,qr); } } } From app.config (pointing to local server) <bindings> <basicHttpBinding> <binding name="StsAdapterSoap" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536" messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true"> <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384" /> <security mode="TransportCredentialOnly"> <transport clientCredentialType="Ntlm" proxyCredentialType="Ntlm" realm="" /> <message clientCredentialType="UserName" algorithmSuite="Default" /> </security> </binding> </basicHttpBinding> </bindings> <client> <endpoint address="http://localserver/_vti_bin/dspsts.asmx" binding="basicHttpBinding" bindingConfiguration="StsAdapterSoap" contract="SharePointWebServiceDspsts.StsAdapterSoap" name="StsAdapterSoap" /> </client>
does this have to do with the impersonation level? "Maury" wrote: > I am trying to use dspsts.asmx to retrieve the contents of a list. I am using > Visual Studio 2008. Below is the source code from my console app that uses > both a web reference (2005?) and a service reference (2008?) to connect to > the same server. > > The web reference works as expected. The service reference is returning an > error. > > With the source code and app.config unmodified from what I have posted, I > get this error > ERROR: "Failed to verify user permissions." > > When I change the source code to point to a different server using a > different login, I get this. > > ERROR: "Server was unable to process request. ---> Computer name could not > be obtained." > > Below are the changes to source code to point to a remote server and login > with a differnt username > SharePointWebServiceDspsts.StsAdapterSoapClient stsAdapterClient = new > ConsoleApplication2.SharePointWebServiceDspsts.StsAdapterSoapClient(); > stsAdapterClient.Endpoint.Address = new > System.ServiceModel.EndpointAddress(@"http://remoteserver.----.---/sites/-/_vti_bin/dspsts.asmx"); > stsAdapterClient.ClientCredentials.Windows.ClientCredential.Domain = @"----"; > stsAdapterClient.ClientCredentials.Windows.ClientCredential.UserName = @"---"; > stsAdapterClient.ClientCredentials.Windows.ClientCredential.Password = > @"----"; > > Somebody please help me get dspsts.asmx working as a service reference in > 2008. > > Thanks in advance. > > > Here is the SOURCE CODE: > > using System; > using System.Collections.Generic; > using System.Linq; > using System.Text; > using System.Xml; > namespace ConsoleApplication2 > { > class Program > { > static void Main(string[] args) > { > WebService2008(); > } > private static void WebService2005() > { > com.genesishcc.devcentral.StsAdapter myStsAd = new > com.genesishcc.devcentral.StsAdapter(); > myStsAd.Credentials = new System.Net.NetworkCredential("....", > "....", "...."); > myStsAd.Url = > @"http://devcentral.genesishcc.com/sites/mgallahe/_vti_bin/dspsts.asmx"; > string[] vArray = new string[1]; > vArray[0] = "1.0"; > com.genesishcc.devcentral.Versions myVersion = new > com.genesishcc.devcentral.Versions(); > myVersion.version = vArray; > myStsAd.versions = myVersion; > com.genesishcc.devcentral.RequestHeader reqHeader = new > com.genesishcc.devcentral.RequestHeader(); > reqHeader.document = > com.genesishcc.devcentral.DocumentType.content; > reqHeader.method = com.genesishcc.devcentral.MethodType.query; > myStsAd.request = reqHeader; > com.genesishcc.devcentral.QueryRequest myRequest = new > com.genesishcc.devcentral.QueryRequest(); > com.genesishcc.devcentral.DSQuery sQuery = new > com.genesishcc.devcentral.DSQuery(); > sQuery.select = > "/list[@id='{874707E2-....-4867-8D08-2D16866A5219}']"; > myRequest.dsQuery = sQuery; > com.genesishcc.devcentral.DspQuery spQuery = new > com.genesishcc.devcentral.DspQuery(); > myRequest.dsQuery.Query = spQuery; > try > { > XmlNode myNode = myStsAd.Query(myRequest); > Console.WriteLine(myNode.OuterXml); > Console.ReadLine(); > } > catch (System.Web.Services.Protocols.SoapException ex) > { > Console.WriteLine(ex.Message + ex.StackTrace); > } > } > private static void WebService2008() > { > SharePointWebServiceDspsts.StsAdapterSoapClient stsAdapterClient > = new ConsoleApplication2.SharePointWebServiceDspsts.StsAdapterSoapClient(); > SharePointWebServiceDspsts.Authentication a = new > SharePointWebServiceDspsts.Authentication(); > SharePointWebServiceDspsts.DataRoot dr = new > SharePointWebServiceDspsts.DataRoot(); > SharePointWebServiceDspsts.RequestHeader rh = new > SharePointWebServiceDspsts.RequestHeader(); > SharePointWebServiceDspsts.Versions v = new > SharePointWebServiceDspsts.Versions(); > SharePointWebServiceDspsts.QueryRequest qr = new > SharePointWebServiceDspsts.QueryRequest(); > rh.document = SharePointWebServiceDspsts.DocumentType.content; > rh.method = SharePointWebServiceDspsts.MethodType.query; > v.version = new String[] { "1.0" }; > SharePointWebServiceDspsts.DSQuery squery = new > SharePointWebServiceDspsts.DSQuery(); > squery.select = > "list[@id='{7AE69674-....-491D-8AD1-721518E16C1D}']"; > qr.dsQuery = squery; > SharePointWebServiceDspsts.DspQuery spquery = new > SharePointWebServiceDspsts.DspQuery(); > XmlDocument xmldoc = new XmlDocument(); > XmlElement ndquery = xmldoc.CreateElement("And"); > ndquery.InnerXml = "<Eq><FieldRef > Name=\"Title\"/><Value>test1</Value></Eq>"; > spquery.Where = ndquery; > qr.dsQuery.Query = spquery; > XmlNode mynode = stsAdapterClient.Query(a, dr, rh, ref v,qr); > > } > } > } > > From app.config (pointing to local server) > <bindings> > <basicHttpBinding> > <binding name="StsAdapterSoap" closeTimeout="00:01:00" > openTimeout="00:01:00" > receiveTimeout="00:10:00" sendTimeout="00:01:00" > allowCookies="false" > bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" > maxBufferSize="65536" maxBufferPoolSize="524288" > maxReceivedMessageSize="65536" > messageEncoding="Text" textEncoding="utf-8" > transferMode="Buffered" > useDefaultWebProxy="true"> > <readerQuotas maxDepth="32" maxStringContentLength="8192" > maxArrayLength="16384" > maxBytesPerRead="4096" maxNameTableCharCount="16384" /> > <security mode="TransportCredentialOnly"> > <transport clientCredentialType="Ntlm" > proxyCredentialType="Ntlm" > realm="" /> > <message clientCredentialType="UserName" > algorithmSuite="Default" /> > </security> > </binding> > </basicHttpBinding> > </bindings> > <client> > <endpoint address="http://localserver/_vti_bin/dspsts.asmx" > binding="basicHttpBinding" > bindingConfiguration="StsAdapterSoap" > contract="SharePointWebServiceDspsts.StsAdapterSoap" > name="StsAdapterSoap" /> > </client> >