Re: [SOAP] [PHP] Soap / Wsdl Beginner

[email protected] (Richard Quadling) Thu, 25 Nov 2010 22:01:38 +0000
Newsgroups php.soap
Message-ID <[email protected]>
On 25 November 2010 16:15, bkrqpzef <[email protected]> wrote:
>
> Yeah the key if working. i have forget to put some brackets at the beginning
> and at the end. I didn't thought that was part of the key.
> In fact, the code working well with only :
>
> $Tarif->TarifParams->Devis->Assure = new AssureInput(); // AssureInput
> $Tarif->TarifParams->Devis->Assure->Nom               = ''; // string
> $Tarif->TarifParams->Devis->Assure->Prenom            = ''; // string
> $Tarif->TarifParams->Devis->Assure->NumeroAssure      = 2; // int
> $Tarif->TarifParams->Devis->Assure->Type              = 'Adherent'; //
> string
> $Tarif->TarifParams->Devis->Assure->DateNaissance     = '19800101'; //
> string
> $Tarif->TarifParams->Devis->Assure->RegimeObligatoire = 'SS'; // string
>
> But i need to add another Person to this request.
> like in https://wspar51.april.fr/WSSante/WSSante.asmx?op=Tarif :
>
> POST /WSSante/WSSante.asmx HTTP/1.1
> Host: wspar51.april.fr
> Content-Type: text/xml; charset=utf-8
> Content-Length: length
> SOAPAction: "http://www.april-technologies.com/Tarif"
>
> <?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>
>    <Tarif xmlns="http://www.april-technologies.com">
>      <astr_Clef>string</astr_Clef>
>      <TarifParams IdCo="string">
>        <Devis>
>          <Assure>
>            <Nom>string</Nom>
>            <Prenom>string</Prenom>
>            <NumeroAssure>int</NumeroAssure>
>            <Type>string</Type>
>            <DateNaissance>string</DateNaissance>
>            <RegimeObligatoire>string</RegimeObligatoire>
>          </Assure>
>          <Assure>
>            <Nom>string</Nom>
>            <Prenom>string</Prenom>
>            <NumeroAssure>int</NumeroAssure>
>            <Type>string</Type>
>            <DateNaissance>string</DateNaissance>
>            <RegimeObligatoire>string</RegimeObligatoire>
>          </Assure>
>          <Parametres>
>            <DateEffet>string</DateEffet>
>            <CodePostal>string</CodePostal>
>            <BesoinHospitalisation>string</BesoinHospitalisation>
>            <BesoinFraisMedicaux>string</BesoinFraisMedicaux>
>            <BesoinDentaire>string</BesoinDentaire>
>            <BesoinOptique>string</BesoinOptique>
>            <Produit>string</Produit>
>            <Garanties xsi:nil="true" />
>          </Parametres>
>        </Devis>
>      </TarifParams>
>    </Tarif>
>  </soap:Body>
> </soap:Envelope>
>
> There are two <Assure> but i can't create another one. :(
> And of course, I have to do both in the same request.
>
> I tried with :
> $Tarif->TarifParams->Devis->Assure2 = new AssureInput(); // AssureInput
> $Tarif->TarifParams->Devis->Assure2->Nom               = ''; // string
> $Tarif->TarifParams->Devis->Assure2->Prenom            = ''; // string
> $Tarif->TarifParams->Devis->Assure2->NumeroAssure      = 2; // int
> $Tarif->TarifParams->Devis->Assure2->Type              = 'Conjoint'; //
> string
> $Tarif->TarifParams->Devis->Assure2->DateNaissance     = '19800102'; //
> string
> $Tarif->TarifParams->Devis->Assure2->RegimeObligatoire = 'SS'; // string
>
> but it didn't work.
> --
> View this message in context: http://old.nabble.com/-PHP--Soap---Wsdl-Beginner-tp30277723p30306611.html
> Sent from the Php - Soap mailing list archive at Nabble.com.
>
>
> --
> PHP Soap Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

The issue is the handling of maxOccurs="unbounded"

I'm not 100% on how to handle this on the PHP SoapClient side.

It _MAY_ be you can use ...

$Tarif->TarifParams->Devis->Assure = array(new AssureInput(), new
AssureInput());

and then populate $Tarif->TarifParams->Devis->Assure[0] and
$Tarif->TarifParams->Devis->Assure[1] appropriately.

But I don't know for sure.




-- 
Richard Quadling
Twitter : EE : Zend
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY