protected function _getSoapXml($what, $value) { M('Ajax')->clear(); $root = M('Ajax')->init('soap:Envelope', array('xmlns:soap' => 'http://schemas.xmlsoap.org/soap/envelope/', 'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance', 'xmlns:xsd' => 'http://www.w3.org/2001/XMLSchema')); $soapHeader = $root->addNode('soap:Header', array(array())); $gepirRequestHeader = $soapHeader->addNode('gepirRequestHeader', array(array('xmlns' => 'http://www.gepir.org/'))); $gepirRequestHeader->addNode('requesterGln', array(array('__CDATA__' => '4600001999998'))); $gepirRequestHeader->addNode('cascade', array(array('__CDATA__' => '9'))); if ($this->_authorized === FALSE) { $gepirRequestHeader->addNode('username', array(array('__CDATA__' => '4607139949994'))); $gepirRequestHeader->addNode('password', array(array('__CDATA__' => '182443745'))); $this->_authorized = TRUE; } $soapBody = $root->addNode('soap:Body', array(array())); if ($what == 'gln') { $GetPartyByGLN = $soapBody->addNode('GetPartyByGLN', array(array('xmlns' => 'http://www.gepir.org/'))); $GetPartyByGLN->addNode('requestedGln', array(array('__CDATA__' => $value))); $requestedLanguages = $GetPartyByGLN->addNode('requestedLanguages', array(array())); } else { if ($what == 'barcode') { $GetItemByGTIN = $soapBody->addNode('GetItemByGTIN', array(array('xmlns' => 'http://www.gepir.org/'))); $GetItemByGTIN->addNode('requestedGtin', array(array('__CDATA__' => $value))); $requestedLanguages = $GetItemByGTIN->addNode('requestedLanguages', array(array())); } } $requestedLanguages->addNode('language', array(array('__CDATA__' => 'RU'))); $xml = M('Ajax')->getXml(); $this->_curl->clear(); $this->_curl->setTimeout(C('barcode.gepir-timeout')); $this->_curl->setUrl('http://gepir.ean.ru/GepirV3/router.asmx'); $this->_curl->addPostParam(NULL, $xml); return $this->_curl->execute(); }
public function executeRequest(RM_Map_iEngine $engine) { $this->_initCurl(M('Map')->getUrl()); $this->_curl->addPostParam('msg', $this->_initXml($engine)); return $this->_curl->execute(); }