/** * Handle * * @param string $calling_component_filename Filename * @param string $service_description Service description * * @return mixed */ public function handle($calling_component_filename, $service_description) { SCA::$logger->log('Entering'); $class_name = SCA_Helper::guessClassName($calling_component_filename); $wsdl_filename = str_replace('.php', '.wsdl', $calling_component_filename); if (!file_exists($wsdl_filename)) { file_put_contents($wsdl_filename, SCA_Bindings_Soap_ServiceDescriptionGenerator::generateDocumentLiteralWrappedWsdl($service_description)); } $handler = new SCA_Bindings_soap_Mapper("SoapServer"); try { SCA::$logger->log("Wsdl Type = {$wsdl_filename}"); $handler->setWSDLTypes($wsdl_filename); } catch (SCA_RuntimeException $wsdlerror) { echo $wsdlerror->exceptionString() . "\n"; } if (SCA_Helper::wsdlWasGeneratedForAnScaComponent($wsdl_filename)) { $options = $service_description->binding_config; $options['typemap'] = $handler->getTypeMap(); $server = new SoapServer($wsdl_filename, $options); } else { $server = new SoapServer($wsdl_filename, $service_description->binding_config); } $class_name = SCA_Helper::guessClassName($calling_component_filename); $service_wrapper = new SCA_Bindings_Soap_Wrapper($class_name, $handler); $server->setObject($service_wrapper); global $HTTP_RAW_POST_DATA; $server->handle($HTTP_RAW_POST_DATA); }
public function testToXmlHandlesNullInXml() { $xml = <<<XML <?xml version="1.0" encoding="UTF-8"?> <fourargs xmlns="http://TypeHandlerTest1" xsi:type="fourargs" xmlns:tns="http://TypeHandlerTest1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <a xmlns="http://TypeHandlerTest1" xsi:nil="true"/> <b xmlns="http://TypeHandlerTest1" xsi:nil="true"/> <c xmlns="http://TypeHandlerTest1" xsi:nil="true"/> <d xmlns="http://TypeHandlerTest1" xsi:nil="true"/> </fourargs> XML; $th = new SCA_Bindings_soap_Mapper('SoapServer'); $th->setWSDLTypes('TypeHandlerTest1.wsdl'); $sdo = $th->fromXML($xml); $this->assertEquals('fourargs', $sdo->getTypename()); $this->assertEquals(null, $sdo->a); $this->assertEquals(null, $sdo->b); $this->assertEquals(null, $sdo->c); $this->assertEquals(null, $sdo->d); }