簡體   English   中英

php soap 調用問題傳遞參數

[英]php soap call problem passing a parameter

我創建了這個 SOAP 調用

   header('Content-Type: text/html; charset=utf-8');

ini_set('soap.wsdl_cache_enable', 0 );
ini_set('soap.wsdl_cache_ttl', 0 );
ini_set('memory_limit','64M');
ini_set('max_execution_time', 1500); 

$loc        = "https://MyEndPoint";
$urlWSDL    = $loc . ".wsdl";

$ops = array(
    'trace'         => 1,
    'exceptions'    => 0,       
    'compression'   => SOAP_COMPRESSION_ACCEPT | SOAP_COMPRESSION_GZIP | SOAP_COMPRESSION_DEFLATE,
    'style'         => SOAP_DOCUMENT,
    'use'           => SOAP_LITERAL,
    'soap_version'  => SOAP_1_1,
    "ResponseType"  => "Xml",
    'encoding'      => 'UTF-8'
);

try 
{
    $clientSOAP = new SoapClient($urlWSDL, $ops);
    $clientSOAP->__setLocation($loc);   
} 
catch (e $exception) {
        ECHO "WS not active";
}

try {
    $params = array(
            "customer id='reset'"    => "Cust " ,    
            "value"  => "MyValue"                         
    );

    $result = $clientSOAP->sendCustomer($params);

    $strresult =  $clientSOAP->__getLastResponse();

} catch (SoapFault $exception) {
    echo '<h2>EXCEPTION</h2>';  
    echo "det.::\n" . $clientSOAP->__getLastResponse() . "\n";
    echo $exception;      
}   

但我總是遇到錯誤

"customer id='reset'"    => "Cust " , 

去除

id='重置'

通話正常,但我需要傳遞該 ID。

有任何想法嗎?

我試過沒有結果:

 "customer id=&quot;reset&quot;"    => "Cust " ,

我也嘗試用單引號替換雙引號,但總是在同一行出現錯誤

我也嘗試過從第三方軟件撥打電話,撥打電話正確,結果符合預期

結構應該是

<customer id='reset'>
myCust  
</customer>

謝謝果醬

暫無
暫無

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

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