簡體   English   中英

帶有.NET客戶端的Zend Soap Server-“未知錯誤”

[英]Zend Soap Server with .NET client - 'unknown error'

我已經使用Zend Soap Server實現了一個Web服務。

使用PHP客戶端(Zend客戶端)連接到它,可以正常工作。 但是,對於.NET客戶端,它會返回無用的錯誤“未知錯誤”。

錯誤日志顯示:

PHP Notice:  Array to string conversion in /path/to/app/vendor/zendframework/zend-soap/Zend/Soap/Server.php on line 881

有人遇到過這個問題嗎? 這是我的服務器代碼:

public function server()
{
    // Soap Server options
    $options = array(
        'classmap' => array(
            'TransactionType' => 'Acme\TransactionType',
        ),
    );

    // Create Soap Server
    $server = new Server(public_path('file.wsdl'), $options);

    // Bind Class to Soap Server
    $server->setClass('Acme\Transaction');

    // Handle request
    $server->handle();

}

public function wsdl()
{
    // Output WSDL
    $autodiscover = new AutoDiscover(new ArrayOfTypeSequence());
    $autodiscover->setClass('Acme\Transaction')
                 ->setUri(\URL::route('server'))
                 ->setServiceName('AcmeTransactions');
    $wsdl = $autodiscover->generate();

    $wsdl->dump(public_path('file.wsdl'));
}

Acme / Transaction看起來像這樣:

class Transaction extends \Eloquent
{

 /**
 * The database table used by the model.
 *
 * @var string
 */
protected $table = 'transactions';

/**
 * The attributes that aren't mass assignable.
 *
 * @var array
 */
protected $guarded = array();

/**
 * Saves a TransactionType to the database.
 *
 * @param TransactionType $transaction
 *
 * @return bool
 */
public static function saveTransaction(TransactionType $transaction)
{
    /**
     * @var Transaction $model
     */
    $model = new self();
    $model->fill(
        array(
            'transaction_id'       => $transaction->transaction_id,
            'transaction_number'   => $transaction->transaction_number,
            // ...
        )
    );

    return $model->save();
}

}

Acme / TransactionType看起來像這樣:

class TransactionType {

/**
 * @var string
 */
public $transaction_id = '';

/**
 * @var string
 */
public $transaction_number = '';

// ...

}

通過使用Zend \\ Soap \\ Server \\ DocumentLiteralWrapper解決了此問題。

http://framework.zend.com/manual/2.2/en/modules/zend.soap.server.html#document-literal-wsdl-handling

故事的寓意-如果要構建需要由C#客戶端使用的Zend Soap Server,請查看document-literal-wsdl-handling處理以解決此類跨平台問題。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM