testing a sample SOAP based service .. but getting error "premature end of file"

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

testing a sample SOAP based service .. but getting error "premature end of file"

DL
I know that usually REST is preferred to SOAP (which is complex).

http://www.somebits.com/weblog/tech/bad/whySoapSucks.html?seemore=y

And I've read here that SOAP based reads cannot be cached.

http://spf13.com/post/soap-vs-rest

...

But noting these warnings .. just as a learning exercise I'm trying out calls to a typical SOAP web service.

http://www.pastie.org/457535

I've placed this xform definition as view.xhtml in /resources/apps/weather-service/
and created a simple page-flow.xml

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

but when I try launching ..

http://localhost:8080/orbeon/weather-service/

I get error message .. "premature end of file"

Any advice on what could be the cause of this error?


Reply | Threaded
Open this post in threaded view
|

Re: testing a sample SOAP based service .. but getting error "premature end of file"

Erik Bruchez
Administrator
Usually this is an XML parser error. Anything in the logs?

-Erik

On Fri, Jul 6, 2012 at 1:27 PM, DL <[hidden email]> wrote:

> I know that usually REST is preferred to SOAP (which is complex).
>
> http://www.somebits.com/weblog/tech/bad/whySoapSucks.html?seemore=y
>
> And I've read here that SOAP based reads cannot be cached.
>
> http://spf13.com/post/soap-vs-rest
>
> ...
>
> But noting these warnings .. just as a learning exercise I'm trying out
> calls to a typical SOAP web service.
>
> http://www.pastie.org/457535
>
> I've placed this xform definition as view.xhtml in
> /resources/apps/weather-service/
> and created a simple page-flow.xml
>
>
>
> but when I try launching ..
>
> http://localhost:8080/orbeon/weather-service/
>
> I get error message .. "premature end of file"
>
> Any advice on what could be the cause of this error?
>
>
>
>
> --
> View this message in context: http://orbeon-forms-ops-users.24843.n4.nabble.com/testing-a-sample-SOAP-based-service-but-getting-error-premature-end-of-file-tp4655441.html
> Sent from the Orbeon Forms (ops-users) mailing list archive at Nabble.com.
>
>
> --
> 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
DL
Reply | Threaded
Open this post in threaded view
|

Re: testing a sample SOAP based service .. but getting error "premature end of file"

DL
This post was updated on .

Here is a dump of orbeon.log which points to ..

2012-07-07 19:21:39,677 ERROR ProcessorService  - Exception at line 1, column 1 of file:///
org.xml.sax.SAXParseException; systemId: file:///; lineNumber: 1; columnNumber: 1; Premature end of file.

but no file identified .. only file:/// ????

I've also found that the weather service URI has changed over the years .. the new API and namespace are below ..

http://graphical.weather.gov/xml/SOAP_server/ndfdXMLserver.php

http://graphical.weather.gov/xml/DWMLgen/wsdl/ndfdXML.wsdl

