Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // Load the classes constructed by wsdl2php
- require_once 'WAPI.php';
- // Define the SOAP options.
- $a_SoapOptions = array
- (
- 'encoding' => 'UTF-8',
- 'exception' => True, // Turn SOAPFaults into Exceptions so PHP can report upon them.
- 'trace' => True, // Turn on tracing so we can see EXACTLY what the headers and request/response are.
- );
- // As we are going to need to display XML, use Tidy to make it pretty.
- $a_TidyConfig = array
- (
- 'indent' => 4,
- 'indent-attributes' => true,
- 'input-xml' => true,
- 'output-xml' => true,
- 'wrap' => 0,
- );
- $o_Tidy = new Tidy;
- $s_WsdlUrl = "https://api.ote.wildwestdomains.com/wswwdapi/wapi.asmx?wsdl";
- // Use a try/catch loop to talk to the services.
- try
- {
- // Create a login service.
- $o_WAPI = new WAPI($s_WsdlUrl, $a_SoapOptions);
- // Create "Describe" and "Credential" objects.
- $o_Describe = new Describe;
- $o_Describe->credential = new Credential;
- // Populate newly created objects.
- $o_Describe->sCLTRID = '';
- $o_Describe->credential->account = '';
- $o_Describe->credential->password = '';
- // Call the describe method of the service.
- $o_DescribeResponse = $o_WAPI->Describe($o_Describe);
- // Create a simple object containing the response as the service doesn't do this for us.
- $o_DescribeResults = simplexml_load_string($o_DescribeResponse->DescribeResult);
- // Display the results as they are.
- echo print_r($o_DescribeResults, True), PHP_EOL;
- }
- catch(Exception $e)
- {
- echo PHP_EOL,
- // Show trace.
- 'Request Headers', PHP_EOL,
- '---------------', PHP_EOL,
- $o_WAPI->__getLastRequestHeaders(), PHP_EOL,
- 'Request', PHP_EOL,
- '-------', PHP_EOL,
- $o_Tidy->repairString($o_WAPI->__getLastRequest(), $a_TidyConfig), PHP_EOL, PHP_EOL,
- 'Response Headers', PHP_EOL,
- '----------------', PHP_EOL,
- $o_WAPI->__getLastResponseHeaders(), PHP_EOL,
- 'Response', PHP_EOL,
- '--------', PHP_EOL,
- $o_Tidy->repairString($o_WAPI->__getLastResponse(), $a_TidyConfig), PHP_EOL, PHP_EOL, PHP_EOL,
- // Show exception.
- 'Exception', PHP_EOL,
- '---------', PHP_EOL,
- $e->getMessage(), PHP_EOL;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement