Don't miss out Virtual Happy Hour this Friday (April 26).

Try our conversational search powered by Generative AI!

Use of EPiServer.WebServices

Vote:
 
Hi. Can anyone tell me if I'm doing this right? I can't seem to find any doc's on this. I've tried the few FAQ's, but they seem to be somewhat out of date... private void GetData() { EPiServer.WebServices.RemoteSite site = new EPiServer.WebServices.RemoteSite(); site.UserName = "webserviceuser"; site.Password = "webservicepassword; site.Name = "Test"; site.Url = "http://www.remotesite.com/WebServices/DataFactoryService.asmx"; EPiServer.WebServices.SignatureHeader header = new EPiServer.WebServices.SignatureHeader(); header.RemoteSite = "Test"; EPiServer.WebServices.DataFactoryService factory = new EPiServer.WebServices.DataFactoryService(); factory.Signature = header; PageReference pageRef = new PageReference(3, "Test"); RawPage[] children = factory.GetChildren(pageRef); Response.Write(children.Length); } I've already created my own proxy class against the datafactory web service on the remote site, but it's QUITE a job to handle the return values, since the returned data isn't the same classes. For example, when retrieving a page through the EPiServer.WebServices.DataFactoryService, it comes back as a EPiServer.Core.RawPage. But when I create my own proxy, it comes back as MyWSProxy.DataFactoryService.RawPage, and these two don't mix. I have successfully converted from my version to EPiServer's version, but it's not the preferred way... Hope someone can help me. Frank :(
#12392
Oct 10, 2005 22:32
Vote:
 
I've never tried but I have the impression that you can use your PageReference with the RemoteSiteName directly on EPiServer.Global.EPDataFactory.GetChildren. Of cource you have to set upp the communication first. Let me know if it works. /Håkan
#14186
Oct 11, 2005 9:30
Vote:
 
I tested with this: PageDataCollection pages = Global.EPDataFactory.GetChildren(new PageReference(3, "RemoteSiteName")); But it results in this error: "09/23/2005 12:22:05" er en ugyldig verdi for "EPiServer.Core.PropertyDate". I learned while creating my own web service, and in doing that, had to convert all the page properties from my web services' RawPage to EPiServer.Core.RawPage. While doing this, I ran into this error, and I had to set the Date properties (like PageCreated) to f.ex. DateTime.Now or EPiServer.PropertyDate.MaxValue. I might add that the remote site is multi lingual, while the local one is not. Could this be a bug? Anyone @ EP want to comment on this? Frank
#14187
Oct 12, 2005 15:36
Vote:
 
I've seen this problem serveral times. And I've tried to explain to EP that it's most likely a bug. By tweaking the EPiServer default language and regional settings I managed to get it working once (was a proof of concept site which fetched data from one EPiServer site and displayed on another). Seems the EPiServer WebServices are very sensitive to the DataTime format. Both date format and the EPsLanguage setting need to be the same on both servers I think. Also look at the EPnLocale setting in Web.Config. I cant entierly remember what I had to do in order to get it working. I think using english-US worked, but norwegian did not.
#14188
Oct 13, 2005 8:15
Vote:
 
Oh there is even an easier method to test this. If you enable act as front end and allow name in URL (in the remote web site settings in admin-mode). If you have two EPiServers (epi1 and epi2) you can do somethink like this: This makes epi1 fetch pagedata from epi2 via WebServices: http://epi1/templates/page.aspx?id=30__epi2 And to test communication in the other direction: http://epi2/templates/page.aspx?id=30__epi1
#14189
Oct 13, 2005 8:19
Vote:
 
I tested a bit more on the DateTime problem. Both sites have NO set as default language, and both has 1053 set as locale. The sites are on the same machine, hence the same regional setting. The page on the remote site has a date set (created, changed, saved or something) set to 13.10.2005 21:20 but it returns the date on this format: 10/13/2005 21:20 The receiving site tries to interpret this as 10 as the day and 13 as the month. I tested on returning some child pages that all had the date set to something that would validate both ways (09.06.2005 which is being interpreted as 06/09/2005, hence September 6th), and it worked fine. I tried changing one of the pages, and it returned error: InvalidPropertyValueException: "10/13/2005 21:22:34" er en ugyldig verdi for "EPiServer.Core.PropertyDate".] Here's the stack trace: [FormatException: String was not recognized as a valid DateTime.] System.DateTimeParse.GetDayOfNNY(DateTimeResult result, DateTimeRawInfo raw, DateTimeFormatInfo dtfi) +202 System.DateTimeParse.ProcessTerminaltState(Int32 dps, DateTimeResult result, DateTimeRawInfo raw, DateTimeFormatInfo dtfi) +142 System.DateTimeParse.Parse(String s, DateTimeFormatInfo dtfi, DateTimeStyles styles) +488 System.DateTime.Parse(String s, IFormatProvider provider, DateTimeStyles styles) +30 System.DateTime.Parse(String s, IFormatProvider provider) +11 System.DateTime.Parse(String s) +7 System.Convert.ToDateTime(String value) +46 EPiServer.Core.PropertyDate.Parse(String str) [InvalidPropertyValueException: "10/13/2005 21:22:34" er en ugyldig verdi for "EPiServer.Core.PropertyDate".] EPiServer.Core.PropertyDate.Parse(String str) EPiServer.Core.PropertyDate.ParseToSelf(String str) EPiServer.Core.PropertyData.CreatePropertyDataObject(RawProperty rawProp) EPiServer.Core.PropertyDataCollection..ctor(RawProperty[] properties) EPiServer.Core.PageData..ctor(RawPage page) EPiServer.Core.PageDataCollection..ctor(RawPage[] rawPages) EPiServer.DataFactory.?(PageReference ) EPiServer.DataFactory.GetChildren(PageReference pageLink, AccessLevel access) +373 EPiServer.DataFactory.GetChildren(PageReference pageLink) +25 Sandvik.Templates.StandardPageWS.GetRemoteData() in c:\inetpub\babyverden\www\templates\pagews.aspx.cs:67 Sandvik.Templates.StandardPageWS.Page_Load(Object sender, EventArgs e) in c:\inetpub\babyverden\www\templates\pagews.aspx.cs:39 System.EventHandler.Invoke(Object sender, EventArgs e) +0 System.Web.UI.Control.OnLoad(EventArgs e) +67 System.Web.UI.Control.LoadRecursive() +35 System.Web.UI.Page.ProcessRequestMain() +750 Frank :)
#14190
Oct 13, 2005 21:34
Vote:
 
Hello Frank! As of EPiServer 4.41 you are able to force the locale that should be used when fetching pages from remote episerver web sites. Add the following value to your web.config file to force en-US locale for an example: ps. The problem appear if you make as call from a site with a locale currently set that is received on a site with another locale if datetime values are handled differently. You can also set the locale for your web service directory in the web service location section in web.config on the receiving site. ds.
#14191
Nov 01, 2005 11:31
* 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.