Php 使用WSDL2HPGenerator生成的类

Php 使用WSDL2HPGenerator生成的类,php,class,wsdl,Php,Class,Wsdl,我正在尝试构建和应用程序来调用AAA Cooper Transportation托管的web服务 $ProNo="73266840"; $ImageType="BL"; $ImageFormat="PDF"; $Token="#######-####-###-######-########"; 我最终使用生成调用服务所需的代码 我正在尝试构建和应用程序来调用AAA Cooper Transportation托管的web服务。 我正在尝试构建和应用程序来调用AAA Cooper Transpo

我正在尝试构建和应用程序来调用AAA Cooper Transportation托管的web服务

$ProNo="73266840";
$ImageType="BL";
$ImageFormat="PDF";
$Token="#######-####-###-######-########";

我最终使用生成调用服务所需的代码

我正在尝试构建和应用程序来调用AAA Cooper Transportation托管的web服务。
我正在尝试构建和应用程序来调用AAA Cooper Transportation托管的web服务。
我正在尝试构建和应用程序来调用AAA Cooper Transportation托管的web服务

$ProNo="73266840";
$ImageType="BL";
$ImageFormat="PDF";
$Token="#######-####-###-######-########";
ActDocumentSearch.php

        <?php

    include_once('GetDocument.php');
    include_once('ActImgSearchServiceRequestVO.php');
    include_once('GetDocumentResponse.php');
    include_once('ActImgSearchServiceResponseVO.php');
    include_once('UserCredentials.php');


    /**
     * 
     */
    class ActDocumentSearch extends SoapClient
    {

      /**
       * 
       * @var array $classmap The defined classes
       * @access private
       */
      private static $classmap = array(
        'GetDocument' => 'GetDocument',
        'ActImgSearchServiceRequestVO' => 'ActImgSearchServiceRequestVO',
        'GetDocumentResponse' => 'GetDocumentResponse',
        'ActImgSearchServiceResponseVO' => 'ActImgSearchServiceResponseVO',
        'UserCredentials' => 'UserCredentials');

      /**
       * 
       * @param array $config A array of config values
       * @param string $wsdl The wsdl file to use
       * @access public
       */
      public function __construct(array $options = array(), $wsdl = 'http://www.aaacooper.com/ws/ActDocumentSearch.asmx?wsdl')
      {
        foreach(self::$classmap as $key => $value)
        {
          if(!isset($options['classmap'][$key]))
          {
            $options['classmap'][$key] = $value;
          }
        }

        parent::__construct($wsdl, $options);
      }

      /**
       * 
       * @param GetDocument $parameters
       * @access public
       */
      public function GetDocument(GetDocument $parameters)
      {
        return $this->__soapCall('GetDocument', array($parameters));
      }

    }


<?php

class UserCredentials
{

  /**
   * 
   * @var string $token
   * @access public
   */
  public $token;

  /**
   * 
   * @param string $token
   * @access public
   */
  public function __construct($token)
  {
    $this->token = $token;
  }

}

<?php

class GetDocumentResponse
{

  /**
   * 
   * @var ActImgSearchServiceResponseVO $GetDocumentResult
   * @access public
   */
  public $GetDocumentResult;

  /**
   * 
   * @param ActImgSearchServiceResponseVO $GetDocumentResult
   * @access public
   */
  public function __construct($GetDocumentResult)
  {
    $this->GetDocumentResult = $GetDocumentResult;
  }

}

<?php

class GetDocument
{

  /**
   * 
   * @var ActImgSearchServiceRequestVO $actImgSearchServiceRequestVO
   * @access public
   */
  public $actImgSearchServiceRequestVO;

  /**
   * 
   * @param ActImgSearchServiceRequestVO $actImgSearchServiceRequestVO
   * @access public
   */
  public function __construct($actImgSearchServiceRequestVO)
  {
    $this->actImgSearchServiceRequestVO = $actImgSearchServiceRequestVO;
  }

}
<?php

class ActImgSearchServiceResponseVO
{