2012-07-07 19:21:39,672 DEBUG XFormsServer  -                     dispatchEvent - start dispatching {name: "xforms-submit-error", id: "weather"}
2012-07-07 19:21:39,672 DEBUG XFormsServer  -                       dispatchEvent - start default action handler
2012-07-07 19:21:39,672 DEBUG XFormsServer  -                       dispatchEvent - end default action handler {time (ms): "0"}
2012-07-07 19:21:39,672 DEBUG XFormsServer  -                     dispatchEvent - end dispatching {time (ms): "0", name: "xforms-submit-error", id: "weather"}
2012-07-07 19:21:39,672 DEBUG XFormsServer  -                   end handling result {time (ms): "2"}
2012-07-07 19:21:39,673 DEBUG XFormsServer  -                 end submission {time (ms): "266"}
2012-07-07 19:21:39,673 DEBUG XFormsServer  -               dispatchEvent - end default action handler {time (ms): "268"}
2012-07-07 19:21:39,673 DEBUG XFormsServer  -             dispatchEvent - end dispatching {time (ms): "268", name: "xforms-submit", id: "weather"}
2012-07-07 19:21:39,673 DEBUG XFormsServer  -           interpreter - end executing {time (ms): "268", action name: "send"}
2012-07-07 19:21:39,673 DEBUG XFormsServer  -           interpreter - start executing {action name: "insert"}
2012-07-07 19:21:39,676 DEBUG XFormsServer  -           dispatchEvent - end target handler {time (ms): "271"}
2012-07-07 19:21:39,677 DEBUG XFormsServer  -         dispatchEvent - end dispatching {time (ms): "272"}
2012-07-07 19:21:39,677 ERROR ProcessorService  - Exception at line 1, column 1 of file:///
org.xml.sax.SAXParseException; systemId: file:///; lineNumber: 1; columnNumber: 1; Premature end of file.
	at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:198)
	at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(ErrorHandlerWrapper.java:177)
	at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:441)
	at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:368)
	at com.sun.org.apache.xerces.internal.impl.XMLScanner.reportFatalError(XMLScanner.java:1375)
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(XMLDocumentScannerImpl.java:1016)
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:607)
	at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:116)
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:488)
	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:835)
	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:764)
	at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:123)
	at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1210)
	at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:568)
	at org.orbeon.saxon.event.Sender.sendSAXSource(Sender.java:404)
	at org.orbeon.saxon.event.Sender.send(Sender.java:193)
	at org.orbeon.saxon.event.Sender.send(Sender.java:50)
	at org.orbeon.saxon.functions.Parse.evaluateItem(Parse.java:74)
	at org.orbeon.saxon.expr.Expression.iterate(Expression.java:370)
	at org.orbeon.saxon.sxpath.XPathExpression.iterate(XPathExpression.java:141)
	at org.orbeon.oxf.util.PooledXPathExpression.evaluate(PooledXPathExpression.java:252)
	at org.orbeon.oxf.util.PooledXPathExpression.evaluateKeepNodeInfo(PooledXPathExpression.java:136)
	at org.orbeon.oxf.util.XPathCache.evaluate(XPathCache.java:130)
	at org.orbeon.oxf.xforms.action.XFormsActionInterpreter.evaluateExpression(XFormsActionInterpreter.java:398)
	at org.orbeon.oxf.xforms.action.actions.XFormsInsertAction.execute(XFormsInsertAction.java:107)
	at org.orbeon.oxf.xforms.action.XFormsActionInterpreter.runSingleIteration(XFormsActionInterpreter.java:293)
	at org.orbeon.oxf.xforms.action.XFormsActionInterpreter.runAction(XFormsActionInterpreter.java:254)
	at org.orbeon.oxf.xforms.action.actions.XFormsActionAction.execute(XFormsActionAction.java:66)
	at org.orbeon.oxf.xforms.action.XFormsActionInterpreter.runSingleIteration(XFormsActionInterpreter.java:293)
	at org.orbeon.oxf.xforms.action.XFormsActionInterpreter.runAction(XFormsActionInterpreter.java:254)
	at org.orbeon.oxf.xforms.event.XFormsEventHandlerImpl.handleEvent(XFormsEventHandlerImpl.java:200)
	at org.orbeon.oxf.xforms.xbl.XBLContainer.dispatchEvent(XBLContainer.java:1014)
	at org.orbeon.oxf.xforms.XFormsContainingDocument.dispatchEvent(XFormsContainingDocument.java:880)
	at org.orbeon.oxf.xforms.event.ClientEvents$.dispatchEventCheckTarget$1(ClientEvents.scala:409)
	at org.orbeon.oxf.xforms.event.ClientEvents$.processEvent(ClientEvents.scala:506)
	at org.orbeon.oxf.xforms.event.ClientEvents$$anonfun$processEvents$1.apply(ClientEvents.scala:116)
	at org.orbeon.oxf.xforms.event.ClientEvents$$anonfun$processEvents$1.apply(ClientEvents.scala:115)
	at scala.collection.LinearSeqOptimized$class.foreach(LinearSeqOptimized.scala:61)
	at scala.collection.immutable.List.foreach(List.scala:45)
	at org.orbeon.oxf.xforms.event.ClientEvents$.processEvents(ClientEvents.scala:115)
	at org.orbeon.oxf.xforms.event.ClientEvents.processEvents(ClientEvents.scala)
	at org.orbeon.oxf.xforms.processor.XFormsServer.doIt(XFormsServer.java:215)
	at org.orbeon.oxf.xforms.processor.XFormsServer.access$000(XFormsServer.java:56)
	at org.orbeon.oxf.xforms.processor.XFormsServer$1.readImpl(XFormsServer.java:88)
	at org.orbeon.oxf.processor.impl.ProcessorOutputImpl$TopLevelOutputFilter.read(ProcessorOutputImpl.java:263)
	at org.orbeon.oxf.processor.impl.ProcessorOutputImpl.read(ProcessorOutputImpl.java:406)
	at org.orbeon.oxf.processor.ProcessorImpl.readInputAsSAX(ProcessorImpl.java:260)
	at org.orbeon.oxf.processor.pipeline.TeeProcessor$TeeProcessorOutputImpl.readImpl(TeeProcessor.java:89)
	at org.orbeon.oxf.processor.impl.ProcessorOutputImpl$TopLevelOutputFilter.read(ProcessorOutputImpl.java:263)
	at org.orbeon.oxf.processor.impl.ProcessorOutputImpl.read(ProcessorOutputImpl.java:406)
	at org.orbeon.oxf.processor.ProcessorImpl.readInputAsSAX(ProcessorImpl.java:260)
	at org.orbeon.oxf.processor.ProcessorImpl.readInputAsTinyTree(ProcessorImpl.java:286)
	at org.orbeon.oxf.processor.ProcessorImpl$3.read(ProcessorImpl.java:315)
	at org.orbeon.oxf.processor.ProcessorImpl.readCacheInputAsObject(ProcessorImpl.java:365)
	at org.orbeon.oxf.processor.ProcessorImpl.readCacheInputAsObject(ProcessorImpl.java:330)
	at org.orbeon.oxf.processor.ProcessorImpl.readCacheInputAsTinyTree(ProcessorImpl.java:313)
	at org.orbeon.oxf.processor.pipeline.choose.ConcreteChooseProcessor.start(ConcreteChooseProcessor.java:186)
	at org.orbeon.oxf.processor.pipeline.PipelineProcessor$5.run(PipelineProcessor.java:661)
	at org.orbeon.oxf.processor.pipeline.PipelineProcessor.executeChildren(PipelineProcessor.java:726)
	at org.orbeon.oxf.processor.pipeline.PipelineProcessor.start(PipelineProcessor.java:658)
	at org.orbeon.oxf.processor.pipeline.choose.ConcreteChooseProcessor.start(ConcreteChooseProcessor.java:248)
	at org.orbeon.oxf.processor.pipeline.PipelineProcessor$5.run(PipelineProcessor.java:661)
	at org.orbeon.oxf.processor.pipeline.PipelineProcessor.executeChildren(PipelineProcessor.java:726)
	at org.orbeon.oxf.processor.pipeline.PipelineProcessor.start(PipelineProcessor.java:658)
	at org.orbeon.oxf.pipeline.InitUtils.runProcessor(InitUtils.java:89)
	at org.orbeon.oxf.webapp.ProcessorService.service(ProcessorService.java:97)
	at org.orbeon.oxf.servlet.OrbeonServletDelegate.service(OrbeonServletDelegate.java:133)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:224)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:169)
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
	at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:928)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
	at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:987)
	at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:539)
	at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:298)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
	at java.lang.Thread.run(Thread.java:722)
