1

i want to send a soap request using php but i found a problem here is what i have to send as XML format.

<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

$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 ? or just a dynamic method that doesn't reseting the "CreancierVals" val but add one to the other as an array for example. thanks

1 Answer 1

2

Try this:

$result = $client->getImpayee(
    [
        'tocken'        => $_SESSION['tocken'],
        'CodeCreancier' => $CodeCreancier,
        'CodeCreance'   => $CodeCreance,
        'crVals'        => [
            'CreancierVals' => [
                [
                    'nomChamp'    => 'montant',
                    'ValeurChamp' => $montant,
                ],
                [
                    'nomChamp'    => 'ND',
                    'ValeurChamp' => $ND,
                ],
            ],
        ],
    ]
);
Sign up to request clarification or add additional context in comments.

1 Comment

Thanks it was a hole day for me to look for this answer :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.