如何通过PHP中的SOAP访问Web服务?

I tried something like this :

  try{

    $opts = array(
        'http'=>array(
            'user_agent' => 'PHPSoapClient'
            )
        );

    $context = stream_context_create($opts);
    $client = new SoapClient('http://83.166.204.26:7147/TEST/WS/Harmont%20Blaine_TEST/Page/WebItem?wsdl',
                             array('stream_context' => $context,
                                   'cache_wsdl' => WSDL_CACHE_NONE));

                             ));
    print_r($client);
}
catch(Exception $e){
    echo $e->getMessage();
}

and the result of my var_dump function is: SOAP-ERROR: Parsing WSDL: Couldn't load from .... failed to load external entity...

how can i access the web service via soap ? thx.

This is the beginning of the xml :enter image description here

Firstly: URL that you supply required Basic authentication. When using HTTP basic authentication, PHP will only send the credentials when invoking the service, not when fetching the WSDL.

You CAN get a wsdl, if basic authentication is required:

$login = 'xxx'; 
$password = 'xxx';

$client = new SoapClient(
     'http://' . urlencode($login) . ':' . urlencode($password) . '@83.166.204.26:7147/TEST/WS/Harmont%20Blaine_TEST/Page/WebItem?wsdl',
     array(
         'login' => $login,
         'password' => $password
     ) 
);

Secondly : Your return XML does not look like valid WSDL file. Read SoapClient documentation page for proper usage - first argument of new SoapClient() must be URI of WSDL file or null for non-WSDL usage. (Here is an example of WSDL file ) May be you need to create SoapClient in non-WSDL mode?

I just downloaded the file from 83.166.204.26:7147/TEST/WS/Harmont%20Blaine_TEST/Page/WebItem?wsdl. I saved it on wsdl format and now i'm getting the functions

$client = new SoapClient("WebItem.wsdl", array('proxy_host'     => "83.166.204.26",
                                            'proxy_port'     => 7147,
                                            'proxy_login'    => "xxxxxx",
                                            'proxy_password' => "xxxxxxxx"));
echo "<pre>"; var_dump($client->__getFunctions()); echo "</pre>";