Characters inserted into XML returned by my web service

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Characters inserted into XML returned by my web service

Henrik Pettersen
All,

I'm having a small problem with returning XML from my pipeline definition. The returned XML seems to have some data inserted into it ('true' and '404' before my root element, marked bold):

<?xml version="1.0" encoding="utf-8"?>true
404
<io>
    <article source="smith" sourceid="$id" type="tmglstory">
    <section name="travel"/>
    <field name="headline">Baglioni Hotel</field>
    ...snip...
</io>

I've also been trying to debug this using ' debug="..." ' in my XPL file, but I'm unable to generate any log output (I'm checking ops.log and catalina.out. Please find my Log4J config attached). What's the trick to finding the debug output from my XPL debug directive? I must be missing something basic...

Here is my page-flow.xml:

<config xmlns="http://www.orbeon.com/oxf/controller">
    <page path-info="/smith/" view="smith.xpl"/>
    <epilogue url="oxf:/config/epilogue.xpl"/>
</config>

Note that ' view="smith.xpl" ', as we are returning some XML here (using 'model=' instead of 'view=', allows you to have no output param defined in your XPL).

And here is my pipeline definition:

<p:config xmlns:p="http://www.orbeon.com/oxf/pipeline"
    xmlns:oxf="http://www.orbeon.com/oxf/processors"
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:xforms="http://www.w3.org/2002/xforms">

    <!-- p:param name="instance" type="input"/ -->
    <p:param name="data" type="output"/>

    <!-- Read in the stylesheet definition -->
    <p:processor name="oxf:url-generator">
        <p:input name="config">
            <config>
                <url>transform.xsl</url>
                <content-type>text/xml</content-type>
                <validating>false</validating>
                <handle-xinclude>false</handle-xinclude>
            </config>
        </p:input>
        <p:output name="data" id="firstXslt" />
    </p:processor>  
   
    <!-- Read in the source XML -->
    <p:processor name="oxf:url-generator">
        <p:input name="config">
            <config>
                <url>smith.hotels.xml</url>
                <content-type>text/xml</content-type>
                <validating>false</validating>
                <handle-xinclude>false</handle-xinclude>
            </config>
        </p:input>
        <p:output name="data" id="smithXml" />
    </p:processor>    
   
    <!-- Create the Escenic format: Apply the stylesheet to the source xml  -->
    <p:processor name="oxf:xslt">
        <p:input name="data" href="#smithXml" />
        <p:input name="config" href="#firstXslt" />
        <p:output name="data" id="escenicXml" />
    </p:processor>

   
    <!-- Wired off, just send the transformed XML back to the client for now (using the identity processor below) -->
    <!-- Call the REST webservice -->
    <!--p:processor name="oxf:xforms-submission">
        <p:input name="submission">
            <xforms:submission method="put" action="http://localhost:8080/timmy/import"/>
        </p:input>
        <p:input name="request" href="#escenicXml" debug="escenicXml"/>
        <p:output name="response" ref="data" debug="response"/>
    </p:processor-->
  
   <!-- Just return the transformed XML to the user for now.
        Once we get this right, will send it to the webservice instead (see above) -->
    <p:processor name="oxf:identity">
        <p:input name="data" href="#escenicXml"/>
        <p:output name="data" ref="data"/>
    </p:processor>   

</p:config>

Please find a reproducible example attached. My system configuration:
- Apache Tomcat 5.5.26
- java version "1.5.0_13"
- orbeon-3.6.0.200806260137 nightly build
- OS X 10.4.11

Perhaps the problem lies with running the returned XML through 'oxf:/config/epilogue.xpl' ? I'm not sure. Has anyone else out there been able to configure Orbeon to return plain XML?

Any help would be very much appreciated. Many thanks!

Henrik


--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws

log4j.xml (7K) Download Attachment
smith.zip (530K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Characters inserted into XML returned by my web service

Alessandro Vernet
Administrator
Henrik,

On Fri, Aug 15, 2008 at 8:48 AM, Henrik Pettersen
<[hidden email]> wrote:
> I'm having a small problem with returning XML from my pipeline definition.
> The returned XML seems to have some data inserted into it ('true' and '404'
> before my root element, marked bold):
>
> <?xml version="1.0" encoding="utf-8"?>true
> 404 [...]

This happens because in transform.xsl you are matching on
/response/data/items. For whatever nodes come before or after that,
XSLT performs the default processing, which is to copy text nodes.
Adding the following template should solve this:

    <xsl:template match="/">
        <xsl:apply-templates select="/response/data/items"/>
    </xsl:template>

> I've also been trying to debug this using ' debug="..." ' in my XPL file,
> but I'm unable to generate any log output (I'm checking ops.log and
> catalina.out. Please find my Log4J config attached). What's the trick to
> finding the debug output from my XPL debug directive?

I think the problem is that you are in "warn" mode, and the debug
processor logs in "info" mode. So just try to replace (towards the end
of you log4j.xml) <priority value="warn"/> with <priority
value="info"/>.

Alex
--
Orbeon Forms - Web 2.0 Forms, open-source, for the Enterprise
Orbeon's Blog: http://www.orbeon.com/blog/
Personal Blog: http://avernet.blogspot.com/
Twitter - http://twitter.com/avernet


--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Re: Characters inserted into XML returned by my web service

Henrik Pettersen
Thanks, Alex!

You were spot on for both issues. Many thanks!

Henrik

On Tue, Aug 19, 2008 at 11:14 PM, Alessandro Vernet <[hidden email]> wrote:
Henrik,

On Fri, Aug 15, 2008 at 8:48 AM, Henrik Pettersen
<[hidden email]> wrote:
> I'm having a small problem with returning XML from my pipeline definition.
> The returned XML seems to have some data inserted into it ('true' and '404'
> before my root element, marked bold):
>
> <?xml version="1.0" encoding="utf-8"?>true
> 404 [...]

This happens because in transform.xsl you are matching on
/response/data/items. For whatever nodes come before or after that,
XSLT performs the default processing, which is to copy text nodes.
Adding the following template should solve this:

   <xsl:template match="/">
       <xsl:apply-templates select="/response/data/items"/>
   </xsl:template>

> I've also been trying to debug this using ' debug="..." ' in my XPL file,
> but I'm unable to generate any log output (I'm checking ops.log and
> catalina.out. Please find my Log4J config attached). What's the trick to
> finding the debug output from my XPL debug directive?

I think the problem is that you are in "warn" mode, and the debug
processor logs in "info" mode. So just try to replace (towards the end
of you log4j.xml) <priority value="warn"/> with <priority
value="info"/>.

Alex
--
Orbeon Forms - Web 2.0 Forms, open-source, for the Enterprise
Orbeon's Blog: http://www.orbeon.com/blog/
Personal Blog: http://avernet.blogspot.com/
Twitter - http://twitter.com/avernet


--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws




--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws