2010-05-24 91 views
1

我想模仿使用Zend_Soap_Client的請求。如何在SOAP請求正文中發送散列數據?

<SOAP-ENV:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:clr="http://schemas.microsoft.com/soap/encoding/clr/1.0" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> 
<SOAP-ENV:Header> 
<h3:__MethodSignature xsi:type="SOAP-ENC:methodSignature" 
xmlns:h3="http://schemas.microsoft.com/clr/soap/messageProperties" SOAP-ENC:root="1" 
xmlns:a2="http://schemas.microsoft.com/clr/ns/System.Collections">xsd:string a2:Hashtable</h3:__MethodSignature> 
</SOAP-ENV:Header> 

<SOAP-ENV:Body> 
    <i4:ReturnDataSet id="ref-1" xmlns:i4="http://schemas.microsoft.com/clr/nsassem/Interface.IRptSchedule/Interface"> 
    <sProc id="ref-5">BU</sProc> 
    <ht href="#ref-6"/> 
    </i4:ReturnDataSet><br/> 

    <a2:Hashtable id="ref-6" xmlns:a2="http://schemas.microsoft.com/clr/ns/System.Collections"> 
    <LoadFactor>0.72</LoadFactor> 
    <Version>1</Version> 
    <Comparer xsi:null="1"/> 
    <HashCodeProvider xsi:null="1"/> 
    <HashSize>11</HashSize> 
    <Keys href="#ref-7"/> 
    <Values href="#ref-8"/> 
    </a2:Hashtable> 

    <SOAP-ENC:Array id="ref-7" SOAP-ENC:arrayType="xsd:anyType[1]"> 
    <item id="ref-9" xsi:type="SOAP-ENC:string">@AppName</item> 
    </SOAP-ENC:Array><br/> 

    <SOAP-ENC:Array id="ref-8" SOAP-ENC:arrayType="xsd:anyType[1]"> 
    <item id="ref-10" xsi:type="SOAP-ENC:string">AAGENT</item> 
    </SOAP-ENC:Array> 
</SOAP-ENV:Body> 
</SOAP-ENV:Envelope> 

似乎不知何故,我已經給送散列「REF-7」「REF-8」陣列嵌入體內?我怎樣才能做到這一點?

功能ReturnDataSet採用兩個參數,如何可以發送附加「REF-7」「REF-8」陣列數據?

$client = new SoapClient($wsdl_url, array('soap_version' => SOAP_1_1)); 
$result = $client->ReturnDataset("BU", $ht); 

我不知道如何設置$ HT,使散列數據作爲不同的身體進入發送。

謝謝。

回答

0

你有沒有嘗試發送一個二維數組爲$ ht?從查看代碼,$ ht對應於一個使用ref-7和ref-8作爲數組本身的散列表。

我試圖在Visual Studio中打開這個服務來了解參數的類型,但我收到了一些模式錯誤,主要是缺少dataTypes。你確定這個Web服務已經配置好了嗎?

+0

我試着發送2D數組,但它給了我錯誤。爲了測試目的,我使用CURL發送了整個請求,並按預期工作。 – understack 2010-06-02 17:55:19

相關問題