Fix WSDL schema stylesheet including

This commit is contained in:
Rekky 2013-11-26 11:39:07 +04:00 committed by Francis Besset
parent 8788d7595d
commit 1e82d7fdd7
3 changed files with 15 additions and 1 deletions

View File

@ -44,6 +44,7 @@
<argument key="binder_request_header_class">%besimple.soap.binder.request_header.rpcliteral.class%</argument> <argument key="binder_request_header_class">%besimple.soap.binder.request_header.rpcliteral.class%</argument>
<argument key="binder_request_class">%besimple.soap.binder.request.rpcliteral.class%</argument> <argument key="binder_request_class">%besimple.soap.binder.request.rpcliteral.class%</argument>
<argument key="binder_response_class">%besimple.soap.binder.response.rpcliteral.class%</argument> <argument key="binder_response_class">%besimple.soap.binder.response.rpcliteral.class%</argument>
<argument key="wsdl_stylesheet">%besimple.soap.definition.dumper.options.stylesheet%</argument>
</argument> </argument>
<argument type="service" id="besimple.soap.cache" /> <argument type="service" id="besimple.soap.cache" />
</service> </service>
@ -58,6 +59,7 @@
<argument key="binder_request_header_class">%besimple.soap.binder.request_header.documentwrapped.class%</argument> <argument key="binder_request_header_class">%besimple.soap.binder.request_header.documentwrapped.class%</argument>
<argument key="binder_request_class">%besimple.soap.binder.request.documentwrapped.class%</argument> <argument key="binder_request_class">%besimple.soap.binder.request.documentwrapped.class%</argument>
<argument key="binder_response_class">%besimple.soap.binder.response.documentwrapped.class%</argument> <argument key="binder_response_class">%besimple.soap.binder.response.documentwrapped.class%</argument>
<argument key="wsdl_stylesheet">%besimple.soap.definition.dumper.options.stylesheet%</argument>
</argument> </argument>
<argument type="service" id="besimple.soap.cache" /> <argument type="service" id="besimple.soap.cache" />
</service> </service>

View File

@ -78,7 +78,7 @@ class WebServiceContext
$definition->setOption('location', $endpoint); $definition->setOption('location', $endpoint);
} }
$dumper = new Dumper($definition); $dumper = new Dumper($definition, array('stylesheet' => $this->options['wsdl_stylesheet']));
$cache->write($dumper->dump()); $cache->write($dumper->dump());
} }

View File

@ -69,6 +69,7 @@ class Dumper
'version12_class' => 'BeSimple\\SoapWsdl\\Dumper\\Version12', 'version12_class' => 'BeSimple\\SoapWsdl\\Dumper\\Version12',
'version11_name' => $this->definition->getName(), 'version11_name' => $this->definition->getName(),
'version12_name' => $this->definition->getName().'12', 'version12_name' => $this->definition->getName().'12',
'stylesheet' => null,
); );
$invalid = array(); $invalid = array();
@ -123,6 +124,8 @@ class Dumper
$this->document->formatOutput = true; $this->document->formatOutput = true;
$this->addStylesheet();
return $this->document->saveXML(); return $this->document->saveXML();
} }
@ -297,6 +300,15 @@ class Dumper
return $operation; return $operation;
} }
protected function addStylesheet()
{
if ($this->options['stylesheet']) {
$stylesheet = $this->document->createProcessingInstruction('xml-stylesheet', sprintf('type="text/xsl" href="%s"', $this->options['stylesheet']));
$this->document->insertBefore($stylesheet, $this->document->documentElement);
}
}
protected function getVersion($version) protected function getVersion($version)
{ {
if (\SOAP_1_2 === $version) { if (\SOAP_1_2 === $version) {