Drupal 8找不到SoapClient类

I'm trying to consume a remote webservice but it doesnt work and I'm new to drupal. below is my code:

namespace Drupal\mymodule\mymoduleAPI;
class RemoteConnection {

  public function create() {

    $default = array( 
            // We shall only enable TRACING & EXCEPTION for dev 
            'trace' => 1, 
            'exceptions' => true, 
            'cache_wsdl' => WSDL_CACHE_NONE, 
            'features' => SOAP_SINGLE_ELEMENT_ARRAYS,
        );


    $myServerEndPointUrl = "wsdl server address";
    return new SoapClient($myServerEndPointUrl , $default);     
  }
}

This gives me the following error

Fatal error: Class 'Drupal\mymodule\mymoduleapi\SoapClient' not found in C:\wamp\www\drupalnew\modules\

So am I doing something wrong? I already checked the Soap extension and tested it outside drupal and found it to work fine.

Thanks

SoapClient is in the global namespace, so when accessing it from within your own namespace, use '\' in front of the class name, like:

return new \SoapClient($myServerEndPointUrl , $default); 

Further info Here

You can add a use command after your namespace:

use \SoapClient;

e.g.

namespace Drupal\module_name\Plugin\Block;

use Drupal\Core\Block\BlockBase;
use SoapClient;