通过https使用SoapClient在PHP中调用WCF时出现致命错误

通过https使用SoapClient在PHP中调用WCF时出现致命错误,php,wcf,wsdl,webservice-client,soap-client,Php,Wcf,Wsdl,Webservice Client,Soap Client,我是服务新手,目前正在使用SoapClient对象在PHP中调用.NETWCF服务。代码如下: $arr2=array('paymentVendorCode'=>"test1",'transactionNumber'=>123456789,'dataSource'=>'Ghana_QA','customerNumber'=>45678912,'amount'=>10,'invoicePeriod'=>1,'currency'=>'GHC','pa

我是服务新手,目前正在使用SoapClient对象在PHP中调用.NETWCF服务。代码如下:

    $arr2=array('paymentVendorCode'=>"test1",'transactionNumber'=>123456789,'dataSource'=>'Ghana_QA','customerNumber'=>45678912,'amount'=>10,'invoicePeriod'=>1,'currency'=>'GHC','paymentDescription'=>'CashPayment','methodofPayment'=>'CASH','productCollection'=>'PRCC4');

    $certFile = "certs/Entrust.pem";
    $options = array('soap_version' => SOAP_1_1 , 'local_cert' => $certFile , 'exceptions' => true ,'trace' => true ,'wdsl_local_copy' => true ,'ssl' => array('verify_peer' => false) ,'https' => array('curl_verify_ssl_peer'  => false, 'curl_verify_ssl_host' => false)
           );

try
{
echo "SOAP Client Object Made <br />";
//To Make soap client using WSDL files offline
$client = new SoapClient("RTPP_Web_Service_WSDL_20130306/multichoice.paymentservice.wsdl",$options);    
}
catch(SoapFault $E)
{
    echo "Error:--> ".$E->faultstring;
}

print_r($client->__getFunctions());

try
{
echo $pmt_customer=$client->__call("SubmitPayment", $arr2)."<br /><br />";
}
catch(SoapFault $fault)
{
echo "came here in catch";
trigger_error("SOAP Fault:(faultcode: {$fault->faultcode}\n"."faultstring: {$fault->faultstring})", E_USER_ERROR);  
 }
<soap:address location="https://wispqa.multichoice.co.za/PaymentServicePerimeter/Intermediate.svc" />
$arr2=array('paymentVendorCode'=>test1'、'transactionNumber'=>123456789、'dataSource'=>加纳QA'、'customerNumber'=>45678912、'amount'=>10、'invoicePeriod'=>1、'currency'=>GHC'、'paymentDescription'=>CashPayment'、'Payment'=>CashPayment'、'methodofPayment'=>CASH'、'productCollection'=>PRCC4');
$certFile=“certs/trust.pem”;
$options=array('soap\u version'=>soap\u 1\u 1,'local\u cert'=>$certFile,'exceptions'=>true,'wdsl\u local\u copy'=>true,'ssl'=>array('verify\u peer'=>false),'https'=>array('curl\u verify\u ssl\u peer'=>false,'curl\u verify\u ssl\u host'=>false)
);
尝试
{
回显“SOAP客户端对象已生成
”; //使使用WSDL文件的soap客户端脱机 $client=newsoapclient(“RTPP\u Web\u Service\u WSDL\u 20130306/multichoice.paymentservice.WSDL”,$options); } 捕获(SoapFault$E) { echo“Error:-->.”$E->faultstring; } 打印($client->uu getFunctions()); 尝试 { echo$pmt_customer=$client->_call(“SubmitPayment”,即$arr2)。“

”; } catch(SoapFault$fault) { 埃科“是来抓的”; 触发错误(“SOAP错误:(错误代码:{$Fault->faultcode}\n”。“错误字符串:{$Fault->FAULTCONSTRING})”,E\u用户错误); }
我已经浏览了我正在使用的所有WSDL文件,并获得了其中一个WSDL文件soap地址中的所有元素、消息、操作、参数等,如下所示:

    $arr2=array('paymentVendorCode'=>"test1",'transactionNumber'=>123456789,'dataSource'=>'Ghana_QA','customerNumber'=>45678912,'amount'=>10,'invoicePeriod'=>1,'currency'=>'GHC','paymentDescription'=>'CashPayment','methodofPayment'=>'CASH','productCollection'=>'PRCC4');

    $certFile = "certs/Entrust.pem";
    $options = array('soap_version' => SOAP_1_1 , 'local_cert' => $certFile , 'exceptions' => true ,'trace' => true ,'wdsl_local_copy' => true ,'ssl' => array('verify_peer' => false) ,'https' => array('curl_verify_ssl_peer'  => false, 'curl_verify_ssl_host' => false)
           );

try
{
echo "SOAP Client Object Made <br />";
//To Make soap client using WSDL files offline
$client = new SoapClient("RTPP_Web_Service_WSDL_20130306/multichoice.paymentservice.wsdl",$options);    
}
catch(SoapFault $E)
{
    echo "Error:--> ".$E->faultstring;
}

print_r($client->__getFunctions());

try
{
echo $pmt_customer=$client->__call("SubmitPayment", $arr2)."<br /><br />";
}
catch(SoapFault $fault)
{
echo "came here in catch";
trigger_error("SOAP Fault:(faultcode: {$fault->faultcode}\n"."faultstring: {$fault->faultstring})", E_USER_ERROR);  
 }
<soap:address location="https://wispqa.multichoice.co.za/PaymentServicePerimeter/Intermediate.svc" />

这是被调用的服务的实际地址,通常在url的末尾使用?WSDL调用服务,但即使在上面url的末尾添加了?WSDL,服务页面的外观仍然保持不变

服务文档中有一句话是这样写的:“服务当前不使用消息契约。”

我正在从调用“$client->\uuu getFunction()”得到的列表中调用其方法之一,向服务发送请求。但它并没有做出回应,而是给出了致命的错误,这可以从网站的截图上看到


我已经做了差不多一个星期了,但是我被困在这里了。如果有人能带我离开这里,请。提前感谢。

我得到了答案,我缺少的是调用方法的soap操作。我通过彻底访问WSDL文件给出了soap操作,并为我调用的方法找到了soap操作:

  $submitpayment_action   = "http://MultiChoice.PaymentService/ServiceContracts/PaymentServiceContract/SubmitPayment";
此外,我还使用xml格式更改了请求的格式,其摘录如下(我使用SOAPUI工具获得了此xml格式):

这显示了我想要的响应。现在可以使用“simplexml_load_string($response);”、“registerXPathNamespace()”和“xpath('//string');”方法从响应中提取所需信息