Re: [SOAP] PHP and SoapClient - problems communicting with ASP .net Web service

[email protected] (Jeffery Fernandez)
Newsgroups php.soap
Organization Internet Vision Technologies
Message-ID <[email protected]>
On Wednesday 17 October 2007 09:46, newfie wrote:
> I have a web service which i want to consume via PHP.
>
> Whenever i attempt to communicate with it it comes up with:
>
> "Server was unable to process request. --> Object reference not set to an
> instance of an object."
>
> Googled it and got the following:
>
> php.net/soap_soapclient_soapcall
>
> Apparently this code should work to fix the above problem:

more likely got to do with the version of PHP5  you are running. The 
documentation for most of the newer functions are not upto-date. I fell into 
a similar trap until I realised that I was using an old version of php5. I 
recommened using 5.2.1 for SOAP related functionality.

cheers,
Jeffery
>
>
> <?php
>
> class Test {
> public $account;
> public $password;
> }
>
> $parameters = new Test;
> $parameters -> account = $username;
> $parameters -> password = $password;
>
> try {
> $client = new SoapClient ("https://www.somewebsite.com/Serv­
> ice.asmx?wsdl", array('classmap' => array('CheckUser' => 'Test')));
> $client -> CheckUser ($parameters);
> echo "Valid Credentials!";
> }
> catch (Exception $e) {
> echo "Error!<br />";
> echo $e -> getMessage ();
> }
>
> ?>
>
> I modified it and my version as follows:
>
> <? class Book {
> public $author = "1";
> public $title = "2";
> public $publisher= "3";
> public $loc= "4";
> }
>
> $bookC = new Book;
>
> $sc = new SoapClient("URLTOWEBSERVICE?wsdl",­ array('classmap' =>
> array('bookC ' => "Book")));
>
> try {
> print_r($sc->getBook($bookC));
> }
> catch (Exception $e)
> {
> echo $e->getMessage();
> }
>
> WSDL as follows:
>
>
> - <s:complexType name="Book">
> - <s:sequence>
> <s:element minOccurs="0" maxOccurs="1" name="author" type="s:string" />
> <s:element minOccurs="0" maxOccurs="1" name="title" type="s:string" />
> <s:element minOccurs="0" maxOccurs="1" name="publisher" type="s:string" />
> <s:element minOccurs="0" maxOccurs="1" name="loc" type="s:string" />
> </s:sequence>
> </s:complexType>
>
>
>
> Been stuck on it for a while, any ideas?
>
> I've also tried using nuSoap with the same result. :|
> --
> View this message in context:
> http://www.nabble.com/PHP-and-SoapClient---problems-communicting-with-ASP-.
>net-Web-service-tf4637443.html#a13244580 Sent from the Php - Soap mailing
> list archive at Nabble.com.

-- 
Internet Vision Technologies
Level 1, 520 Dorset Road
Croydon
Victoria - 3136
Australia
signature.asc (application/pgp-signature, 189 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (GNU/Linux)

iD8DBQBHFVCF5WXEviRz51oRAkERAJ4uvrqZuM23GuTDnNZpJd8Oq6+iRwCZAaTC
GfU3rF2G0BKW6s1EXRwDlwA=
=gTz3
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.