SOAP请求和响应不是XML格式

时间:2014-11-10 19:36:42

标签: php xml soap

我有以下带有SOAP的PHP代码

<?php
    $client = new SoapClient(null, array( 
        'location' => 'http://www.adler.info/b2bsoap.php', 
        'uri' => 'http://test-uri/', 
        'trace' => true, 
        'stream_context' => true, 
        'exceptions'=> false, 
        'login' => 'myname', 
        'password' => 'password' 
    ));

    $result= $client->stock(array('format'=>'xml', 'structure'=>'complex'));
    echo "REQUEST HEADERS:\n" . $client->__getLastRequestHeaders() . "\n";
    echo '<BR />---------------------------------------<BR />';
    echo "REQUEST:\n" . $client->__getLastRequest() . "\n";
    echo '<BR />---------------------------------------<BR />';
    echo "Response:\n" . $client->__getLastResponse() . "\n";
?>

这是输出:

REQUEST HEADERS: POST /b2bsoap.php HTTP/1.1 Host: www.adler.info Connection: Keep-Alive User-Agent: PHP-SOAP/5.6.0 Content-Type: text/xml; charset=utf-8 SOAPAction: "http://test-uri/#stock" Content-Length: 716 Authorization: Basic MWFkbGVyOkFkbWluc2R6cA==
---------------------------------------
REQUEST: formatxmlstructurecomplex
---------------------------------------
Response: nomenid_nomen0100000000000001number1000008deliverydate2014-11-12count9666id_nomen0100000000000002number1000009deliverydate2014-11-12count14210... (it's longer, but the same type)

我希望以XML格式提供SOAP响应。但正如你所看到的,这只是简单的没有格式化的文本。但是我不理解它,因为在标题中你可以看到Content-Type:text / xml。

如何以XML格式获得响应? 谢谢!

0 个答案:

没有答案