Dashboard > ChannelAdvisor Developer Network > ChannelAdvisor Developer Network > Ping
Log In   View a printable version of the current page.
Added by Rick Watson, last edited by Marshall McClure on Nov 28, 2011  (view change)
Labels: 
(None)


Overview

Every service provided by ChannelAdvisor exposes a "Ping" method. This should be the first method you use when you connect to any service, to make sure that your connectivity and credentials are working properly.

Request

There are no parameters required in this request.

Response

Field Name Data Type Description
PingResult APIResult<string> This method returns a type named APIResultOfString. See more information on APIResult. If successful, the ResultData field will contain the value "OK".

SOAP Request Example

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:web="http://api.channeladvisor.com/webservices/">
   <soapenv:Header>
      <web:APICredentials>
         <web:DeveloperKey> --- </web:DeveloperKey>
         <web:Password> --- </web:Password>
      </web:APICredentials>
   </soapenv:Header>
   <soapenv:Body>
      <web:Ping/>
   </soapenv:Body>
</soapenv:Envelope>

SOAP Response Example

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   <soap:Body>
      <PingResponse xmlns="http://api.channeladvisor.com/webservices/">
         <PingResult>
            <Status>Success</Status>
            <MessageCode>0</MessageCode>
            <ResultData>OK</ResultData>
         </PingResult>
      </PingResponse>
   </soap:Body>
</soap:Envelope>

SOAP Response Failed Example

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
   <soap:Body>
      <soap:Fault>
         <faultcode>soap:Server</faultcode>
         <faultstring>Server was unable to process request. Authentication failed.</faultstring>
         <detail/>
      </soap:Fault>
   </soap:Body>
</soap:Envelope>

References

Interfacing With Inventory Service's Ping Method in Python

First off, you should note we do make use of a very specific Python library, suds. In Ubuntu, you can install this library by issuing the following command through your terminal:

$ sudo apt-get install python-suds

Once suds is installed, here is a full working example of how to interface with the Ping method:

from suds.client import Client
import logging

# Set logging to DEBUG so we can see the SOAP messages.
logging.basicConfig(level = logging.INFO)
logging.getLogger('suds.client').setLevel(logging.DEBUG)

# Specify Login Information
api_key = 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'
api_password = 'xxxxxxx'

# Specify URLs
wsdl_url = 'https://api.channeladvisor.com/ChannelAdvisorAPI/v5/InventoryService.asmx?WSDL'
service_url = 'https://api.channeladvisor.com/ChannelAdvisorAPI/v5/InventoryService.asmx'

# Initialize client.
client = Client(wsdl_url, location = service_url)

# Pass login information
login = client.factory.create('APICredentials')
login.DeveloperKey = api_key
login.Password = api_password
client.set_options(soapheaders=login)

# Initiate request
result = client.service.Ping()

# Print the result to the screen.
print result
Posted by Anonymous at Mar 14, 2012 11:54 | Reply To This

Interfacing With Inventory Service's Ping Method in PHP

<?php
$developer_key = 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx';
$password = 'xxxxxx';

$wsdl_url = 'https://api.channeladvisor.com/ChannelAdvisorAPI/v3/InventoryService.asmx?WSDL';
$api_url = 'http://api.channeladvisor.com/webservices/';

// Instantiate the client.
$client = new SoapClient($wsdl_url);

// Pass along login information
$soap_header = new SoapHeader(
	$api_url,
	'APICredentials',
	array(
		'DeveloperKey' => $developer_key,
		'Password' => $password
	)
);
$client->__setSoapHeaders($soap_header);

// Initiate the request.
$result = $client->Ping();

// Print the results.
print '<pre>';
var_export($result);
print '</pre>';
Posted by Anonymous at Mar 14, 2012 12:44 | Reply To This
Powered by Atlassian Confluence, the Enterprise Wiki. (Version: 2.5.1 Build:#806 May 06, 2007) - Bug/feature request - Contact Administrators