PHP SoapClient error - Missing name for <fault>

谁说胖子不能爱 提交于 2021-01-28 02:12:38

问题


I'm trying to get PHP connecting correctly to a WSDL using SoapClient, it connects (as in finds the WSDL) okay but then gives me the following error:

Fatal error: Uncaught SoapFault exception: [WSDL] SOAP-ERROR: Parsing WSDL: Missing name for <fault> of 'invokeService'

The PHP code is as follows:

$client = new SoapClient("wsdl.wsdl");

And the XML in the WSDL file where it's failing is as follows:

  <portType name="invokePort"> 
    <operation name="invokeService"> 
      <input message="wsdlns:invokeRequest"/> 
      <output message="wsdlns:invokeResponse"/> 
      <fault message="soap:fault"></fault> 
    </operation> 
  </portType> 

Any idea what's wrong?

Thanks


回答1:


Well, Missing name for <fault> sounds quite self-explanatory. Did you try to add an attribute "name" to the fault element?

UPDATE: Regarding to the Missing <message> with name 'soap:fault' error, you can try the following:

<message name="MyFaultName"/>
<portType>
    <!-- ... -->
    <fault name="MyFaultName">
        <soap:fault name="MyFaultName" use="literal"/>
    <fault>
</portType>

Not sure it won't further complain of other issues, though. Manually creating WSDLs is a real pain, I'd recommend you look for some tool that generates it for you from the source code.



来源:https://stackoverflow.com/questions/2958454/php-soapclient-error-missing-name-for-fault

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!