SOAP: Difference between revisions
Content added Content deleted
No edit summary |
No edit summary |
||
Line 3: | Line 3: | ||
In this task, the goal is to create a SOAP client which accesses functions defined at '''http://example.com/soap/wsdl''', and calls the functions '''soapFunc( )''' and '''anotherSoapFunc( )'''. |
In this task, the goal is to create a SOAP client which accesses functions defined at '''http://example.com/soap/wsdl''', and calls the functions '''soapFunc( )''' and '''anotherSoapFunc( )'''. |
||
==[[ActionScript]]== |
|||
[[Category:ActionScript]] |
|||
'''Version:''' ActionScript 3.0 |
|||
import mx.rpc.soap.WebService; |
|||
import mx.rpc.events.ResultEvent; |
|||
var ws:WebService = new WebService(); |
|||
ws.wsdl = 'http://example.com/soap/wsdl'; |
|||
ws.soapFunc.addEventListener("result",soapFunc_Result); |
|||
ws.anotherSoapFunc.addEventListener("result",anotherSoapFunc_Result); |
|||
ws.loadWSDL(); |
|||
ws.soapFunc(); |
|||
ws.anotherSoapFunc(); |
|||
// method invocation callback handlers |
|||
private function soapFunc_Result(event:ResultEvent):void { |
|||
// do something |
|||
} |
|||
private function anotherSoapFunc_Result(event:ResultEvent):void { |
|||
// do another something |
|||
} |
|||
==[[ColdFusion]]== |
==[[ColdFusion]]== |
Revision as of 07:08, 27 January 2007
SOAP
You are encouraged to solve this task according to the task description, using any language you may know.
You are encouraged to solve this task according to the task description, using any language you may know.
In this task, the goal is to create a SOAP client which accesses functions defined at http://example.com/soap/wsdl, and calls the functions soapFunc( ) and anotherSoapFunc( ).
ActionScript
Version: ActionScript 3.0
import mx.rpc.soap.WebService; import mx.rpc.events.ResultEvent; var ws:WebService = new WebService(); ws.wsdl = 'http://example.com/soap/wsdl'; ws.soapFunc.addEventListener("result",soapFunc_Result); ws.anotherSoapFunc.addEventListener("result",anotherSoapFunc_Result); ws.loadWSDL(); ws.soapFunc(); ws.anotherSoapFunc(); // method invocation callback handlers private function soapFunc_Result(event:ResultEvent):void { // do something } private function anotherSoapFunc_Result(event:ResultEvent):void { // do another something }
ColdFusion
<cfset client = createObject("webservice","http://example.com/soap/wsdl")> <cfset result = client.soapFunc("hello")> <cfset result = client.anotherSoapFunc(34234)>
Perl
use SOAP::Lite; print SOAP::Lite -> service('http://example.com/soap/wsdl') -> soapFunc("hello"); print SOAP::Lite -> service('http://example.com/soap/wsdl') -> anotherSoapFunc(34234);
PHP
<?php $client = new SoapClient('http://example.com/soap/wsdl'); $result = $client->soapFunc('hello'); $result = $client->anotherSoapFunc(34234); ?>
Python
Interpreter: Python 2.4, 2.5
from SOAPpy import WSDL proxy = WSDL.Proxy("http://example.com/soap/wsdl") result = proxy.soapFunc("hello") result = proxy.anotherSoapFunc(34234)
Note: SOAPpy is a third-party module and can be found at Python Web Services
VBScript
Dim client Dim result Set client = CreateObject("MSSOAP.SoapClient") client.MSSoapInit "http://example.com/soap/wsdl" result = client.soapFunc("hello") result = client.anotherSoapFunc(34234)