dataFactoryService.GetDefaultPageData()

Vote:
 

I'm trying to use the DataFactory Webservice from a Windows Forms Application to create a new page in EPiServer. I can connect to the Web service of my EPiServer website alright but when I call dataFactoryService.GetDefaultPageData(startPage, pageTypeID) I get the following error:

System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> System.ArgumentNullException: Value cannot be null.\nParameter name: key\n   at System.ThrowHelper.ThrowArgumentNullException(ExceptionArgument argument)\n   at System.Collections.Generic.Dictionary`2.FindEntry(TKey key)\n   at System.Collections.Generic.Dictionary`2.get_Item(TKey key)\n   at EPiServer.WebServices.DataFactoryService.GetDefaultPageData(PageReference pageLink, Int32 pageTypeID)

This is the code I'm using that causes the error:

DataFactoryService dataFactoryService = new DataFactoryService();

dataFactoryService.Credentials = new NetworkCredential("EPiWebServiceUser", "Password1");

dataFactoryService.PreAuthenticate = true;

PageReference startPage = new PageReference();
startPage.ID = 3;

RawPage newPage = dataFactoryService.GetDefaultPageData(startPage, 16);

Does anyone know why this is happening?

 

#22671
Aug 12, 2008 6:53
Vote:
 

With some help from a friend at work I foundf the answer.
It appears the null exception was being thrown because I didn't specify a RemoteSite. I also need to setup a remote site in Admin for this to work as well.

startPage.RemoteSite = "ES51";

#22712
Aug 12, 2008 23:49
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.