I'm trying to use the episerver webservice, but I can't get any data. I've set it up according to the techincal reference, with basic authentication. Here's the code I use.
WS.DataFactoryService proxy = new Basetool.EPiServer.WS.DataFactoryService();
proxy.Credentials = new NetworkCredential("ntfsuser", "password", "");
proxy.PreAuthenticate = true;
PageReference pr = new PageReference();
pr.ID = 28;
pr.LoadRawPageData = true;
RawPage[] pages = proxy.GetChildren(pr);
This doesn't return anything, but it doesn't throw any errors.
I've tried setting it to both "Name of your website" and "Address to your website" but nothing happens. Do you have to config something in admin for webservices to work?
First, make sure you've set up the web service correct on the remote site. Try to access http://REMOTESITENAME/webservices/datafactoryservice.asmx in your browser, using the specified username and password. For troubleshooting, see Tech Notes.
When this is done, make sure you've set up the Remote Sites setup in admin on both the remote episerver site and the local episerver site. You should be able to ping (the link in the admin tool page) from your local site to your remote site. If this fails, try to generate a new to use between the sites. For troubleshooting, see Tech Notes.
Frank :)
The first part works fine, and I have, as said, set it up according to the Tech ref. Do I need to set up "Remote sites" even if I am not to transfer data between to episerver installations? I just want to use the webservice to get data out to another application.
I don't think this is possible, since the EPiServer assemblies you've referenced to, don't know the context they're in.
Maybe someone from EP should comment on this.
Frank :)
Hello
It is absolutly possible to consume the webservice from a non EPiServer application. The problem in this case, which was found out through EPiServer support, was that the user didn't have read rights on the pages. That's why no pages was returned from the GetChildren call.
Problem solved. I was accessing through the webservice. pages that didn't allow anonymous access, and where the NTFS-account used by the webservice had no rights either.
Solved it by adding read-access for the pages to the webservice NTFS-user.
WS.DataFactoryService proxy = new Basetool.EPiServer.WS.DataFactoryService(); proxy.Credentials = new NetworkCredential("ntfsuser", "password", ""); proxy.PreAuthenticate = true; PageReference pr = new PageReference(); pr.ID = 28; pr.LoadRawPageData = true; RawPage[] pages = proxy.GetChildren(pr);
This doesn't return anything, but it doesn't throw any errors.