如何请求具有多个数组的php soap客户端?

时间:2019-02-21 04:44:03

标签: php soap soap-client

嗨,我正在用PHP开发肥皂。 PHP 7.0版。我可以用肥皂连接,但是“ DemograficData”包括多个“ EmKeyValue”。我创建了array,但是array print只显示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>

1 个答案:

答案 0 :(得分:0)

尝试一下:

"DemograficData" => array(
    "EmKeyValue" => array(
        array("Key" => "AAAA","Value" => "AAAA_VALUE"),
        array("Key" => "BBBB","Value" => "BBBB_VALUE")
     ),