开发者

How change name in WSDL generated by Zend_Soap_AutoDiscover

I am trying connecting PHP soap server with client written in C#. WSDL is created in开发者_JS百科 that way:

$autodiscover = new Zend_Soap_AutoDiscover('Zend_Soap_Wsdl_Strategy_ArrayOfTypeComplex');
$autodiscover->setClass('Soap_Service1');
$autodiscover->handle();

then I receive:

<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" 
>

this 'name="Soap_Services1"' attribute parsed in C# looks ugly (Services.Soap_Services1Service). Of course name is connected with ServiceBinding and PortType. Is there any way to change it without manually hacking zend library?


Yes. Just rename your service class ;)

$autodiscover->setClass('CoolServiceName');

will give you

<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" 
>


Since you're using the autodiscover / magical soap service creator, you can't override the names it creates as-is.

If you want to do this you can extend Zend_Soap_AutoDiscover and implement your own setClass method that uses your own name choice while generating the wsdl.


All you need to do is rename your service class (the one set by the setClass() call) and you're good.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