SOAP: Difference between revisions
Content added Content deleted
m (Changed over to headers.) |
|||
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( )'''. |
||
== |
=={{header|ActionScript}}== |
||
[[Category:ActionScript]] |
|||
'''Version:''' ActionScript 3.0 |
'''Version:''' ActionScript 3.0 |
||
import mx.rpc.soap.WebService; |
import mx.rpc.soap.WebService; |
||
Line 23: | Line 22: | ||
} |
} |
||
== |
=={{header|ColdFusion}}== |
||
[[Category:ColdFusion]] |
|||
<cfset client = createObject("webservice","http://example.com/soap/wsdl")> |
<cfset client = createObject("webservice","http://example.com/soap/wsdl")> |
||
<cfset result = client.soapFunc("hello")> |
<cfset result = client.soapFunc("hello")> |
||
<cfset result = client.anotherSoapFunc(34234)> |
<cfset result = client.anotherSoapFunc(34234)> |
||
== |
=={{header|Perl}}== |
||
[[Category:Perl]] |
|||
use SOAP::Lite; |
use SOAP::Lite; |
||
print SOAP::Lite |
print SOAP::Lite |
||
Line 39: | Line 36: | ||
-> anotherSoapFunc(34234); |
-> anotherSoapFunc(34234); |
||
== |
=={{header|PHP}}== |
||
[[Category:PHP]] |
|||
'''Version:''' [[PHP]] 5.0.0+ |
'''Version:''' [[PHP]] 5.0.0+ |
||
<?php |
<?php |
||
Line 57: | Line 53: | ||
?> |
?> |
||
== |
=={{header|Python}}== |
||
[[Category:Python]] |
|||
'''Interpreter:''' [[Python]] 2.4, 2.5 |
'''Interpreter:''' [[Python]] 2.4, 2.5 |
||
Line 69: | Line 64: | ||
'''Note:''' SOAPpy is a third-party module and can be found at [http://pywebsvcs.sourceforge.net/ Python Web Services] |
'''Note:''' SOAPpy is a third-party module and can be found at [http://pywebsvcs.sourceforge.net/ Python Web Services] |
||
== |
=={{header|VBScript}}== |
||
[[Category:VBScript]] |
|||
Dim client |
Dim client |
||
Line 79: | Line 73: | ||
result = client.anotherSoapFunc(34234) |
result = client.anotherSoapFunc(34234) |
||
== |
=={{header|Visual Objects}}== |
||
[[Category:Visual Objects]] |
|||
LOCAL oSoapClient AS OLEAUTOOBJECT |
LOCAL oSoapClient AS OLEAUTOOBJECT |
Revision as of 17:39, 13 November 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
Version: PHP 5.0.0+
<?php //load the wsdl file $client = new SoapClient("http://example.com/soap/definition.wsdl"); //functions are now available to be called $result = $client->soapFunc("hello"); $result = $client->anotherSoapFunc(34234);
//SOAP Information $client = new SoapClient("http://example.com/soap/definition.wsdl"); //list of SOAP types print_r($client->__getTypes()); //list if SOAP Functions print_r($client->__getFunctions()); ?>
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)
Visual Objects
LOCAL oSoapClient AS OLEAUTOOBJECT LOCAL cUrl AS STRING LOCAL uResult AS USUAL oSoapClient := OLEAutoObject{"MSSOAP.SoapClient30"} cUrl := "http://example.com/soap/wsdl" IF oSoapClient:fInit oSoapClient:mssoapinit(cUrl,"", "", "" ) uResult := oSoapClient:soapFunc("hello") uResult := oSoapClient:anotherSoapFunc(34234) ENDIF