How to make a PHP SOAP call using the SoapClient class

后端 未结 12 728
星月不相逢
星月不相逢 2020-11-22 17:28

I\'m used to writing PHP code, but do not often use Object-Oriented coding. I now need to interact with SOAP (as a client) and am not able to get the syntax right. I\'ve got

12条回答
  •  Happy的楠姐
    2020-11-22 17:38

    getLastRequest():

    This method works only if the SoapClient object was created with the trace option set to TRUE.

    TRUE in this case is represented by 1

    $wsdl = storage_path('app/mywsdl.wsdl');
    try{
    
      $options = array(
                   // 'soap_version'=>SOAP_1_1,
                   'trace'=>1,
                   'exceptions'=>1,
    
                    'cache_wsdl'=>WSDL_CACHE_NONE,
                 //   'stream_context' => stream_context_create($arrContextOptions)
            );
               // $client = new \SoapClient($wsdl, array('cache_wsdl' => WSDL_CACHE_NONE) );
            $client = new \SoapClient($wsdl, array('cache_wsdl' => WSDL_CACHE_NONE));
            $client     = new \SoapClient($wsdl,$options); 
    

    worked for me.

提交回复
热议问题