2012-07-07 19:21:39,678 INFO  ProcessorService  - /xforms-server - Timing: 299 - Cache hits for cache.main: 20, fault: 1, adds: 0, expirations: 0, success rate: 95%
2012-07-07 19:21:39,678 INFO  ProcessorService  - /xforms-server - Received request
2012-07-07 19:21:39,720 INFO  ProcessorService  - /xforms-server - Timing: 42 - Cache hits for cache.main: 8, fault: 0, adds: 0, expirations: 0, success rate: 100%
DL
Reply | Threaded
Open this post in threaded view
|

Re: testing a sample SOAP based service .. but getting error "premature end of file"

DL

Here is my progress on using National Weather Service as a test SOAP service

I installed soapUI from http://www.soapui.org.
I created a project using the wsdl.
I invoked the NDFDgenByDay request operation in soapUI to see the soap envelope expected.
I inserted a few test parameters
and tried launching

http://localhost:8080/orbeon/weather-service/

but although the xform renders in browser I still get parsing errors.  
org.xml.sax.SAXParseException;
Here is the xform definition.
Can you see any glaring errors?


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:saxon="http://saxon.sf.net/"
      xmlns:xforms="http://www.w3.org/2002/xforms"
      xmlns:ev="http://www.w3.org/2001/xml-events"
      xmlns:xxforms="http://orbeon.org/oxf/xml/xforms"
      xmlns:widget="http://www.orbeon.com/oxf/xml/widget"
      xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
      xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
      xmlns:xsd="http://www.w3.org/2001/XMLSchema"
      xmlns:ndf="http://graphical.weather.gov/xml/DWMLgen/wsdl/ndfdXML.wsdl">
<head>

<title>Weather.gov Service</title>

