| [18562] | 1 | <?php |
|---|
| 2 | // |
|---|
| 3 | // +----------------------------------------------------------------------+ |
|---|
| 4 | // | PHP Version 4 | |
|---|
| 5 | // +----------------------------------------------------------------------+ |
|---|
| 6 | // | Copyright (c) 1997-2003 The PHP Group | |
|---|
| 7 | // +----------------------------------------------------------------------+ |
|---|
| 8 | // | This source file is subject to version 2.02 of the PHP license, | |
|---|
| 9 | // | that is bundled with this package in the file LICENSE, and is | |
|---|
| 10 | // | available at through the world-wide-web at | |
|---|
| 11 | // | http://www.php.net/license/2_02.txt. | |
|---|
| 12 | // | If you did not receive a copy of the PHP license and are unable to | |
|---|
| 13 | // | obtain it through the world-wide-web, please send a note to | |
|---|
| 14 | // | [email protected] so we can mail you a copy immediately. | |
|---|
| 15 | // +----------------------------------------------------------------------+ |
|---|
| 16 | // | Authors: Shane Caraveo <[email protected]> | |
|---|
| 17 | // +----------------------------------------------------------------------+ |
|---|
| 18 | // |
|---|
| 19 | // $Id: com_client.php,v 1.3 2005/03/10 23:16:40 yunosh Exp $ |
|---|
| 20 | // |
|---|
| 21 | // SOAPStruct is defined in the following file |
|---|
| 22 | require_once 'example_types.php'; |
|---|
| 23 | |
|---|
| 24 | /* just a simple example of using MS SOAP on win32 as a client |
|---|
| 25 | to the php server. */ |
|---|
| 26 | |
|---|
| 27 | //load COM SOAP client object |
|---|
| 28 | $soapclient = new COM("MSSOAP.SoapClient30"); |
|---|
| 29 | |
|---|
| 30 | //connect to web service |
|---|
| 31 | $soapclient->mssoapinit("http://localhost/SOAP/example/server.php?wsdl"); |
|---|
| 32 | |
|---|
| 33 | //obtain result from web service method |
|---|
| 34 | $ret = $soapclient->echoString("This is a test!"); |
|---|
| 35 | print("$ret\n"); |
|---|
| 36 | |
|---|
| 37 | $ret = $soapclient->echoStringSimple("This is another test!"); |
|---|
| 38 | print("$ret\n"); |
|---|
| 39 | |
|---|
| 40 | # the following causes an exception in the COM extension |
|---|
| 41 | |
|---|
| 42 | #$ret = $soapclient->divide(22,7); |
|---|
| 43 | #print $soapclient->faultcode; |
|---|
| 44 | #print $soapclient->faultstring; |
|---|
| 45 | #print("22/7=$ret\n"); |
|---|
| 46 | #print_r($ret); |
|---|
| 47 | #$ret = $soapclient->divide(22,0); |
|---|
| 48 | #print("22/0=$ret\n"); |
|---|
| 49 | |
|---|
| 50 | #$struct = new SOAPStruct('test string',123,123.123); |
|---|
| 51 | #$ret = $soapclient->echoStruct($struct); |
|---|
| 52 | #print_r($ret); |
|---|
| 53 | |
|---|
| 54 | #$ret = $soapclient->echoStructAsSimpleTypes($struct); |
|---|
| 55 | #print_r($ret); |
|---|
| 56 | |
|---|
| [16957] | 57 | ?> |
|---|