简体   繁体   English

我想使用php发送带有多个项目的肥皂请求

[英]I want to send a soap request using php with multiple items

i want to send a soap request using php but i found a problem here is what i have to send as XML format. 我想使用php发送肥皂请求,但我发现这里存在一个问题,我必须将其作为XML格式发送。

<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:tem="http://tempuri.org/">
  <soap:Header/>
  <soap:Body>
    <tem:getImpayee>
      <tem:tocken>reererer</tem:tocken>
      <tem:CodeCreancier>1013</tem:CodeCreancier>
      <tem:CodeCreance>01</tem:CodeCreance>
      <tem:crVals>
        <tem:CreancierVals>
          <tem:nomChamp>montant</tem:nomChamp>
          <tem:ValeurChamp>45</tem:ValeurChamp>
        </tem:CreancierVals>
        <tem:CreancierVals>
          <tem:nomChamp>ND</tem:nomChamp>
          <tem:ValeurChamp>0663143327</tem:ValeurChamp>
        </tem:CreancierVals>
      </tem:crVals>
    </tem:getImpayee>
  </soap:Body>
</soap:Envelope>

but the problem is that there is multiple "tem:CreancierVals" when i use this 但是问题是当我使用这个时,有多个“ tem:CreancierVals”

$client->__setLocation(url_PaiementWS);
$result = $client->getImpayee(
    array(
        'tocken' => $_SESSION['tocken'],
        'CodeCreancier' => $CodeCreancier,
        'CodeCreance' => $CodeCreance,
        'crVals' => array (
            'CreancierVals' => array(
                'nomChamp' => 'montant',
                'ValeurChamp' => $montant
            ),
            'CreancierVals' => array(
                'nomChamp' => 'ND',
                'ValeurChamp' => $ND
            )
        )
    )
);

it doesnt work its like reseting the "CreancierVals" val is there a solution in which i can send pure xml using php ? 它不起作用,就像重置“ CreancierVals” val一样,有没有一种解决方案,我可以使用php发送纯xml? or just a dynamic method that doesn't reseting the "CreancierVals" val but add one to the other as an array for example. 或只是一种动态方法,它不会重置“ CreancierVals” val,而是将一个作为数组添加到另一个。 thanks 谢谢

Try this: 尝试这个:

$result = $client->getImpayee(
    [
        'tocken'        => $_SESSION['tocken'],
        'CodeCreancier' => $CodeCreancier,
        'CodeCreance'   => $CodeCreance,
        'crVals'        => [
            'CreancierVals' => [
                [
                    'nomChamp'    => 'montant',
                    'ValeurChamp' => $montant,
                ],
                [
                    'nomChamp'    => 'ND',
                    'ValeurChamp' => $ND,
                ],
            ],
        ],
    ]
);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM