-
-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Soap: Autodiscover encodes service URI twice #16
Comments
are any workaround possible? Originally posted by @sh3bang at zendframework/zend-soap#25 (comment) |
i am using as workaround this:
instead of this: NOTE: replace only ONE of Originally posted by @sh3bang at zendframework/zend-soap#25 (comment) |
Now I can say that the URL with query params as XML namespace is not a good idea - I had a few problems with others SOAP clients/servers... So for now I use the following code: $serviceNs = 'http://example.com/soap/1.0';
$serviceUri = 'http://example.com/soap.php?a=1&b=2';
// Wsdl
$autodiscover = new \Zend\Soap\AutoDiscover();
$autodiscover->setUri($serviceNs);
$autodiscover->setServiceName('MySoapWebService');
$wsdlDom = $autodiscover->generate()->toDomDocument();
// Remove <operation> (this tag is not necessary).
foreach ($wsdlDom->getElementsByTagName('operation') as $node) {
/* @var $node DOMElement */
if ($node->hasAttribute('soapAction')) {
$node->parentNode->removeChild($node);
}
}
// Fix namespace
$ns = \Zend\Uri\Uri::encodePath($serviceNs);
foreach ($wsdlDom->getElementsByTagName('address') as $node) {
/* @var $node DOMElement */
if ($node->hasAttribute('location')) {
$node->setAttribute('location', str_replace($ns, $serviceUri, $node->getAttribute('location')));
}
}
// Remove @namespace (XML already contains our NS in root tag)
foreach ($wsdlDom->getElementsByTagName('body') as $node) {
/* @var $node DOMElement */
if ($node->hasAttribute('namespace')) {
$node->removeAttribute('namespace');
}
}
// Fix '&amp;'
$wsdlContent = $wsdlDom->saveXML();
$wsdlContent = str_replace('&amp;', '&', $wsdlContent); Finally, I suggest split URI into URL and NS and than fix Originally posted by @LastDragon-ru at zendframework/zend-soap#25 (comment) |
|
This issue has been moved from the
zendframework
repository as part of the bug migration program as outlined here - http://framework.zend.com/blog/2016-04-11-issue-closures.htmlOriginal Issue: https://api.github.com/repos/zendframework/zendframework/issues/7541
User: @LastDragon-ru
Created On: 2015-05-20T09:06:27Z
Updated At: 2015-11-06T21:40:25Z
WSDL:
WSDL file contains
&
instead of&
in attributes (non critical) andsoap:address@location
(critical)Originally posted by @GeeH at zendframework/zend-soap#25
The text was updated successfully, but these errors were encountered: