Hi,
I made an example to show how to call Spring ws (Airline) from Laszlo. I'm a newbie in Spring WS and Laszlo (more or less a week), but here is my proposition. If somebody has a better solution please feel free. I just wonder if we can use Laszlo dataset to build the request instead of a 'stupid' string concatenation, I would be nicer and more clear.
Here is the code:
HTML Code:<canvas> <bluestyle name="bluecolors" /> <dataset name="result" /> <soap name="airline" wsdl="http://localhost:8080/airline/airline.wsdl"> <!-- Creates the document request for GetFlights request --> <method name="makedocGetFlights" args="from,to,date"> <![CDATA[ var s; s = '<gfr:GetFlightsRequest'+' xmlns:gfr="http://www.springframework.org/spring-ws/samples/airline/schemas"'+'>'+ '<gfr:from>'+from+'</gfr:from>'+ '<gfr:to>' + to +'</gfr:to>'+ '<gfr:departureDate>'+date+'</gfr:departureDate>'+ '</gfr:GetFlightsRequest>' Debug.inspect(s); return s; ]]> </method> <handler name="onload"> Debug.write('loaded'); Debug.inspect(this.proxy); </handler> <handler name="onerror" args="error"> Debug.write("------------- ERROR ------------"); Debug.inspect(error); </handler> <!-- Call the GetFlights operation in the airline service The operation is called with the string generated by the makedocGetFlights method The response is stored in the result dataset --> <remotecall funcname="GetFlights" dataobject="result"> <param value="${canvas.airline.makedocGetFlights(from.text,to.text,date.text)}" /> </remotecall> </soap> <!-- Main window --> <window width="550" height="360" title="Spring WS Airline Sample - OpenLaszlo" bgcolor="gray"> <!-- General view --> <view y="20" width="550" height="340"> <simplelayout axis="y" spacing="10" /> <!-- Parameter view --> <view x="10"> <simplelayout axis="x" spacing="10" /> <text>From:</text> <edittext id="from" text="AMS" /> <text>To:</text> <edittext id="to" text="VCE" /> <text>Date:</text> <edittext id="date" text="2006-01-31" /> </view> <!-- Button view --> <view x="10"> <button onclick="canvas.airline.GetFlights.invoke()"> Get Flights </button> </view> <!-- Response view --> <view x="10" bgcolor="silver"> <grid datapath="result:/item/GetFlightsResponse/" width="500" style="bluecolors"> <gridtext width="100" editable="false" datapath="number/text()"> Number </gridtext> <gridtext width="400" editable="false" datapath="departureTime/text()"> Departure Time </gridtext> </grid> </view> </view> </window> </canvas>
Regards
Dominique



Reply With Quote
