且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

PHP SoapClient 调用中的空值

更新时间:2022-04-24 23:01:05

经过仔细分析,我确定这个问题出在服务的 WSDL 定义中——一些业务逻辑可选属性在 WSDL 中没有标记为可空,在这种情况下,SoapClient(完全正确)传递一个空节点.

After closer analysis I determined that this problem was in the WSDL definition for the service - some business-logic-optional properties were not marked as nillable in the WSDL, and in that case the SoapClient (perfectly correctly) passes an empty node.

当 WSDL 将属性正确定义为 nillable 时,当该属性设置为 null 时,节点被标记为 nil="true" 并且不会在端点上显示为空字符串.

When the WSDL properly defines the property as nillable, when that property is set to null the node is marked nil="true" and doesn't show up as an empty string on the endpoint.