问题
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