cancel
Showing results for 
Search instead for 
Did you mean: 

[SOLVED] Webform - Webscript Dynamic Include

parrym
Champ in-the-making
Champ in-the-making
I am trying to include a webscript in my webform as suggested here: http://wiki.alfresco.com/wiki/Forms_Authoring_Guide#Using_dynamic_types_in_schemas

But keep getting this error. I have deduced that the web form is finding my web script as it gives a different error if I change to an incorrect path in the include but have no idea what this is supposed to mean:
org.alfresco.web.forms.FormProcessor$ProcessingException: org.alfresco.web.forms.xforms.FormBuilderException: errors parsing schema: at line 23 column 10: A DOCTYPE is not allowed in content. at line -1 column -1: A DOCTYPE is not allowed in content.

For reference

HelloUser.get.desc.xml
<webscript>
   <shortname>Hello User Test</shortname>
   <description>My First Webscript - Test to say hello user where user is provided</description>
   <url format="xml" template="/schema/hello"/>
   <format default="xml">extension</format>
   <authentication>user</authentication>
   <transaction>required</transaction>
</webscript>

HelloUser.get.xml.ftl and HelloUser.get.xml.ftl
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
   xmlns:po="http://solutions.xx-xxxxxx.com/alfresco/po"
   xmlns:alf="http://www.alfresco.org"
   targetNamespace="http://solutions.xx-xxxxxx.com/alfresco/po"
   elementFormDefault="qualified">
<xs:complexType>
   <xs:sequence>
      <xs:element name="short_title" type="xs:normalizedString">
         <xs:annotation>
            <xs:appinfo>
               <alf:label>Hello (It's a test i'n'it)</alf:label>
               <alf:alert>Hello</alf:alert>
            </xs:appinfo>
         </xs:annotation>
      </xs:element>
   </xs:sequence>
</xs:complexType>
</xs:schema>

hello.xsd
<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
   xmlns:po="http://solutions.xx-xxxxxx.com/alfresco/po"
   xmlns:alf="http://www.alfresco.org"
   targetNamespace="http://solutions.xx-xxxxxx.com/alfresco/po"
   elementFormDefault="qualified">
   <!– Imports –>
   <xs:include schemaLocation="webscript://rc/schema/hello?storeid={storeid}" />
   <xs:element name="portal">
      <xs:complexType>
         <xs:sequence>
         <xs:element name="title" type="xs:normalizedString">
               <xs:annotation>
                  <xs:appinfo>
                     <alf:label>Title</alf:label>
                     <alf:alert>Title</alf:alert>
                  </xs:appinfo>
               </xs:annotation>
            </xs:element>
         </xs:sequence>
      </xs:complexType>
   </xs:element>
</xs:schema>

Help, if any, is much appreciated. Even a working example of including a webscript in a webform would be nice.

[Running Alfresco Labs 3 Preview 2 on a linux server]
7 REPLIES 7

parrym
Champ in-the-making
Champ in-the-making
Not sure if this will help but here is the server log for a similar example as shown above:

12:28:24,221 ERROR [org.alfresco.web.forms.xforms.XFormsProcessor] org.alfresco.web.forms.xforms.FormBuilderException: errors parsing schema:
at line 23 column 10: A DOCTYPE is not allowed in content.
at line -1 column -1: A DOCTYPE is not allowed in content.

12:28:24,235 ERROR [org.alfresco.web.ui.common.Utils] org.alfresco.web.forms.xforms.FormBuilderException: errors parsing schema:
at line 23 column 10: A DOCTYPE is not allowed in content.
at line -1 column -1: A DOCTYPE is not allowed in content.

org.alfresco.web.forms.FormProcessor$ProcessingException: org.alfresco.web.forms.xforms.FormBuilderException: errors parsing schema:
at line 23 column 10: A DOCTYPE is not allowed in content.
at line -1 column -1: A DOCTYPE is not allowed in content.

   at org.alfresco.web.forms.xforms.XFormsProcessor.process(XFormsProcessor.java:151)
   at org.alfresco.web.forms.xforms.XFormsProcessor.process(XFormsProcessor.java:127)
   at org.alfresco.web.ui.wcm.component.UIFormProcessor.encodeBegin(UIFormProcessor.java:123)
   at javax.faces.webapp.UIComponentTag.encodeBegin(UIComponentTag.java:467)
   at javax.faces.webapp.UIComponentTag.doStartTag(UIComponentTag.java:320)
   at org.apache.jsp.jsp.wcm.create_002dweb_002dcontent_002dwizard.create_002dxml_jsp._jspx_meth_wcm_005fformProcessor_005f0(create_002dxml_jsp.java:107)
   at org.apache.jsp.jsp.wcm.create_002dweb_002dcontent_002dwizard.create_002dxml_jsp._jspService(create_002dxml_jsp.java:75)
   at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
   at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)
   at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
   at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
   at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:630)
   at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:535)
   at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:472)
   at org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary.java:968)
   at org.apache.jsp.jsp.wizard.container_jsp._jspService(container_jsp.java:548)
   at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
   at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)
   at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
   at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
   at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:630)
   at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:436)
   at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:374)
   at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:302)
   at org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatch(ServletExternalContextImpl.java:419)
   at org.apache.myfaces.application.jsp.JspViewHandlerImpl.renderView(JspViewHandlerImpl.java:211)
   at org.apache.myfaces.lifecycle.RenderResponseExecutor.execute(RenderResponseExecutor.java:41)
   at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:132)
   at javax.faces.webapp.FacesServlet.service(FacesServlet.java:140)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
   at org.alfresco.web.app.servlet.AuthenticationFilter.doFilter(AuthenticationFilter.java:110)
   at sun.reflect.GeneratedMethodAccessor591.invoke(Unknown Source)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:597)
   at org.alfresco.repo.management.subsystems.ChainingSubsystemProxyFactory$1.invoke(ChainingSubsystemProxyFactory.java:122)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
   at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
   at $Proxy192.doFilter(Unknown Source)
   at org.alfresco.repo.web.filter.beans.BeanProxyFilter.doFilter(BeanProxyFilter.java:88)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
   at org.alfresco.repo.web.filter.beans.NullFilter.doFilter(NullFilter.java:74)
   at sun.reflect.GeneratedMethodAccessor591.invoke(Unknown Source)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:597)
   at org.alfresco.repo.management.subsystems.ChainingSubsystemProxyFactory$1.invoke(ChainingSubsystemProxyFactory.java:122)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
   at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
   at $Proxy192.doFilter(Unknown Source)
   at org.alfresco.repo.web.filter.beans.BeanProxyFilter.doFilter(BeanProxyFilter.java:88)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
   at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
   at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
   at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
   at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
   at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
   at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
   at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)
   at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
   at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
   at java.lang.Thread.run(Thread.java:619)
