Exemplo n.º 1
0
 public function testSerialization()
 {
     $transport = new SOAPDummyTransport();
     $client = new XPSoapClient('http://xp-framework.net/', 'urn://test');
     // Re-set transport as constructor created a copy of it!
     $client->setTransport($transport);
     $client->registerMapping(new \xml\QName('http://net.xp_framework/soap/types', 'SoapTestType'), \lang\XPClass::forName('webservices.unittest.soap.SoapMappingTestTarget'));
     try {
         $client->invoke('foo', new SoapMappingTestTarget('Teststring', 12345));
     } catch (\xml\XMLFormatException $ignored) {
         // We don't receive a "real" answer, which will cause an exception
     }
     $msg = $transport->getRequest();
     $body = $msg->_bodyElement();
     $this->assertEquals('http://net.xp_framework/soap/types', $body->nodeAt(0)->nodeAt(0)->getAttribute('xmlns:ns1'));
     $this->assertEquals('ns1:SoapTestType', $body->nodeAt(0)->nodeAt(0)->getAttribute('xsi:type'));
 }