2

AAA Cooper Transportation がホストする Web サービスを呼び出すためのアプリケーションを構築しようとしています。

AAA Cooper の指示と WSDL

wsdl2phpgeneratorを使用して、サービスを呼び出すために必要なコードを生成することになりました。

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;
  }

}
4

1 に答える 1

1

これをメインクラスに追加しました。フォームから 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 ) ;
     }
    ?>
于 2013-06-27T12:28:42.580 に答える