public function testDeserialization()
    {
        $transport = new SOAPDummyTransport();
        $transport->setAnswer('<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
 <soapenv:Body soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
  <ns1:getTestsResponse xmlns:ns1="urn://test">
   <result href="#id1"/>
  </ns1:getTestsResponse>
  <multiRef id="id1" soapenc:root="0" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="ns4:SoapTestType" xmlns:ns4="http://net.xp_framework/soap/types" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
   <string xsi:type="xsd:string">Test-String</string>
   <integer xsi:type="xsd:long">12345</integer>
  </multiRef>
 </soapenv:Body>
</soapenv:Envelope>
      ');
        $client = new XPSoapClient('http://xp-framework.net/', 'urn://test');
        $client->setTransport($transport);
        $client->registerMapping(new QName('http://net.xp_framework/soap/types', 'SoapTestType'), XPClass::forName('net.xp_framework.unittest.soap.SoapMappingTestTarget'));
        $res = $client->invoke('test');
        $this->assertClass($res, 'net.xp_framework.unittest.soap.SoapMappingTestTarget');
        $this->assertEquals('Test-String', $res->getString());
        $this->assertEquals(12345, $res->getInteger());
    }
Exemplo n.º 2
0
    public function testDeepArrayResult()
    {
        $transport = new SOAPDummyTransport();
        $transport->setAnswer('<?xml version="1.0" encoding="iso-8859-1"?>
<SOAP-ENV:Envelope
 xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
 xmlns:xsd="http://www.w3.org/2001/XMLSchema"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
 xmlns:si="http://soapinterop.org/xsd"
 SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
 xmlns:ctl="ctl"
>
  <SOAP-ENV:Body>  
    <ctl:irrelevant>
      <item>
        <scalar>some string</scalar>
        <array>
          <string>first value</string>
          <string>second value</string>
        </array>
      </item>
    </ctl:irrelevant>
  </SOAP-ENV:Body>
</SOAP-ENV:Envelope>
');
        $client = new XPSoapClient('http://xp-framework.net/', 'urn://test');
        $client->setTransport($transport);
        $this->assertEquals(array('scalar' => 'some string', 'array' => array('string' => array('first value', 'second value'))), $client->invoke('irrelevant'));
    }