IBM webMethods Hybrid Integration

IBM webMethods Hybrid Integration

Join this online group to communicate across IBM product users and experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.

 View Only
Expand all | Collapse all

jsp and xquery exception help

  • 1.  jsp and xquery exception help

    Posted Tue May 02, 2006 08:44 PM

    I am passing a query into Tamino through a jsp page and can not get rid of a exception. The xquery works fine when I try it in the Tamino Xquery tool.

    It is querying a collection called Graphics which has two instances in there:

    <?xml version="1.0" encoding="utf-8"?>
    <graphic id="X4220EB00020000P00.L010003" xmlns:ino="http://namespaces.softwareag.com/tamino/response2">
    <system id="42" title="Example system">
    <subsystem id="24" title="example subsystem">
    <task id="J-15HA---4829940482" title="901-266-551-101 PROOF LOAD TEST SPONSON FUEL CELLS SLING ASSEMBLY TASK REQUIREMENTS">
    <useableon>
    <uoc>17492</uoc>
    <uoc>175433</uoc>
    </useableon>
    <step num="1">
    <useableon>
    <uoc>17492</uoc>
    </useableon>
    </step>
    <step num="2">
    <useableon>
    <uoc>17492</uoc>
    </useableon>
    </step>
    </task>
    </subsystem>
    </system>
    <descriptivename>Example Descriptive Name</descriptivename>
    <versions>
    <datetime date="2005-10-23" time="T17:40:14" uri="http://phl-file-01/graphics/X4220EB00010000P00.L010003.cgm"/>
    <datetime date="2005-11-23" time="T17:40:14" uri="http://phl-file-01/graphics/X4220EB00010000P00.L010003.cgm"/>
    <datetime date="2005-10-23" time="T17:40:14" uri="http://phl-file-01/graphics/X4220EB00010000P00.L010003.cgm"/>
    </versions>
    <hotspots>
    <hotspot>X4220EB00010000P00.L010003</hotspot>
    </hotspots>
    <type>PUB</type>
    <format>CGM</format>
    </graphic>
    <?xml version="1.0" encoding="utf-8"?>
    <graphic id="X4220EB00010000P00.L010003" xmlns:ino="http://namespaces.softwareag.com/tamino/response2">
    <system id="15" title="Example system">
    <subsystem id="HA" title="example subsystem">
    <task id="J-15HA---4829940482" title="901-266-551-101 PROOF LOAD TEST SPONSON FUEL CELLS SLING ASSEMBLY TASK REQUIREMENTS">
    <useableon>
    <uoc>16492</uoc>
    <uoc>165433</uoc>
    </useableon>
    <step num="1">
    <useableon>
    <uoc>16492</uoc>
    </useableon>
    </step>
    <step num="2">
    <useableon>
    <uoc>16492</uoc>
    </useableon>
    </step>
    </task>
    </subsystem>
    </system>
    <descriptivename>Example Descriptive Name</descriptivename>
    <versions>
    <datetime date="2005-10-23" time="T17:40:14" uri="http://phl-file-01/graphics/X4220EB00010000P00.L010003.cgm"/>
    <datetime date="2005-11-23" time="T17:40:14" uri="http://phl-file-01/graphics/X4220EB00010000P00.L010003.cgm"/>
    <datetime date="2005-10-23" time="T17:40:14" uri="http://phl-file-01/graphics/X4220EB00010000P00.L010003.cgm"/>
    </versions>
    <hotspots/>
    <type>PUB</type>
    <format>JPEG</format>
    </graphic>

    this is the code I am calling the xquery with:

    String DATABASE_URI = "http://---.---.---.---/tamino/CDDE";
    
    TConnection connection = TConnectionFactory.getInstance().newConnection( DATABASE_URI );
    TXMLObjectAccessor xmlObjectAccessor = connection.newXMLObjectAccessor(TAccessLocation.newInstance( "Graphics" ),TDOMObjectModel.getInstance() );
    StringBuffer queryBuffer = new StringBuffer();
    
    queryBuffer.append("for $x in input()/graphic");
    queryBuffer.append("return <option value={data($x/system/@id)}>{data($x/system/@id)}</option>");
    
    TXQuery query  = TXQuery.newInstance( queryBuffer.toString() );
    
    try {
    TResponse myResponse = xmlObjectAccessor.xquery( query);
    TXMLObject xmlObject = myResponse.getFirstXMLObject();
    out.println("<?xml version=\"1.0\"?>");
    xmlObject.writeTo(out);
    }
    catch (TXQueryException queryException) {
    response.setContentType("text/html");
    if ( queryException.hasAccessFailureException() )
    out.println( "<H3>" + queryException.getAccessFailureException() + "</H3>");
    else
    out.println( "<H3>" + queryException.getRootCause().getMessage() + "</H3>" );
    }
    connection.close();

    anybody have any ideas? This is my first time really trying java, xml, xquery, tamino all at once.


    #API-Management
    #webMethods-Tamino-XML-Server-APIs
    #webMethods


  • 2.  RE: jsp and xquery exception help

    Posted Wed May 03, 2006 11:21 AM

    Hi

    Please make sure that your query is formatted with spaces wherever necessary. As i look into your query, there is no space between “input()/graphic” and “return…” which also results in the reported exception.

    Hope this helps in solving you problem.

    Let us know if you need more information.

    Thanks & Regards,
    Srinu


    #API-Management
    #webMethods
    #webMethods-Tamino-XML-Server-APIs