| 1 |
lars |
1 |
<?php
|
|
|
2 |
/**
|
|
|
3 |
* This file contains an example SOAP client based on the Windows
|
|
|
4 |
* MSSOAP.SoapClient30 COM object that calls methods on the example SOAP
|
|
|
5 |
* server in this same directory.
|
|
|
6 |
*
|
|
|
7 |
* PHP versions 4 and 5
|
|
|
8 |
*
|
|
|
9 |
* LICENSE: This source file is subject to version 2.02 of the PHP license,
|
|
|
10 |
* that is bundled with this package in the file LICENSE, and is available at
|
|
|
11 |
* through the world-wide-web at http://www.php.net/license/2_02.txt. If you
|
|
|
12 |
* did not receive a copy of the PHP license and are unable to obtain it
|
|
|
13 |
* through the world-wide-web, please send a note to license@php.net so we can
|
|
|
14 |
* mail you a copy immediately.
|
|
|
15 |
*
|
|
|
16 |
* @category Web Services
|
|
|
17 |
* @package SOAP
|
|
|
18 |
* @author Shane Caraveo <Shane@Caraveo.com> Port to PEAR and more
|
|
|
19 |
* @author Jan Schneider <jan@horde.org> Maintenance
|
|
|
20 |
* @copyright 2003-2007 The PHP Group
|
|
|
21 |
* @license http://www.php.net/license/2_02.txt PHP License 2.02
|
|
|
22 |
* @link http://pear.php.net/package/SOAP
|
|
|
23 |
*/
|
|
|
24 |
|
|
|
25 |
/** SOAPStruct */
|
|
|
26 |
require_once './example_types.php';
|
|
|
27 |
|
|
|
28 |
/* just a simple example of using MS SOAP on win32 as a client
|
|
|
29 |
to the php server. */
|
|
|
30 |
|
|
|
31 |
//load COM SOAP client object
|
|
|
32 |
$soapclient = new COM("MSSOAP.SoapClient30");
|
|
|
33 |
|
|
|
34 |
//connect to web service
|
|
|
35 |
$soapclient->mssoapinit("http://localhost/SOAP/example/server.php?wsdl");
|
|
|
36 |
|
|
|
37 |
//obtain result from web service method
|
|
|
38 |
$ret = $soapclient->echoString("This is a test!");
|
|
|
39 |
print("$ret\n");
|
|
|
40 |
|
|
|
41 |
$ret = $soapclient->echoStringSimple("This is another test!");
|
|
|
42 |
print("$ret\n");
|
|
|
43 |
|
|
|
44 |
# the following causes an exception in the COM extension
|
|
|
45 |
|
|
|
46 |
#$ret = $soapclient->divide(22,7);
|
|
|
47 |
#print $soapclient->faultcode;
|
|
|
48 |
#print $soapclient->faultstring;
|
|
|
49 |
#print("22/7=$ret\n");
|
|
|
50 |
#print_r($ret);
|
|
|
51 |
#$ret = $soapclient->divide(22,0);
|
|
|
52 |
#print("22/0=$ret\n");
|
|
|
53 |
|
|
|
54 |
#$struct = new SOAPStruct('test string',123,123.123);
|
|
|
55 |
#$ret = $soapclient->echoStruct($struct);
|
|
|
56 |
#print_r($ret);
|
|
|
57 |
|
|
|
58 |
#$ret = $soapclient->echoStructAsSimpleTypes($struct);
|
|
|
59 |
#print_r($ret);
|
|
|
60 |
|
|
|
61 |
?>
|