Caused by: org.alfresco.web.forms.xforms.FormBuilderException: errors parsing schema:
at line 23 column 10: A DOCTYPE is not allowed in content.
at line -1 column -1: A DOCTYPE is not allowed in content.

   at org.alfresco.web.forms.xforms.SchemaUtil.parseSchema(SchemaUtil.java:265)
   at org.alfresco.web.forms.xforms.Schema2XForms.buildXForm(Schema2XForms.java:148)
   at org.alfresco.web.forms.xforms.XFormsBean.getXFormsDocument(XFormsBean.java:769)
   at org.alfresco.web.forms.xforms.XFormsBean.setXFormsSession(XFormsBean.java:229)
   at org.alfresco.web.forms.xforms.XFormsProcessor.process(XFormsProcessor.java:146)
   … 70 more

parrym
Champ in-the-making
Champ in-the-making
Still can't get it working. I followed the steps here: https://issues.alfresco.com/jira/browse/ETWOTWO-926, namely:

1. We add new property (<prop key="xsd">text/xml</prop>) into "web-scripts-application-context.xml" file
2. Restart Alfresco Server
3. Took files from "WebFormImportingWebScriptTestCase_v2.zip" archive, add all three web script's file into Company Home>Data Dictionary>Web Scripts>org>alfresco>sample space
4. Reload web scripts
5. Create web form based on xsd from archive.
6. Create web project and include created web form into it.

However when I try and use the web form I get this error:

org.alfresco.web.forms.FormProcessor$ProcessingException: org.alfresco.web.forms.xforms.FormBuilderException: errors parsing schema: at line 23 column 10: A DOCTYPE is not allowed in content. at line -1 column -1: A DOCTYPE is not allowed in content.

As usual I have no idea what the error means and am therefore left with nowhere to start.

I may try using an older version of alfresco (Alfresco 2.2 sp4 if i can find it) and let everyone know what I find.

Until then if anyone can tell me why I get this error it would be much appreciated.

parrym
Champ in-the-making
Champ in-the-making
Tried the same as above with the files from ETWOTWO-926 and this time Alfresco v 3.0.0 (Stable 1526) schema 1002 and got the following error:

org.alfresco.web.forms.FormProcessor$ProcessingException: org.alfresco.web.forms.xforms.FormBuilderException: errors parsing schema: at line -1 column -1: A DOCTYPE is not allowed in content. at line 19 column 10: A DOCTYPE is not allowed in content.

parrym
Champ in-the-making
Champ in-the-making
Update: I still haven't been able to include my own webscript but thanks to Peter Monks Blog Article http://blogs.alfresco.com/wp/pmonks/2009/07/07/including-a-static-xsd-in-a-web-form/ I have managed to include a static xsd file using the alfresco built in webscript /api/path/content{property}/{store_type}/{store_id}/{path}?a={attach?} so I feel I am getting closer.

parrym
Champ in-the-making
Champ in-the-making
I'm not sure what the error was but after re-working my files based on pmonks blog entry and removing the javascript file from the webscript and changing storeid={storeid} to ticket={ticket} the dynamic include of a webscript worked!!

pmonks
Star Contributor
Star Contributor
Glad to hear you got it working!

The likely reason it didn't work before is that without the ticket={ticket} parameter the Web Script will be executed without any user credentials.  Due to the bug described at https://issues.alfresco.com/jira/browse/ETHREEOH-1945 this will result in the Web Script failing, and therefore the include will also fail.

Unfortunately the XML Schema specification doesn't treat failed includes / imports as a fatal error, so the Web Form's XSD file will continue being processed until it hits an element defined in the included file, at which point it will fail.  This results in exceedingly unclear error messages, since the reported error is for an element that is typically quite some distance away from the root cause (the failed include / import statement).

The upshot is that as documented at http://wiki.alfresco.com/wiki/Forms_Authoring_Guide#Using_dynamic_types_in_schemas, it is highly recommended that the ticket={ticket} parameter always be included in the URI for a Web Script include.

Cheers,
Peter

vesuinfo
Champ in-the-making
Champ in-the-making
Hi parrym,

I am trying the same thing, trying to include webscript with webforms but i am getting error message,
I have raised seperate issue for the same in forums,
Link : http://forums.alfresco.com/en/viewtopic.php?f=29&t=20881
please help me to resolve this issue.

Thanks,
Saravanan.