<model id="main" xmlns="http://www.w3.org/2002/xforms">






  <instance id="weather-tx">
    <soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
    xmlns:ndf="http://graphical.weather.gov/xml/DWMLgen/wsdl/ndfdXML.wsdl">
    <soapenv:Header/>
    <soapenv:Body>
     
 
      <ndf:NDFDgenByDay soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
         <ndf:latitude xsi:type="xsd:decimal">37.41</ndf:latitude>
         <ndf:longitude xsi:type="xsd:decimal">-122.74</ndf:longitude>
         <ndf:startDate xsi:type="xsd:date">2012-06-06</ndf:startDate>
         <ndf:numDays xsi:type="xsd:integer">1</ndf:numDays>
         <ndf:Unit xsi:type="dwml:unitType" xmlns:dwml="http://graphical.weather.gov/xml/DWMLgen/schema/DWML.xsd">e</ndf:Unit>
         <ndf:format xsi:type="dwml:formatType" xmlns:dwml="http://graphical.weather.gov/xml/DWMLgen/schema/DWML.xsd">24 hourly</ndf:format>
      </ndf:NDFDgenByDay>
    </soapenv:Body>
  </soapenv:Envelope>
  </instance>

  <bind nodeset="instance('weather-tx')/soap:Body/ndf:NDFDgenByDay"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:ndf="http://graphical.weather.gov/xml/DWMLgen/wsdl/ndfdXML.wsdl">
    <bind nodeset="ndf:latitude" type="xsd:decimal"/>
    <bind nodeset="ndf:longitude" type="xsd:decimal"/>
    <bind nodeset="ndf:startDate" type="xsd:date"
      calculate="if (. = '') then current-date() else ." /> />
    <bind nodeset="ndf:numDays" type="xsd:integer" />
    <bind nodeset="ndf:format" type="xsd:string" />
  </bind>

  <instance id="weather-rx">
    <null xmlns=""/>
  </instance>

  <instance id="weather-xml">
    <null xmlns=""/>
  </instance>
 
  <submission id="weather"
    ref="instance('weather-tx')"
    method="post"
    mediatype="text/xml"
    action="http://graphical.weather.gov/xml/SOAP_server/ndfdXMLserver.php"
    replace="instance"
    instance="weather-rx">
    <header>
      <name>SOAPAction</name>
      <value>"http://graphical.weather.gov/xml/DWMLgen/wsdl/ndfdXML.wsdl#NDFDgenByDay"</value>
    </header>
  </submission>

 
</model>
</head>
<body>

<xforms:group ref="instance('weather-tx')/soap:Body/ndf:NDFDgenByDay">

    <p>
      <xforms:input ref="ndf:latitude">
        <xforms:label>Lat: </xforms:label>
      </xforms:input>
    </p>
    <p>
      <xforms:input ref="ndf:longitude">
       <xforms:label>Lon: </xforms:label>
      </xforms:input>
    </p>
    <p>
      <xforms:input ref="ndf:startDate">
        <xforms:label>Date: </xforms:label>
      </xforms:input>
    </p>
    <p>
      <xforms:trigger>
        <xforms:label>Submit</xforms:label>
        <xforms:action ev:event="DOMActivate">
          <xforms:send submission="weather"/>
         
          <xforms:insert nodeset="instance('weather-xml')" origin="saxon:parse(instance('weather-rx'))"/>
        </xforms:action> 
      </xforms:trigger>
    </p>

</xforms:group>

<xforms:group ref="instance('weather-xml')">

 

<xforms:output value="/dwml/head/product/title"/>


  <p>
  <xxforms:variable name="high-temp" select="/dwml/data/parameters/temperature[@type='maximum']"/>
  High: <xforms:output value="$high-temp/value"/><xforms:output value="substring($high-temp/@units,1,1)"/> <br/>
  <xxforms:variable name="low-temp" select="/dwml/data/parameters/temperature[@type='minimum']"/>
  Low: <xforms:output value="$low-temp/value"/><xforms:output value="substring($low-temp/@units,1,1)"/> <br/>       
  Conditions: <xforms:output value="/dwml/data/parameters/weather/weather-conditions/@weather-summary"/> <br/>
  <xforms:output mediatype="image/*" value="/dwml/data/parameters/conditions-icon/icon-link"/>
  </p>

  <p>
    <xxforms:variable name="details" select="/dwml/data/moreWeatherInformation"/>
    Details at: <a href="{$details}"><xforms:output value="$details"/>
  </p>

  <div style="text-align:center">
    <xxforms:variable name="more-info" select="/dwml/head/source/more-information"/>
    For more information see: <a href="{$more-info}"><xforms:output value="$more-info"/><br/>       
    <xxforms:variable name="disclaimer" select="/dwml/head/source/disclaimer"/>
    <a href="{$disclaimer}">Disclaimer<br/>
    <xforms:output mediatype="image/*" value="/dwml/head/source/credit-logo"/>
  </div>

</xforms:group>



</body>
</html>