如何从PHP中的SOAP请求属性中删除“ser”前缀

时间:2016-12-06 11:47:38

标签: php xml soap

我正在尝试从以下SOAP请求中删除'ser'属性:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ser="http://localhost/server">
   <soapenv:Header/>
   <soapenv:Body>
      <ser:eRoamingChargeDetailRecord>
         <SessionID>?</SessionID>
      </ser:eRoamingChargeDetailRecord>
   </soapenv:Body>
</soapenv:Envelope>

我希望它看起来像这样:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ser="localhost/blah">
   <soapenv:Header/>
   <soapenv:Body>
      <eRoamingChargeDetailRecord xmlns:ns2="localhost/blah" xmlns="localhost/blah">
         <SessionID>?</SessionID>
      </eRoamingChargeDetailRecord>
   </soapenv:Body>
</soapenv:Envelope>

但是,当我手动删除此前缀时,服务器会返回以下错误:

Procedure 'eRoamingChargeDetailRecord' not present

SOAP服务器在PHP中设置如下:

if (isset($_GET['wsdl'])) {
            ini_set('soap.wsdl_cache_enabled', 0);
            $soapAutoDiscover = new \Zend\Soap\AutoDiscover(new \Zend\Soap\Wsdl\ComplexTypeStrategy\ArrayOfTypeSequence());
            $soapAutoDiscover->setBindingStyle(array('style' => 'document'));
            $soapAutoDiscover->setOperationBodyStyle(array('use' => 'literal'));
            $soapAutoDiscover->setClass('\\App\\Helpers\\Soap\\SoapFunctions');
            $soapAutoDiscover->setUri('http://localhost/server');
            $soapAutoDiscover->handle();
        } else {
            $soap = new \Zend\Soap\Server('http://localhost/server?wsdl', array("soap_version" => SOAP_1_1));
            $soap->setObject(new \Zend\Soap\Server\DocumentLiteralWrapper(new \App\Helpers\Soap\SoapFunctions()));
            $soap->handle();
        }
}

功能是:

/**
 * This method takes ...
 *
 * @param string $SessionID
 * @return string
 */
public function eRoamingChargeDetailRecord($SessionID) {
    return "hello2 {$SessionID}";
}

如何删除此ser前缀?

I've found similar questions on SO, but these are related to Java

0 个答案:

没有答案
相关问题