With the SoapClient class on PHP5.x and working against a SOAP web service that has optional parameters in its methods, you won't have any problem if you use the non-wsdl mode.
使用PHP5.x上的SoapClient类并对付其方法中具有可选参数的SOAP Web服务,如果使用非wsdl模式,则不会有任何问题。
But, at least by default, with the wsdl mode, if you don't fill all the parameters you will get an error like: SOAP-ERROR: Encoding: object hasn't 'xxx' property
但是,至少在默认情况下,使用wsdl模式,如果你没有填充所有参数,你将收到如下错误:SOAP-ERROR:Encoding:object没有'xxx'属性
Is there any way to avoid that error without working with the non-wsdl mode and without filling all the parameters?
如果不使用非wsdl模式并且没有填充所有参数,有没有办法避免该错误?
1 个解决方案
#1
Maybe this is not the problem with the WSDL mode but with string encoding in the code. If your web service encode strings in UTF-8 make sure you use appropriate functions, like mb_substr(...)
instead of substr(...)
.
也许这不是WSDL模式的问题,而是代码中的字符串编码。如果您的Web服务使用UTF-8编码字符串,请确保使用适当的函数,如mb_substr(...)而不是substr(...)。
#1
Maybe this is not the problem with the WSDL mode but with string encoding in the code. If your web service encode strings in UTF-8 make sure you use appropriate functions, like mb_substr(...)
instead of substr(...)
.
也许这不是WSDL模式的问题,而是代码中的字符串编码。如果您的Web服务使用UTF-8编码字符串,请确保使用适当的函数,如mb_substr(...)而不是substr(...)。