SoapClient __do请求返回NULL

时间:2018-02-28 20:49:14

标签: php xml soap soap-client

我有这个请求,我需要从服务器获得响应但是获得NULL

$XML = "<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:esh="http://eshop.gf.lt/">
   <soapenv:Header/>
   <soapenv:Body>
      <esh:StartDealSession_v2>
         <product>EL</product>
         <merchantId>some_id</merchantId>
         <orderNo>123</orderNo>
         <totalAmount>790.90</totalAmount>
         <totalAmountCurrency>EUR</totalAmountCurrency>
         <totalAmountCurrRate>1.00</totalAmountCurrRate>
         <loanAdvance>0</loanAdvance>
         <sKey>password</sKey>
         <basket>
            <!--1 or more repetitions:-->
            <item>
               <code>1112</code>
               <type>KIT</type>
               <title>TEST</title>
               <category>KIT</category>
               <service>GDT</service>
               <sum>790.90</sum>
               <amount>1</amount>
               <currency>EUR</currency>
               <rate>1.00</rate>
            </item>
         </basket>
         <returnUrl>www.myshop.com/callback</returnUrl>
      </esh:StartDealSession_v2>
   </soapenv:Body>
</soapenv:Envelope>";

我正在创建新的肥皂客户端:

$soap = new SoapClient($soapclient_link_wsdl, array('trace' => 1));

并请求:

   try {
            $result = $soap->__doRequest($XML, $soaprequest_link, 'StartDealSession_v2', 0);
            if (!$result) {
            return $result;
        } else {
            return false;
        }

    } catch (Exception $e) {
        $e = 0;
        return $e;
     } 

回应应该是:

<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
   <S:Body>
      <ns2:StartDealSession_v2Response xmlns:ns2="http://eshop.gf.lt/">
         <return>
            <dealSessionId>D5C5123F30C20509E043C476A8C03B13</dealSessionId>
            <resultCode>1</resultCode>
         </return>
      </ns2:StartDealSession_v2Response>
   </S:Body>
</S:Envelope>

$result收到NULL。 我需要在Virtuemart(JOOMLA)自定义支付模块中使用

有人可以帮忙解决这个问题吗?我的代码有什么问题?

0 个答案:

没有答案