This repository has been archived by the owner on Jan 31, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 42
Soap: Autodiscover encodes service URI twice #25
Comments
are any workaround possible? |
i am using as workaround this:
instead of this: NOTE: replace only ONE of |
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 |
This repository has been closed and moved to laminas/laminas-soap; a new issue has been opened at laminas/laminas-soap#16. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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)The text was updated successfully, but these errors were encountered: