我想测试执行提交的XForms,但在我的环境中,我无法访问提交最终调用的服务,因为它们尚未开发,或者位于防火墙之后。通过一些XForms实现,我可以通过使用file:///
URL来测试我的表单是否正在发送正确的数据,但是Orbeon Forms不支持在提交时使用file:///
URL写入磁盘。我可以使用哪种其他更便携的替代品?
答案 0 :(得分:1)
如果您需要使用替换实例测试提交,则类似的echoinstance服务将使用请求实体和相同的Content-Type进行响应:
<xforms:submission id="echo-submission" method="post"
resource="http://xformstest.org/cgi-bin/echoinstance.sh"
ref="instance('data')" replace="instance"/>
请注意xformstest.org上的带宽有限,因此如果您需要在集成测试基础架构中连续使用echo或echoinstance服务部分,请在设置您自己的服务副本时寻求帮助。
答案 1 :(得分:0)
使用XForms测试套件回显服务
您可以使用XForms test suite也使用的echo服务。该echo服务返回一个HTML页面,其中包含您提交的内容的信息,这是检查您是否提交正确数据的好方法。您的提交内容如下所示,另请参阅此full example using the XForms test suite echo service。
<xforms:submission id="echo-submission" method="post"
resource="http://xformstest.org/cgi-bin/echo.sh"
ref="instance('data')" replace="all"/>
使用jsFiddle echo服务
您可以使用jsFiddle echo service for XML,这样您就可以replace="instance"
。 jsFiddle echo服务不会在POST的主体中使用XML,而是在POST中作为xml
表单编码的参数。因此,您需要首先对要发布的XML进行编码,如下面的提交内容以及此full example using the jsFiddle echo service中所述。
<xforms:submission id="echo-submission" method="post"
resource="http://jsfiddle.net/echo/xml/"
serialization="application/x-www-form-urlencoded"
ref="instance('jsfiddle-out')" replace="instance" instance="jsfiddle-in">
<xforms:setvalue ev:event="xforms-submit" ref="instance('jsfiddle-out')"
value="saxon:serialize(instance('data'), 'xml')"/>
</xforms:submission>