/** * Constructor * * @param array params */ public function __construct($params) { $this->item = new XPSoapNode('hash', NULL, array('xmlns:hash' => 'http://xml.apache.org/xml-soap', 'xsi:type' => 'hash:Map')); foreach ($params as $key => $value) { $this->item->addChild(XPSoapNode::fromArray(array('key' => $key, 'value' => $value), 'item')); } }
public function soapHashmap() { $node = new XPSoapNode('item', '', array('xmlns:hash' => 'http://xml.apache.org/xml-soap', 'xsi:type' => 'hash:Map')); $node->addChild(new XPSoapNode('item'))->withChild(new XPSoapNode('key', 'key', array('xsi:type' => 'xsd:string')))->withChild(new XPSoapNode('value', 'value', array('xsi:type' => 'xsd:string'))); $this->assertEquals($node, $this->node(new SOAPHashMap(array('key' => 'value')))); }
/** * Set fault * * @param int faultcode * @param string faultstring * @param string faultactor default NULL * @param var detail default NULL */ public function setFault($faultcode, $faultstring, $faultactor = NULL, $detail = NULL) { $node = $this->root()->nodeAt(0); $node->clearChildren(); $node->addChild(XPSoapNode::fromObject(new CommonSoapFault($faultcode, $faultstring, $faultactor, $detail), 'SOAP-ENV:Fault', $this->mapping)); $node->nodeAt(0)->setName('SOAP-ENV:Fault'); }