Virtual Happy Hour this month, Jun 28, we'll be getting a sneak preview at our soon to launch SaaS CMS!

Try our conversational search powered by Generative AI!

EPiServer Webservice for page contents

Vote:
 

Hi, I am new on EPiServer. Actually I want to get contents of pages of website (which is build in EPiServer CMS) and want to use that contents to make mobile site. Is there any way or web service that I can use to get contents of all pages? What i need to do, like do I need to make a new web application that will call webservice or anything else? can anyone please help me with this issue?

Thanks

#55179
Nov 21, 2011 15:40
Vote:
 

You can find a PageStoreService.asmx in the Webservices folder of your www root. But be careful, getting content from a page might more difficult then you would think. Especially if you have highly complex pages with XHTML properties that has dynamic content in them.

You can also take a look at the open source project Mobile Pack (http://mobilepack.codeplex.com/) 

#55181
Edited, Nov 21, 2011 16:01
Vote:
 

Ok. I can use PageStoreService.asmx to get page contents. But I need to do some sort of Authentication. Actually my client has its site on epi server CMS, and i want to transform that site to mobile site. So to do this, i need to get content of the site and use that contents to make mobile site in my own way (not using mobile pack). Is webservice is only way to get the contents or I can use any other way? I think Mirroring and exporting XML can only be done between sites build in EPiServer. What is the best method to get site contents? (Sorry i am new to EPiServer thats why i don't know much about it)

Yes, I already look at Mobile pack for EPiServer. But the problem I am facing right now is that it is jQuery mobile base. So i am affraid, site may not work on old phones like Nokia N70, N73 etc (or hand sets not supporting jQuery Mobile). I think site built using mobile pack will only works on smart phones (iPhone, Android, Samsung Glaxy etc). Is there any solution that I can use only Redirect section of mobile pack for my site (not build in Mobile pack)?

#55183
Nov 21, 2011 17:08
Vote:
 

As Mobile Pack is an open source solution, you can use whatever you feel in it. Poke around and see how they solved the redirection.

Authentication in PageStoreService uses EPiServer Basic authentication, it emulates basic authentication and uses cookies. Read on it here:

http://world.episerver.com/Documentation/Items/Tech-Notes/EPiServer-CMS-6/EPiServer-CMS-60/Web-Services/#Creating Your Own Web Services. It tells you how to configure EPiServer CMS to allow users to connect to the webservice. It also have some basic examples on how to consume it.

#55188
Nov 22, 2011 8:35
Vote:
 

Thanks alot for your help. My CMS has Alloy Technologies website, and i am trying to get content of Alloy site pages.

I made .Net application and change all authentication setting as mentioned. My application called PageStoreService.asmx webservice to get content of the page. Code is:

 

        PageStoreService pageContent = new PageStoreService();                
        LanguageSelector selector = new LanguageSelector("en-US");

        RawPage page = new RawPage();

        page = pageContent.GetPage(new EPiServer.Core.PageReference(423),
                                    selector, EPiServer.Security.AccessLevel.Read);

but i am getting this exception: "The type initializer for 'EPiServer.Security.PrincipalInfo' threw an exception."

Is there is still problem with my authentication setting or this exception is related to some other issue?

#55211
Edited, Nov 22, 2011 18:12
Vote:
 

Take a look at this post where Allan shows how to output the PageData as JSON (and other formats): http://labs.episerver.com/en/Blogs/Allan/Dates/2010/6/Codemania-Partner-Summit-2010/. Might be easier to work against from a client application.

Hope this helps.

Frederik

#55212
Nov 22, 2011 19:41
Vote:
 

Did you do the troubleshooting step by checking that you get a login prompt when going to the webservice in the browser?

Try using the method ValidateWebServiceAccess() to see if the user you're using do have necessary access. Did you set the user (NetworkCredentials) in the code before making the call?

Could you post the stack trace you receive? 

#55218
Nov 23, 2011 9:06
Vote:
 

Yes, When I browse the webservice (http://[MYDOMAIN]/WebServices/PageStoreService.asmx), there is no login prompt for it. It showed me the page with all methods PageStoreService Webservice has. 

When I tried to put following code in web.config of episerver to enable basic authentication.

<httpModules>
    <add 
        name="BasicAuthentication" 
        type="EPiServer.Security.BasicAuthentication, EPiServer" />

it gives me this error:

500 - Internal server error.

For NetworkCredential, When i tried to create object for NetworkCredential, I am unable to do this. I is not showing me Credentials object. like I am unable to do following (code in bold):

PageStoreService pageContent = new PageStoreService();
        pageContent.Credentials = new NetworkCredential("xxx", "xxx");

 And When I tried to use ValidateWebServiceAccess(), it gives me the same error.  Stack trace is:

[NullReferenceException: Object reference not set to an instance of an object.]
EPiServer.Configuration.Settings.get_Instance() +37
EPiServer.UriSupport.get_InternalUIUrl() +45
EPiServer.UriSupport.get_UIUrl() +45
EPiServer.UriSupport.ResolveUrlFromUIBySettings(String path) +34
EPiServer.Security.PrincipalInfo..cctor() +115

[TypeInitializationException: The type initializer for 'EPiServer.Security.PrincipalInfo' threw an exception.]
EPiServer.Security.PrincipalInfo.get_Current() +0
EPiServer.WebServices.DataFactoryService.ValidateWebServiceAccess() +30
GetPageContents.ProcessRequest(HttpContext context) in m:\Programs\GatwickGetContent\GetPageContents.ashx:20
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +181
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +75

 

#55233
Edited, Nov 23, 2011 13:49
Vote:
 

The code looks OK, why can't you create the NetworkCredential object?

#55240
Nov 23, 2011 15:28
Vote:
 

Maybe a stupid question. But why can't you develop new EPiServer templates instead and host them in the same application?

#55390
Dec 01, 2011 1:05
Vote:
 

I am not able to get the page contents using webservice.

Actually I was not able to access the application code. Now i am able to access clients application. I created an template in it and got the page contents now in XML format.

Thanks all for your help.

 

#57196
Mar 01, 2012 16:05
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.