PDA

View Full Version : Noob - can't get soap to work


sixdof
10-09-2007, 07:21 AM
Hello.

Just starting laszlo and trying to retrieve some info but struggling. Could someone lend an eye and let me know where and how I've been dumb. I've been on this most of the day trying different methods so it's a bit messy - code below:


<canvas height="950" width="1200" debug="true">
<debug y="200"/>

<dataset name="ds"></dataset>
<soap name="sd" wsdl="http://www.weather.gov/forecasts/xml/SOAP_server/ndfdXMLserver.php?wsdl">
<attribute name="myDel" value="$once{new LzDelegate(this, 'handler')}"/>
<handler name="onload"> Debug.write('soap service loaded ', this.proxy);Debug.inspect(this.proxy); </handler>
<handler name="onerror" args="error"> Debug.write('error:', error); </handler>
<handler name="ontimeout" args="error"> Debug.write('timeout:', error); </handler>
<handler name="ondata" args="value">
Debug.write("In ondata:");
Debug.write(value);
wt.setText(value.serialize());
</handler>

<!-- Method to make a document for SOAP message requests -->
<method name="makedoc" args="func, p, v">
<![CDATA[
var s = '<' + func + ' xmlns="' + 'http://www.weather.gov/forecasts/xml/SOAP_server/ndfdXMLserver.php' + '" >' +
'<'+p+'>'+v+'</'+p+'>'+
'</' + func + '>';
Debug.write(s);
if (func == null) return;
return s;
]]>
</method>

<remotecall funcname="NDFDgen" name="NDFDgen" dataobject="ds">
<param value="${ canvas.sd.makedoc('NDFDgen','latitude','42.13' ) }" />
<param value="${ canvas.sd.makedoc('NDFDgen','longitude','-74.08' ) }" />
<param value="${ canvas.sd.makedoc('NDFDgen','product','glance' ) }" />
<param value="${ canvas.sd.makedoc('NDFDgen','startTime','2007-10-09T00:00:00' ) }" />
<param value="${ canvas.sd.makedoc('NDFDgen','endTime','2007-10-11T00:00:00' ) }" />
<param value="${ canvas.sd.makedoc('NDFDgen','weatherParameters','m axt=TRUE' ) }" />
</remotecall>

</soap>

<dataset type="http" name="wdata" src="http://www.weather.gov/forecasts/xml/SOAP_server/ndfdXMLserver.php"/>
<view>
<simplelayout axis="x"/>
<button text="NDFDgenRequest" onclick="canvas.sd.NDFDgen.invoke()" />
<window resizable="true" id="wp" x="30" y="30" width="200" height="100" title="Data from service" closeable="true">
<text multiline="true" id="wt" width="${wp.width}" resize="true"/>
<scrollbar/>
</window>
</view>
</canvas>

vernid
10-09-2007, 07:38 AM
I think that your message is malformed.

To find out how the request should looks like, you can use Soap UI (http://www.soapui.org/) which will provide you an easy way to request the service and create messages.

Regards
Dominique

vernid
10-09-2007, 01:45 PM
Ok, I had a look and when you look at the wsdl it is mentioned that it support rpc style and not document and so you have to take as example the solution described in:

RPC Style operation (http://www.openlaszlo.org/lps/docs/guide/rpc-soap.html) with combination of the complex type parameter for the weatherParametersType parameters.

Hope it helps.

Regards
Dominique

sixdof
10-11-2007, 12:38 AM
Hello. Sorry for the slow reply. Thanks for your help on this, I'll change my approach. It does seem fairly complicated though - I'm surprised there isn't some kind of wrapper that hides the different kinds of interface from the user, like ODBC

sixdof
10-11-2007, 01:39 AM
SOAP UI - what a great tool! We've been messing with all kinds of ways of looking at services, nothing has been as easy as using this.

Cheers!

Warren

vernid
10-11-2007, 01:50 AM
You can also download and integrate into it the apache TcpMonitor which allows you to monitor the request from your application to the service. And then check if your request is well formed.

Cheers