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

[email protected] (Richard Quadling) Mon, 22 Nov 2010 11:48:26 +0000
Newsgroups php.soap
Message-ID <[email protected]>
On 22 November 2010 11:35, bkrqpzef <[email protected]> wrote:
>
> Hello,
>
> I have never use SOAP/WSDL before. I need to access to a webservice to get
> some informations.
> I don't understand the technical documentation i got.
>
> I need to use the method "Tarif" it should be like that (according to the
> technical documentation) :
>
> <Tarif>
>  <Clef></Clef>
>  <TarifParams IdCo="">
>   <Devis>
>      <Personne>
>         <Nom> </Nom>
>        <Prenom>Prenom</Prenom>
>        <Numero></Numero>
>        <Type>Adherent</Type>
>        <DateNaissance></DateNaissance>
>      </Personne>
>      <Parametres>
>        <DateEffet></DateEffet>
>        <CodePostal></CodePostal>
>        <Produit> </Produit>
>         <Garanties>
>           <Garantie>
>                <Libelle> </Libelle>
>           </Garantie>
>        </Garanties>
>      </Parametres>
>    </Devis>
>  </TarifParams>
> </Tarif>
>
>
>
> But i'm not able to do it. :s
>
> I have something like :
>
> $client = new SoapClient('https://adresseweb.com/file.asmx?wsdl');
> $result = $client->Tarif();
>
>
>
> Whatever i put into the "()" of "Tarif" I have a :
>
> Server was unable to process request. ---> Object reference not set to an
> instance of an object.
>
> Thx for your help and sorry for my english.
> --
> View this message in context: http://old.nabble.com/-PHP--Soap---Wsdl-Beginner-tp30277723p30277723.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
>
>

For me, the easiest way to use a SOAP service which provides a WSDL
file is to take the WSDL file and from it, create a series of PHP
classes which encapsulate all the necessary XML/SOAP logic for you.

There is a small script which I use. It is available on SourceForge
and is called wsdl2php [1]. The patches by RazorsEdgeUK certainly help
also. If you want, I can email you directly a completely patched
version.

When you've got the script installed, you use it (as an example) ...

wsdl2php https://adresseweb.com/file.asmx?wsdl

That will create a single PHP script containing all the classes you
need to work with the service.

In your code, you can now use the those classes and all the XML/SOAP
stuff is done for you.

I have a small simple test block of code which can easily be amended
to fit any service to allow you to build a test client.

If you want the code, let me know.

If you can supply a full WSDL url, I can create the service classes
quickly enough.

Regards,

Richard.

[1] http://sourceforge.net/projects/wsdl2php/

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