SOAP请求中省略字段的致命错误

时间:2012-08-13 08:17:12

标签: soap soap-client php

我正在构建一个SOAP客户端,用于将信息发送到使用WSDL定义的SOAP服务。在SoapUI中向服务发布数据时,我可以省略我没有值的字段,但是在PHP中我遇到了致命的错误。

有没有办法让PHP中的SOAPClient省略字段?我传递给SOAPClient的对象如下所示:

Kunde Object
(
    [kundenr] => 1008911
    [contact_id] => 10941
    [kundenavn] => 
    [organisasjonsnr] => 
    [addresse] => Addresse Object
        (
            [postadresse1] => 
            [postadresse2] => 
            [postadresse3] => 
            [postadresse] => 
            [gateadresse1] => 
            [gateadresse2] => 
            [gateadresse3] => 
            [gateadresse] => 
            [county] => 
            [kommunenr] => 
            [stat] => 
            [postnr] => 
            [poststed] => 
            [landkode] => 
            [land] => 
            [adresslayout] => 
        )

    [kontakt] => Kontakt Object
        (
            [tlfnr] => 
            [tlfbeskrivelse] => 
            [faxnr] => 
            [faxbeskrivelse] => 
            [mailadresse] => 
            [webadresse] => 
        )

    [person] => Person Object
        (
            [customerId] => 
            [personId] => 
            [contact_id] => 
            [fornavn] => 
            [etternavn] => 
            [brukernavn] => 
            [epost] => 
            [tlf] => 
            [kundetype] => 40
            [addresse] => Addresse Object
                (
                    [postadresse1] => 
                    [postadresse2] => 
                    [postadresse3] => 
                    [postadresse] => 
                    [gateadresse1] => 
                    [gateadresse2] => 
                    [gateadresse3] => 
                    [gateadresse] => 
                    [county] => 
                    [kommunenr] => 
                    [stat] => 
                    [postnr] => 
                    [poststed] => 
                    [landkode] => 
                    [land] => 
                    [adresslayout] => 
                )

        )

    [faultmsg] => Faultmsg Object
        (
            [Type] => 
            [Melding] => 
            [Detalj] => 
        )

    [avdeling] => 
    [kundetype] => 40
    [informasjon] => 
    [aktiv] => 
    [stopputsendelse] => 
    [aco_kunde] => 
    [uf_kunde] => 
    [gan_kunde] => 
    [kunde] => 10941
)

我想从对象中省略Kunde-> kundenavn属性,但这给了我这个致命的错误:

  

[13-Aug-2012 07:01:50] PHP致命错误:SOAP-ERROR:编码:对象   在...中没有'kundenavn'财产。

1 个答案:

答案 0 :(得分:1)

您可能患有PHP Bug #50997: SOAP Error when trying to submit 2nd Element of a choice

或者它可能是WSDL中的必填字段,因此您最有可能使用它。抱歉!