簡體   English   中英

網絡服務 SOAP 中的參數

[英]Parameters in webservice SOAP

我很快就開始通過 SOAP 處理網絡服務,我有一個問題,我需要在請求中發送以下信息:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ser="http://services.senior.com.br">
   <soapenv:Header/>
   <soapenv:Body>
      <ser:AniversariantesMes>
         <user>usuario</user>
         <password>senha</password>
         <encryption>0</encryption>
         <parameters>
            <!--Optional:-->
            <competencia>01/01/2020</competencia>
            <!--Optional:-->
            <flowInstanceID>?</flowInstanceID>
            <!--Optional:-->
            <flowName>?</flowName>
         </parameters>
      </ser:AniversariantesMes>
   </soapenv:Body>
</soapenv:Envelope>

我正在嘗試使用以下代碼:

$client = new SoapClient('link do soap');

$function = 'AniversariantesMes';

$parameters = [
    'competencia' => '01/01/2020',
];

$arguments = array('AniversariantesMes' => array(
                        'user'          =>  'senior',
                        'password'      =>  'senior',
                        'encryption'    =>  0,
                        'parameters'    =>  $parameters,
));

print_r($arguments);

$options = array('location' => 'link');

$result  = $client -> __soapCall($function,$arguments,$options);

print_r($result);

代碼不考慮“Competencia”並提供默認值(我在 SoapUI 上測試了過濾器,並在通過 'Competencia' 01/01/2020 時過濾了 1 月的生日)

你能在你的 $parameters 中測試下面的函數嗎?

 function SoapVar($key , $value) { return new SoapVar("<".$key.">".$value."</".$key.">", XSD_ANYXML, null, null, null); } $parameters = [SoapVar( 'competencia' , '02/01/2020')];

希望有用。

暫無
暫無

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

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