Word to EPiServer: PageService.asmx invocation error


I have chased an error logged during the Word-to-EPiServer process run against a customised episerver.word.wsc script.  The error: 

Failed to contact EPiServer CMS, make sure the URL is valid and you are authorized to perform this action.

I noted other reports of the error across various blogs and forum and share the solution I found in the hope that it might help others.

Fredrik Haglund has a helpful post about Office Integration but unfortunately the most promising tip of ensuring annonymous access to the manage/cms/officeintegration area of the site did not fix my problem.

We have customised the episerver.word.wsc script to utilise a better word-to-HTML conversion prior to upload. It seems that [perhaps] as a result of upgrading from CMS5 to 6 this process became broken and I struggled to get past the somewhat unhelpful PageService.asmx error.

When debugging I found that the shipped script and the customised script both managed to reach the page-create and content-upload part of process. However, the custom version failed at the page-commit stage. The solution was that our Word-to-HTML conversion produced an HTML fragment, rather than a full HTML page. Once the converted content was wrapped in a 'full' HTML document the customised process also completed successfully.

Perhaps the webservices have been updated to parse the uploaded data to ensure it conforms to expected web content.

Therefore, be sure to ensure any custom conversion provides a full web document for upload.

Dec 21, 2011 2:40
* 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.