Showing posts with label web services. Show all posts
Showing posts with label web services. Show all posts

Wednesday, May 18, 2011

Tiny clients to consume Web Services. (PHP, WinPoSh, Python, Ruby)

PHP:
$wsClient = new SoapClient('http://server/webapp/path/to/webservice');
$ResultHolder = $wsClient->RemoteOperation();

WinPoSh:
PS C:\> $wsClient = New-WebServiceProxy -Uri http://server/webapp/path/to/webservice
PS C:\> $wsClient | Get-Member
PS C:\> $wsClient.RemoteOperation()

Python:

import sys
from SOAPpy import WSDL

WSDLFILE = 'http://server/webapp/path/to/webservice'
_client = WSDL.Proxy(WSDLFILE)

result_holder = _client.RemoteOperation()

Ruby:
require 'savon'
# create a client for the service
client = Savon.client(wsdl: 'http://server/webapp/path/to/webservice')
print client.operations
# => [:find_user, :list_users]
# call the 'remoteOperation' operation
#response = client.call(:remote_operation, message: { id: 1 })
#response.body
# => { remote_operation_response: { id: 1, otherfield: 'Foo Bar' } }