Community Documentation

Consume web service in your code using Web service client

Last updated December 28, 2012. Created by amalaer on April 2, 2011.
Edited by chicodasilva. Log in to edit this page.

See README file of the Web service client module.

This is a sample way to call a wsclient Service

$service = wsclient_service_load('your ws service');
 
  $account = new stdClass;
  $account->name ='your user';
  $account->pass_raw ='your pass';
 
  // for own https certificates
  $curl_options[CURLOPT_SSL_VERIFYPEER] = FALSE;
  // for own HTTP authorization
  $curl_options[CURLOPT_HTTPAUTH] = CURLAUTH_BASIC;
  $curl_options[CURLOPT_USERPWD] = $account->name . ':' . $account->pass_raw;
  $service->settings['curl options'] = $curl_options;
 
  try {
    $result = $service->your_method();
  }catch (WSClientException $e) {
    watchdog('wsclient', $e->__toString());
    return null;
  }
  return $result;

Comments

Read me = 0 documentation

Sadly the read me provides little documentation on how to create an entity object and send the value to the webservice method.

Perhaps entity_create() ?

Don't know.

Robert Foley Jr
Application Architect / Business Analyst / Information Designer
http://www.robertfoleyjr.com

HTTP authentication examples

Can anyone provide an example with HTTP authentication?

Page status

About this page

Drupal version
Drupal 7.x
Audience
Programmers
Level
Intermediate
Keywords
configuration examples
Drupal’s online documentation is © 2000-2013 by the individual contributors and can be used in accordance with the Creative Commons License, Attribution-ShareAlike 2.0. PHP code is distributed under the GNU General Public License. Comments on documentation pages are used to improve content and then deleted.