我正在尝试连接PHP soap服务器和用C#编写的客户端。WSDL是以这种方式创建的:
$autodiscover = new Zend_Soap_AutoDiscover('Zend_Soap_Wsdl_Strategy_ArrayOfTypeComplex');
$autodiscover->setClass('Soap_Service1');
$autodiscover->handle();然后我会收到:
<definitions xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:tns="http://www.xx.de/soap/version/1"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap-enc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
targetNamespace="http://www.xx.de/soap/version/1"
name="Soap_Services1"
>这个在C#中解析的'name="Soap_Services1"‘属性看起来很难看(Services.Soap_Services1Service)。当然,名字和ServiceBinding和PortType是有联系的。有没有办法在不手动破解zend库的情况下改变它?
发布于 2010-12-10 23:30:31
是。只需重命名您的服务类即可;)
$autodiscover->setClass('CoolServiceName');会给你带来
<definitions xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:tns="http://www.xx.de/soap/version/1"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap-enc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
targetNamespace="http://www.xx.de/soap/version/1"
name="CoolServiceName"
>发布于 2010-12-10 23:30:11
由于您使用的是自动发现/神奇的soap服务创建器,因此不能按原样覆盖它创建的名称。
如果您想这样做,您可以扩展Zend_Soap_AutoDiscover并实现您自己的setClass方法,该方法在生成wsdl时使用您自己的名称选择。
发布于 2011-05-06 19:18:36
您所需要做的就是重命名您的服务类(由setClass()调用设置的服务类),您就成功了。
https://stackoverflow.com/questions/4408756
复制相似问题