1

I need to execute a web service from a php page

The web service is located in the following url

https://www.agemni.com/AgemniWebservices/service1.asmx

The Web Service uses a SOAP protocol to exchange messages.

The WSDL info can be located at https://www.agemni.com/AgemniWebservices/service1.asmx?WSDL

The function in that service that we need to use is ValidateEntity

//ValidateEntity("username", "password", "companyID", 2, keys, values)

So , how can i execute this web service and get result from my php page

Linto
  • 1,234
  • 3
  • 25
  • 41
  • Checkout this post, it's very similar: http://stackoverflow.com/questions/8805061/php-soap-http-request/8805376 – Paul Bain Jan 10 '12 at 17:52

4 Answers4

0

See soap calls help from php.net:

http://www.php.net/manual/en/soapclient.soapcall.php

Luc Laverdure
  • 1,398
  • 2
  • 19
  • 36
0

You need to use PHP's SOAP libraries...

http://www.php.net/manual/en/soapclient.soapcall.php

KOGI
  • 3,959
  • 2
  • 24
  • 36
0

A simple example, hope it helps...

$service1 = new SoapClient('https://www.agemni.com/AgemniWebservices/service1.asmx');

//here you instanciate your object with those properties
$entity = new Entity();
$entity->strUsername = 'José';
$entity->strPassword = '123';
$entity->strCompanyName = 'Somethin';
$entity->0 //because your type is int

$res = $service1->ValidateEntity($entity);//here you send the information to your service's method, if I'm not mistaken, it must be a object

$res->ValidateEntityResult;//this is the return of your service.

As I said, it is really simple but works.

0

For https WebServices you need to enable openssl extension. The WS use .net it means that the class use type hinting so you need to create the ValidateEntity class, here's the code:

$ws = new soapclient('https://www.agemni.com/AgemniWebservices/service1.asmx?wsdl');
class ValidateEntity {
    public $strUsername,
    $strPassword,
    $strCompanyName,
    $objecttype;
    }

$parameters = new ValidateEntity();
$parameters->strUsername = 'username';
$parameters->strPassword = 'password';
$parameters->strCompanyName = 'company';
$parameters->objecttype = 1;
echo '<pre>';
print_r($ws->ValidateEntity($parameters));
echo '</pre>';
a77icu5
  • 131
  • 2
  • 13