Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Isomorphic xml parsing error when using cURL

    Currently using smartgwt power 3.0 nb_20120828 on RHEL 5.4. I'm making a cURL post request using the parameters isc_rpc=1&isc_v=v8.2p_2012-08-28&isc_xhr=1. I also add the data parameters isc_tnum=someinteger and protocolVersion=1.0. The issue occurs for the _transaction parameter. I wanted to provide the transaction parameter as an xml file but I get the follwing error.
    Code:
      
    curl -o pai-response-1.txt --data _transaction=@pai-nobomb.xml --data "isc_tnum=1" --data "protocolVersion=1.0" http://myapp:myport/myapplication/myapplication/sc/IDACall?isc_rpc=1&isc_v=v8.2p_2012-08-28&isc_xhr=1 --header "Content-Type:application/x-www-form-urlencoded; charset=UTF-8" &
    
    
    About to connect() to myserver port myport
    *   Trying 10.21.20.20... connected
    * Connected to myserver (10.21.20.20) port myport
    > POST /myapplication/myapplication/sc/IDACall?isc_rpc=1 HTTP/1.1
    > User-Agent: curl/7.15.5 (x86_64-redhat-linux-gnu) libcurl/7.15.5 OpenSSL/0.9.8b zlib/1.2.3 libidn/0.6.5
    > Host: myserver:myport
    > Accept: */*
    > Content-Length: 59
    > Content-Type: application/x-www-form-urlencoded
    >
    > _transaction=@pai-nobom.xml&isc_tnum=17&protocolVersion=1.0HTTP/1.1 200 OK
    < Date: Thu, 14 Feb 2013 20:00:16 GMT
    < Transfer-Encoding: chunked
    < Content-Type: text/html; charset=UTF-8
    < X-Included-Test: true
    < X-Powered-By: Servlet/3.0 JSP/2.2
    <BR>com.isomorphic.servlet.IDACall top-level exception<BR>
    <PRE>
    com.isomorphic.xml.XMLParsingException: [
        "XML parser fatal error: file '(in memory stream)' line 1: org.xml.sax.SAXParseException: Content is not allowed in prolog."
    ]
           at com.isomorphic.xml.XML.parseXML(XML.java:206)
           at com.isomorphic.xml.XML.parseXML(XML.java:125)
           at com.isomorphic.xml.XML.toDSRecords(XML.java:290)
           at com.isomorphic.xml.XML.toDSRecords(XML.java:286)
           at com.isomorphic.xml.XML.toDSRecords(XML.java:278)
           at com.isomorphic.rpc.RPCManager.parseRequest(RPCManager.java:1854)
           at com.isomorphic.rpc.RPCManager.<init>(RPCManager.java:296)
           at com.isomorphic.rpc.RPCManager.<init>(RPCManager.java:281)
           at com.isomorphic.servlet.IDACall.processRequest(IDACall.java:116)
           at com.isomorphic.servlet.IDACall.doPost(IDACall.java:73)
           at javax.servlet.http.HttpServlet.service(HttpServlet.java:751)
           at com.isomorphic.servlet.BaseServlet.service(BaseServlet.java:152)
           at javax.servlet.http.HttpServlet.service(HttpServlet.java:844)
           at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:242)
           at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:216)
           at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:132)
           at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:338)
           at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:25)
           at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:74)
           at com.isomorphic.servlet.CompressionFilter.doFilter(CompressionFilter.java:246)
           at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:74)
           at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3288)
           at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3254)
           at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
           at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
           at weblogic.servlet.provider.WlsSubjectHandle.run(WlsSubjectHandle.java:57)
           at weblogic.servlet.internal.WebAppServletContext.doSecuredExecute(WebAppServletContext.java:2163)
           at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2089)
           at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2074)
           at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1513)
           at weblogic.servlet.provider.ContainerSupportProviderImpl$WlsRequestExecutor.run(ContainerSupportProviderImpl.java:254)
           at weblogic.work.ExecuteThread.execute(ExecuteThread.java:256)
           at weblogic.work.ExecuteThread.run(ExecuteThread.java:221)
    </PRE>
    * Connection #0 to host myserver left intact
    * Closing connection #0
    I removed the bom from the xml file with vi and I still get this error. However if I use the following command
    Code:
     curl -o pai-response-1.txt --data _transaction=%3Ctransaction%20xmlns%3Axsi%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2F10%2FXMLSchema-instance%22%20xsi%3Atype%3D%22xsd%3AObject%22%3E%3CtransactionNum%20xsi%3Atype%3D%22xsd%3Along%22%3E16%3C%2FtransactionNum%3E%3Coperations%20xsi%3Atype%3D%22xsd%3AList%22%3E%3Celem%20xsi%3Atype%3D%22xsd%3AObject%22%3E%3Ccriteria%20xsi%3Atype%3D%22xsd%3AObject%22%3E%3Coperator%3Eand%3C%2Foperator%3E%3C_constructor%3EAdvancedCriteria%3C%2F_constructor%3E%3Ccriteria%20xsi%3Atype%3D%22xsd%3AList%22%3E%3Celem%20xsi%3Atype%3D%22xsd%3AObject%22%3E%3C_constructor%3EAdvancedCriteria%3C%2F_constructor%3E%3Coperator%3Eand%3C%2Foperator%3E%3Ccriteria%20xsi%3Atype%3D%22xsd%3AList%22%3E%3Celem%20xsi%3Atype%3D%22xsd%3AObject%22%3E%3CfieldName%3ESTART_TIMESTAMP%3C%2FfieldName%3E%3Coperator%3EgreaterOrEqual%3C%2Foperator%3E%3Cvalue%20xsi%3Atype%3D%22xsd%3Adatetime%22%3E2013-01-02T00%3A01%3A00%3C%2Fvalue%3E%3C_constructor%3EAdvancedCriteria%3C%2F_constructor%3E%3C%2Felem%3E%3C%2Fcriteria%3E%3C%2Felem%3E%3C%2Fcriteria%3E%3C%2Fcriteria%3E%3CoperationConfig%20xsi%3Atype%3D%22xsd%3AObject%22%3E%3CdataSource%3EmydataDataSource%3C%2FdataSource%3E%3CoperationType%3Efetch%3C%2FoperationType%3E%3CtextMatchStyle%3Esubstring%3C%2FtextMatchStyle%3E%3C%2FoperationConfig%3E%3CstartRow%20xsi%3Atype%3D%22xsd%3Along%22%3E0%3C%2FstartRow%3E%3CendRow%20xsi%3Atype%3D%22xsd%3Along%22%3E75%3C%2FendRow%3E%3CcomponentId%3Eisc_mydataReportPage_0_Table%3C%2FcomponentId%3E%3CappID%3EbuiltinApplication%3C%2FappID%3E%3Coperation%3EmydataDataSource_fetch%3C%2Foperation%3E%3ColdValues%20xsi%3Atype%3D%22xsd%3AObject%22%3E%3Coperator%3Eand%3C%2Foperator%3E%3C_constructor%3EAdvancedCriteria%3C%2F_constructor%3E%3Ccriteria%20xsi%3Atype%3D%22xsd%3AList%22%3E%3Celem%20xsi%3Atype%3D%22xsd%3AObject%22%3E%3C_constructor%3EAdvancedCriteria%3C%2F_constructor%3E%3Coperator%3Eand%3C%2Foperator%3E%3Ccriteria%20xsi%3Atype%3D%22xsd%3AList%22%3E%3Celem%20xsi%3Atype%3D%22xsd%3AObject%22%3E%3CfieldName%3ESTART_TIMESTAMP%3C%2FfieldName%3E%3Coperator%3EgreaterOrEqual%3C%2Foperator%3E%3Cvalue%20xsi%3Atype%3D%22xsd%3Adatetime%22%3E2013-01-02T00%3A01%3A00%3C%2Fvalue%3E%3C_constructor%3EAdvancedCriteria%3C%2F_constructor%3E%3C%2Felem%3E%3C%2Fcriteria%3E%3C%2Felem%3E%3C%2Fcriteria%3E%3C%2FoldValues%3E%3C%2Felem%3E%3C%2Foperations%3E%3C%2Ftransaction%3E --data "isc_tnum=1" --data "protocolVersion=1.0" http://myapp:myport/myapplication/myapplication/sc/IDACall?isc_rpc=1&isc_v=v8.2p_2012-08-28&isc_xhr=1 --header "Content-Type:application/x-www-form-urlencoded; charset=UTF-8" &
    it works flawlessly. I'd like some insight into what is wrong with the xml. Here is the xml file
    Code:
    <transaction xmlns:xsi="http://www.w3.org/2000/10/XMLSchema-instance" xsi:type="xsd:Object"><transactionNum xsi:type="xsd:long">1</transactionNum><operations xsi:type="xsd:List"><elem xsi:type="xsd:Object"><criteria xsi:type="xsd:Object"><operator>and</operator><_constructor>AdvancedCriteria</_constructor><criteria xsi:type="xsd:List"><elem xsi:type="xsd:Object"><_constructor>AdvancedCriteria</_constructor><operator>and</operator><criteria xsi:type="xsd:List"><elem xsi:type="xsd:Object"><fieldName>TIMESTAMP</fieldName><operator>greaterOrEqual</operator><value xsi:type="xsd:datetime">2013-01-02T00:00:00</value><_constructor>AdvancedCriteria</_constructor></elem></criteria></elem></criteria></criteria><operationConfig xsi:type="xsd:Object"><dataSource>MYDATADataSource</dataSource><operationType>fetch</operationType><textMatchStyle>substring</textMatchStyle></operationConfig><startRow xsi:type="xsd:long">0</startRow><endRow xsi:type="xsd:long">75</endRow><componentId>isc_MYDATAReportPage_0_Table</componentId><appID>builtinApplication</appID><operation>MYDATADataSource_fetch</operation><oldValues xsi:type="xsd:Object"><operator>and</operator><_constructor>AdvancedCriteria</_constructor><criteria xsi:type="xsd:List"><elem xsi:type="xsd:Object"><_constructor>AdvancedCriteria</_constructor><operator>and</operator><criteria xsi:type="xsd:List"><elem xsi:type="xsd:Object"><fieldName>TIMESTAMP</fieldName><operator>greaterOrEqual</operator><value xsi:type="xsd:datetime">2013-01-02T00:00:00</value><_constructor>AdvancedCriteria</_constructor></elem></criteria></elem></criteria></oldValues></elem></operations></transaction>

    #2
    In the first call, the XML was not encoded as a POST'd form parameter. Unencoding it (as we should) turned it into invalid XML.

    Comment

    Working...
    X