Jump to content

Consume web service in PHP


This topic is 5002 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Does any one have sample code to consume web service using 360 works web service manager in PHP,say for 'AddTwoNumbers' operation?

here is code which we wrote

require_once('lib/nusoap.php');

$wsdl ="http://servername/websvcmgr.php?wsdl&service=ExampleService";

$client=new soapclient($wsdl, 'wsdl');

$param=array('addend1'=>'15', 'addend2'=>'10');

$result = $client->call('AddTwoNumbers', $param);

// Check for a fault

if ($client->fault) {

echo '

Fault

';

print_r($result);

echo '

';

} else {

// Check for errors

$err = $client->getError();

if ($err) {

// Display the error

echo '

Error

' . $err . '
';

} else {

// Display the result

echo '

Result

';

print_r($result);

echo '

';

}

}

This does execute 'display result' code, but no output value is shown.

Link to comment
Share on other sites

  • 2 weeks later...

I replied privately to this, here is the PHP code to access our test server if anybody else is trying to do this:


<?php

$soap = new SoapClient('http://wpeoffice.360works.com/websvcmgr.php?wsdl&Service=ExampleService');

$lookup = $soap->AddTwoNumbers(array("Addend1" => "3", "Addend2" => "4"));



print_r( $lookup );

?>

Link to comment
Share on other sites

This topic is 5002 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.