2

I have a php code that uses soap

I get the error

ERROR: WSDL - SOAP-ERROR: Parsing WSDL: Couldn't load from

It's a security wsdl so I need to send also username and password. what is wrong in my code? I see it at web and does'nt work from soap in php code. here is my code:

<?php
ini_set("soap.wsdl_cache_enabled", "0"); 
$soap_url = 'http://some-ip/prod/app/soap/user/storeitemws?WSDL';
$sh_param = array(
                'username' => 'aya',
                'password' => 'aya');

$soap_client = new SoapClient($soap_url);
$test = $soap_client->Authenticate($sh_param);

echo $test . "\nDone";
?>

thanks

Shikiryu
  • 10,180
  • 8
  • 49
  • 75
tochnitanit
  • 31
  • 1
  • 1
  • 4

4 Answers4

2

See in the documentation:

$client = new SoapClient("some.wsdl", array('login'          => "some_name",
                                            'password'       => "some_password"));

change username to login and try the above method

Dejell
  • 13,947
  • 40
  • 146
  • 229
0

Is Authenticate() a SOAP method? In what way is the wsdl secured? What happens if you visit it using the browser?

The SoapClient does not support authentication on the WSDL it's built from, so you'll have to download the WSDL manually (using cURL for example) and create the SoapClient from that file.

CodeCaster
  • 147,647
  • 23
  • 218
  • 272
  • if I go to it from the browser it askes for username and password. – tochnitanit May 13 '12 at 05:22
  • Hi, how do I know the methods of the Webservice provided? Viewing the xml via browser, how will I know which are the methods? Thanks. – oneofakind Jun 19 '13 at 07:29
  • @oneofakind take a look at the [WSDL wiki](http://en.wikipedia.org/wiki/Web_Services_Description_Language). You'll be looking for `` elements. – CodeCaster Jun 19 '13 at 07:41
0

for using on localhost, install WAMP.
Click on wamp tray icon > PHP Services > and enable these options:
openssl,
php_openssl,
curl;
SOAP,

p.s. possibly, some of free hostings dont have these options

T.Todua
  • 53,146
  • 19
  • 236
  • 237
0

Maybe some firewall ? you cannot access to the server ?

ElSinus
  • 106
  • 4