Home » Php, Webservice

Creating a php webservice for C#

12 June 2007 2 Comments

Probably a lot of you are wonder if is possible to access a php webservice from C#, so I made a simple test to show you is possible :).
In this test I used nusoap and php4. In the future I will do the test with PHP5 and it’s SOAP library.

//ws.php

require_once(“lib/nusoap.php”);
$ns=”http://your.server.address/”;

$param = array(‘x’ => ‘xsd:string’,’y’ => ‘xsd:string’);
$return = array(‘return’=>’xsd:string’);

$server = new soap_server();
$server->configureWSDL(‘WS Test’,$ns);
$server->wsdl->schemaTargetNamespace=$ns;
$server->register(‘TestFunction’,$param,$return,$ns);

function TestFunction($x,$y){

$ret=$x+$y;

return new soapval(‘return’,’xsd:string’,$ret);
}

$server->service($HTTP_RAW_POST_DATA);

To access this webservice just go to: http://your.server.address/ws.php?wsdl


2 Comments »

  • int said:

    Now try it by using an integer as input for your webservice function.

  • Paula said:

    I agree with Colin.Without having the kgenlodwe/experience it only makes sense to use an open source application.I have built custom CMS’s, along with use applications like Joomla. I know Joomla can be complete overkill on a small scale site. I use WordPress as a CMS often to build small scale sites. The code is easy to modify if you need any customization, its much simpler than Joomla/Drupal, its thouroughly tested with a huge user community.Creating a custom CMS has its place, but it so does using an off the shelf solution to build quickly and bug free.

Leave your response!

Add your comment below, or trackback from your own site. You can also subscribe to these comments via RSS.

Be nice. Keep it clean. Stay on topic. No spam.

You can use these tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

This is a Gravatar-enabled weblog. To get your own globally-recognized-avatar, please register at Gravatar.