如何使用多个阵列请求php soap客户端?

问题描述 投票:0回答:1

嗨,我正在使用PHP中的soap。 PHP版本7.0。我可以用肥皂连接,但“DemograficData”包括多个“EmKeyValue”。我创建了数组,但数组打印只显示1“EmKeyValue”。我可以在没有SoapClient的情况下发送请求吗?

    $SendOngoingEmail = 
        array(
            "ServiceTicket" => "TICKETID",
            "value" => "VALUEFORSERVİS",
            "key" => $value_ilgi_alani,
            "DemograficData" => array( 
               "EmKeyValue" => array("Key" => "AAAA","Value" => "AAAA_VALUE"),
               "EmKeyValue" => array("Key" => "BBBB","Value" => "BBBB_VALUE"),
                                        ),
            "ForceUpdate" => TRUE,
            "OngoingCampaignId" => "SERVICEID",
            );
    $connect= new SoapClient("https://xyzabc.com/max/member.asmx?WSDL",
        array(
            "trace" => 1,
            'exceptions' => 1,
            "stream_context" => stream_context_create(
                array(
                    'ssl' => array(
                        'verify_peer'       => false,
                        'verify_peer_name'  => false,
                    )
                )
            )
        ) 
    );

    $result = $connect->SendOngoingEMail($SendOngoingEmail);

工作样品申请:

   <?xml version="1.0" encoding="utf-8"?>
    <soap:Envelope
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xmlns:xsd="http://www.w3.org/2001/XMLSchema"
        xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
        <soap:Body>
            <SendOngoingEMail xmlns="http://xyzabc.com/member">
                <ServiceTicket>string</ServiceTicket>
                <Key>string</Key>
                <Value>string</Value>
                <DemograficData>
                    <EmKeyValue>
                        <Key>string</Key>
                        <Value>string</Value>
                    </EmKeyValue>
                    <EmKeyValue>
                        <Key>string</Key>
                        <Value>string</Value>
                    </EmKeyValue>
                </DemograficData>
                <ForceUpdate>boolean</ForceUpdate>
                <OngoingCampaignId>string</OngoingCampaignId>
            </SendOngoingEMail>
        </soap:Body>
    </soap:Envelope>
php soap soap-client
1个回答
0
投票

试试这个:

"DemograficData" => array(
    "EmKeyValue" => array(
        array("Key" => "AAAA","Value" => "AAAA_VALUE"),
        array("Key" => "BBBB","Value" => "BBBB_VALUE")
     ),
© www.soinside.com 2019 - 2024. All rights reserved.