  /**
   * 
   * @var string $ProNo
   * @access public
   */
  public $ProNo;

  /**
   * 
   * @var string $ImageType
   * @access public
   */
  public $ImageType;

  /**
   * 
   * @var string $ImageFormat
   * @access public
   */
  public $ImageFormat;

  /**
   * 
   * @var anyType $ImageUrl
   * @access public
   */
  public $ImageUrl;

  /**
   * 
   * @var string $ErrorMessage
   * @access public
   */
  public $ErrorMessage;

  /**
   * 
   * @param string $ProNo
   * @param string $ImageType
   * @param string $ImageFormat
   * @param anyType $ImageUrl
   * @param string $ErrorMessage
   * @access public
   */
  public function __construct($ProNo, $ImageType, $ImageFormat, $ImageUrl, $ErrorMessage)
  {
    $this->ProNo = $ProNo;
    $this->ImageType = $ImageType;
    $this->ImageFormat = $ImageFormat;
    $this->ImageUrl = $ImageUrl;
    $this->ErrorMessage = $ErrorMessage;
  }

}
<?php

class ActImgSearchServiceRequestVO
{

  /**
   * 
   * @var string $ProNo
   * @access public
   */
  public $ProNo;

  /**
   * 
   * @var string $ImageType
   * @access public
   */
  public $ImageType;

  /**
   * 
   * @var string $ImageFormat
   * @access public
   */
  public $ImageFormat;

  /**
   * 
   * @param string $ProNo
   * @param string $ImageType
   * @param string $ImageFormat
   * @access public
   */
  public function __construct($ProNo, $ImageType, $ImageFormat)
  {
    $this->ProNo = $ProNo;
    $this->ImageType = $ImageType;
    $this->ImageFormat = $ImageFormat;
  }

}

将其添加到主类中。我从表单中获取PRO和DOC类型。然后我将用户重定向到请求映像。这是我在网上看到的第一个例子。不确定代码是否写得好,但是否有效

        $ProNo=$_GET['PRO'];
        $ImageType=$_GET['DocType'];
        $ImageFormat="PDF";
        $Token="####################################";

        try{

    $actImage = new ActImgSearchServiceRequestVO($ProNo, $ImageType, $ImageFormat);
    $creds = new UserCredentials($Token);
    $getter = new GetDocument($actImage);
    $searcher = new ActDocumentSearch(array('trace' => 1));

    $header = new SoapHeader('http://www.aaacooper.com/','UserCredentials',$creds);
    $searcher->__setSoapHeaders($header);
    $reciever = $searcher->GetDocument($getter,array($actImage,$creds));  
        }
        catch(SoapFault $exception)
        {
            echo $exception->getMessage();
        }

    if ($reciever->GetDocumentResult->ImageUrl == ''){
    echo '<h1>' . $reciever->GetDocumentResult->ErrorMessage . '</h1>';
    }else{
     header( 'Location: ' . $reciever->GetDocumentResult->ImageUrl ) ;
     }
    ?>
$ProNo=$\u GET['PRO'];
$ImageType=$_GET['DocType'];
$ImageFormat=“PDF”;
$Token=“#########################;
试一试{
$actImage=新的ActImgSearchServiceRequestVO($ProNo、$ImageType、$ImageFormat);
$creds=新用户凭据($Token);
$getter=新的GetDocument($actImage);
$searcher=newactdocumentsearch(数组('trace'=>1));
$header=新的SoapHeader('http://www.aaacooper.com/'、'UserCredentials'、$creds);
$searcher->uu setSoapHeaders($header);
$receiver=$searcher->GetDocument($getter,array($actImage,$creds));
}
catch(SoapFault$异常)
{
echo$exception->getMessage();
}
如果($Receiver->GetDocumentResult->ImageUrl=''){
回显“”。$Receiver->GetDocumentResult->ErrorMessage。“;
}否则{
标题('Location:'.$Receiver->GetDocumentResult->ImageUrl);
}
?>