a peek into my MIND

January 4, 2010

WebService client in PHP

Filed under: General — Bharat Kondeti @ 8:38 pm

Its pretty simple to write a web-service client in PHP using SoapClient library that comes bundled with PHP.

By default when a SoapClient is created, the client will use the soap:address location from the WSDL. There might be different reasons why the address location inside the WSDL is different from the actual WSDL location. Its always safe to manually set the web-service location for the client.

one can do this by calling _setLocation() on the client.

<?php
ini_set("memory_limit","128M");
$soapUrl = "some wsdl url";

$client = new SoapClient( $soapUrl, array('connection_timeout' => 200));
$client->__setLocation($soapUrl);

$params->telephone=7065555558;

$return=$client->lookupCustomerByTN($params);

var_export($return);
?>
Advertisements

Leave a Comment »

No comments yet.

RSS feed for comments on this post.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Create a free website or blog at WordPress.com.

%d bloggers like this: