webMethods

webMethods

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
  • 1.  Avoid resolve dtd Reference

    Posted Mon October 17, 2005 11:23 AM

    Hi! I’ve some little problems with Tamino Api4J.
    Simple code:

    
    public class inoTest{
    
    protected TXMLObjectModel model = TDOMObjectModel.getInstance();
    
    public static void main(String[] args) throws TException, IOException {
    TXMLObject xml = TXMLObject.newInstance(model);
    File f= new File("prop.xml");
    FileInputStream fin = new FileInputStream(f);
    xml.readFrom(fin);
    fin.close();
    xml.writeTo(System.out);
    }
    }

    prop.xml contains:

    
    <?xml version="1.0" encoding="UTF-8"?>
    
    <!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> 
    
    <properties>
    <entry key="key">value</entry>
    </properties>

    For the record:

    
    Exception in thread "main" com.softwareag.tamino.db.api.io.TStreamReadException( message: Problems during parsing input stream and building DOM document., tag: JavaTaminoAPI_4_2_0_53, java: 1.5.0_04, os: Windows XP 5.1 ):
    
    at com.softwareag.tamino.db.api.objectModel.dom.TDOMAdapter.internalReadFrom(Unknown Source)
    at com.softwareag.tamino.db.api.objectModel.dom.TDOMAdapter.readFrom(Unknown Source)
    at com.softwareag.tamino.db.api.objectModel.dom.TDOMAdapter.readFrom(Unknown Source)
    at inoTest.main(inoTest.java:10)
    Caused by: java.net.ConnectException: Connection timed out: connect
    at java.net.PlainSocketImpl.socketConnect(Native Method)
    at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
    at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
    at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
    at java.net.Socket.connect(Socket.java:507)
    at java.net.Socket.connect(Socket.java:457)
    at sun.net.NetworkClient.doConnect(NetworkClient.java:157)
    at sun.net.www.http.HttpClient.openServer(HttpClient.java:365)
    at sun.net.www.http.HttpClient.openServer(HttpClient.java:477)
    at sun.net.www.http.HttpClient.<init>(HttpClient.java:214)
    at sun.net.www.http.HttpClient.New(HttpClient.java:287)
    at sun.net.www.http.HttpClient.New(HttpClient.java:299)
    at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:792)
    at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:744)
    at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:669)
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:913)
    at java.net.URL.openStream(URL.java:1007)
    at org.apache.xerces.impl.XMLEntityManager.setupCurrentEntity(Unknown Source)
    at org.apache.xerces.impl.XMLEntityManager.startEntity(Unknown Source)
    at org.apache.xerces.impl.XMLEntityManager.startDTDEntity(Unknown Source)
    at org.apache.xerces.impl.XMLDTDScannerImpl.setInputSource(Unknown Source)
    at org.apache.xerces.impl.XMLDocumentScannerImpl$DTDDispatcher.dispatch(Unknown Source)
    at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
    at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
    at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown Source)
    at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
    at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)
    at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source)
    at com.softwareag.tamino.db.api.objectModel.dom.TDOMReader.read(Unknown Source)
    at com.softwareag.tamino.db.api.objectModel.dom.TDOMReader.read(Unknown Source)
    at com.softwareag.tamino.db.api.objectModel.dom.TDOMReader.read(Unknown Source)
    ... 4 more
    Java Result: 1

    I understand that the parser tries to resolve the DTD reference. Since I have no Internet connection in my computer, this takes me to an error. It’s imposible to me to change that XML, it’s the Java XML for Properties, generated with Properties.storeToXML().
    Any suggestion?
    Thanks
    PD: I’ve also tried the other three XMLModels. SAX, JDOM, Stream


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


  • 2.  RE: Avoid resolve dtd Reference

    Posted Fri October 21, 2005 04:55 PM

    Hello,
    You can set a preference to turn off DTD resolution. You need a new line of code, which needs to be inserted before you try to create your new TXMLObject:

    TPreference.getInstance().setUseApacheLoadExternalDTD( false );

    The TPreference class is in package “com.softwareag.tamino.db.API.common” in TaminoAPI4J.jar.

    Hope this helps.


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


  • 3.  RE: Avoid resolve dtd Reference

    Posted Fri October 21, 2005 05:21 PM

    Thank you for the package reference. I don’t know why, but the class is not in the Javadoc included my installation.
    That remebers me that also the Interface TInputStreamCloseListener is not in the Javadoc.
    How do you build the Javadoc? There are some holes.


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


  • 4.  RE: Avoid resolve dtd Reference

    Posted Wed March 30, 2011 09:52 AM

    Hi,

    We are facing the same problem.

    When we turn off the DTD resolution, the DTD declaration line from the XML document which is inserted is not seen in the document present in database.

    Modifying the document mayn’t be accepted in some scenarios…

    Is there any other way to resolve this?

    Regards,
    Aravind


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