/** * Constructor * * @param array params */ public function __construct($params) { $this->item = new XPSoapNode('hash', null, ['xmlns:hash' => 'http://xml.apache.org/xml-soap', 'xsi:type' => 'hash:Map']); foreach ($params as $key => $value) { $this->item->addChild(XPSoapNode::fromArray(['key' => $key, 'value' => $value], 'item')); } }
public function soapHashmap() { $node = new XPSoapNode('item', '', ['xmlns:hash' => 'http://xml.apache.org/xml-soap', 'xsi:type' => 'hash:Map']); $node->addChild(new XPSoapNode('item'))->withChild(new XPSoapNode('key', 'key', ['xsi:type' => 'xsd:string']))->withChild(new XPSoapNode('value', 'value', ['xsi:type' => 'xsd:string'])); $this->assertEquals($node, $this->node(new SOAPHashMap(['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'); }