/soap/index.lsp



   1   
<?lsp 2 local fmt=string.format 3 4 local dateex=[[ 5 On Error Resume Next 6 dim SOAPClient 7 set SOAPClient = createobject("MSSOAP.SOAPClient") 8 if Err.Number <> 0 then 9 wscript.echo "Microsoft's 'MSSOAP.SOAPClient' is not installed on your computer!" 10 Else 11 SOAPClient.mssoapinit("http://%s/examples/soap/date/info.wsdl") 12 wscript.echo "SOAP Server date is :", SOAPClient.Date() 13 End if 14 ]] 15 16 local mathex=[[ 17 On Error Resume Next 18 dim SOAPClient 19 set SOAPClient = createobject("MSSOAP.SOAPClient") 20 if Err.Number <> 0 then 21 wscript.echo "Microsoft's 'MSSOAP.SOAPClient' is not installed on your computer!" 22 Else 23 SOAPClient.mssoapinit("http://%s/examples/soap/math/Math.wsdl") 24 wscript.echo "5 + 5 = ", SOAPClient.Add(5,5) 25 wscript.echo "10/3 = ", SOAPClient.Divide(10,3) 26 dim sum(5) 27 sum(0)=1 28 sum(1)=2 29 sum(2)=3 30 sum(3)=4 31 sum(4)=5 32 wscript.echo "sum 1+2+3+4+5 = ", SOAPClient.Sum(sum) 33 End if 34 ]] 35 36 37 local example = request:data("example") 38 if example then 39 local data = example == "date" and dateex or mathex 40 data = fmt(data, request:header"host") 41 response:setheader("Content-type","application/octet-stream") 42 response:setheader("Content-Disposition", 43 fmt('attachment; filename="%s.vbs"',example)) 44 response:setheader("Cache-Control", 45 "no-store, no-cache, no-transform, must-revalidate, private") 46 response:setheader("Pragma","private") 47 response:setheader("Expires","0") 48 response:setcontentlength(#data) 49 response:send(data) 50 return 51 end 52 53 title="Barracuda SOAP Examples" 54 response:include"/rtl/.header.lsp" 55 ?>
56 <h1>Barracuda SOAP Examples</h1> 57 58 <p><b>Download and run the following Visual Basic SOAP scripts:</b></p> 59 <ul> 60 <li><a href="./?example=date">Date</a></li> 61 <li><a href="./?example=math">Math</a></li> 62 </ul> 63 64 <p>Clicking the above links download visual basic scripts you can run on a Windows computer. The visual basic scripts, when executed, fetch the Web Service Definition Language (WSDL) files and call the Web Services provided in the WSDL.</p> 65 <p>You can view the WSDL (XML) files directly in your browser:</p> 66 <ul> 67 <li><b>Date:</b> <a href="date/info.wsdl" target="_blank">date/info.wsdl</a></li> 68 <li><b>Math:</b> <a href="math/Math.wsdl" target="_blank">math/Math.wsdl</a></li> 69 </ul> 70 71 <p>The SOAP examples are from our <a href="http://barracudaserver.com/ba/doc/?url=en/lua/soap.html" target="_blank">SOAP documentation</a>.</p> 72 73 <p><b>SOAP example source code:</b></p> 74 <ul> 75 <li><a target='ex' href='../showsource/?path=.preload'>.preload</a></li> 76
<?lsp 77 for file in app.recDirIter("/soap/") do 78 response:write("<li><a target='ex' href='../showsource/?path=",file,"'>",file,"</a></li>") 79 80 end 81 ?>
82 </ul> 83 84 85
<?lsp response:include"/rtl/.footer.lsp" ?>
86