2

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

有没有办法让 SOAPClient 在 PHP 中省略字段?我传递给 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 属性,但这给了我这个致命错误:

[2012 年 8 月 13 日 07:01:50] PHP 致命错误:SOAP-ERROR: Encoding: object has no 'kundenavn' property in...

4

1 回答 1

1

您可能遇到了PHP 错误 #50997:尝试提交选择的第二个元素时出现 SOAP 错误

或者它可能是 WSDL 中的必填字段,因此您很可能会以任何一种方式坚持下去。对不起!

于 2012-10-23T20:45:05.160 回答