How to consume web service?

Hello guys,
How to consume web service in PHPMaker to integrate with another application?
thankful

Make sure your web server supports to access the web service.

For example, I am using Wampserver, then I can simply enable “php_soap” PHP extension from my web server side, and then I can simply expose the “SoapClient” object to consume the web service:

try {        
	$wsdl = "<the_url_to_your_wsdl>"; // adjust it to your WSDL URL
	$client = new SoapClient($wsdl); // create a new SoapClient object
	$response = $client->getSomething(array('ABC' => $rsnew["ABC"])); // adjust "getSomething" with your web service method, adjust also the param of it
	//  your code goes here to check the response output
	//  and so forth ...
	//var_dump($response);
} catch (Exception $e) {  // catch the error below
	$this->setFailureMessage("Failed to access the web service. <br>Error message: ".$e->getMessage());
}

Thank you, I’ll apply your suggestion.

mobhar wrote:

> > try {

$wsdl = “<the_url_to_your_wsdl>”; // adjust it to your WSDL URL
$client = new SoapClient($wsdl); // create a new SoapClient object
$response = $client->getSomething(array(‘ABC’ => $rsnew[“ABC”]));
} catch (Exception $e) { // catch the error below
$this->setFailureMessage("Failed to access the web service.
Error message: ".$e->getMessage());
}

Hi, where to put this code in Server Events ? in which Function?

It actually depends on your business-logic. For example, if you want to execute that code after a new record is inserted, then simply put it in Row_Inserted server event.

I want to check a record from database with a soap xml provided by other company. I think i am gonna make an additional button “Check this profile” (each row) in Table-Spesific>List Page>ListOptions_Rendered
But then i am still confused how is the syntax to do that? Thanks.

You’d better use Page_Load and Row_CustomAction for such case. Just call a Custom File that receives Get() param, and return your desired value from that web service.