PHP SoapClient创建错误:“命名空间必须与封闭模式不匹配”

I'm getting "Namespace must not match the enclosing schema" error when trying to create SoapClient object. Code is simple:

<?php $client = new \SoapClient('http://www.server.com/Service?wsdl');

How can I create object by ignoring this error?

I'm not sure what the WSDL looks like, so it's a bit hard to tell if the error can be avoided. However, you can switch to creating a SoapClient using non WSDL mode:

$client = new SoapClient(null, array('location' => "http://localhost/soap.php",
                                 'uri'      => "http://test-uri/"));

Where location and uri are described as:

An array of options. If working in WSDL mode, this parameter is optional. If working in non-WSDL mode, the location and uri options must be set, where location is the URL to request and uri is the target namespace of the SOAP service.

Source: http://www.php.net/manual/en/soapclient.soapclient.php