Skip to content

Commit 1e82d7f

Browse files
alemorozovfrancisbesset
authored andcommitted
Fix WSDL schema stylesheet including
1 parent 8788d75 commit 1e82d7f

File tree

3 files changed

+15
-1
lines changed

3 files changed

+15
-1
lines changed

src/BeSimple/SoapBundle/Resources/config/webservice.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
<argument key="binder_request_header_class">%besimple.soap.binder.request_header.rpcliteral.class%</argument>
4545
<argument key="binder_request_class">%besimple.soap.binder.request.rpcliteral.class%</argument>
4646
<argument key="binder_response_class">%besimple.soap.binder.response.rpcliteral.class%</argument>
47+
<argument key="wsdl_stylesheet">%besimple.soap.definition.dumper.options.stylesheet%</argument>
4748
</argument>
4849
<argument type="service" id="besimple.soap.cache" />
4950
</service>
@@ -58,6 +59,7 @@
5859
<argument key="binder_request_header_class">%besimple.soap.binder.request_header.documentwrapped.class%</argument>
5960
<argument key="binder_request_class">%besimple.soap.binder.request.documentwrapped.class%</argument>
6061
<argument key="binder_response_class">%besimple.soap.binder.response.documentwrapped.class%</argument>
62+
<argument key="wsdl_stylesheet">%besimple.soap.definition.dumper.options.stylesheet%</argument>
6163
</argument>
6264
<argument type="service" id="besimple.soap.cache" />
6365
</service>

src/BeSimple/SoapBundle/WebServiceContext.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ public function getWsdlFile($endpoint = null)
7878
$definition->setOption('location', $endpoint);
7979
}
8080

81-
$dumper = new Dumper($definition);
81+
$dumper = new Dumper($definition, array('stylesheet' => $this->options['wsdl_stylesheet']));
8282
$cache->write($dumper->dump());
8383
}
8484

src/BeSimple/SoapWsdl/Dumper/Dumper.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ public function setOptions(array $options)
6969
'version12_class' => 'BeSimple\\SoapWsdl\\Dumper\\Version12',
7070
'version11_name' => $this->definition->getName(),
7171
'version12_name' => $this->definition->getName().'12',
72+
'stylesheet' => null,
7273
);
7374

7475
$invalid = array();
@@ -123,6 +124,8 @@ public function dump()
123124

124125
$this->document->formatOutput = true;
125126

127+
$this->addStylesheet();
128+
126129
return $this->document->saveXML();
127130
}
128131

@@ -297,6 +300,15 @@ protected function addPortOperation(Method $method)
297300
return $operation;
298301
}
299302

303+
protected function addStylesheet()
304+
{
305+
if ($this->options['stylesheet']) {
306+
$stylesheet = $this->document->createProcessingInstruction('xml-stylesheet', sprintf('type="text/xsl" href="%s"', $this->options['stylesheet']));
307+
308+
$this->document->insertBefore($stylesheet, $this->document->documentElement);
309+
}
310+
}
311+
300312
protected function getVersion($version)
301313
{
302314
if (\SOAP_1_2 === $version) {

0 commit comments

Comments
 (0)