Monday, July 14, 2008

How to use web service in PHP 5.1.6. Part -> 2

In my previous post i describe how to create a web service and how to used in In this post i used my web service in php.

First i create one page in php.

$client = new soapclient
array( 'trace' => true,
'exceptions' => true,

$param = array('strUserName' => 'aaa','strPassword' => 'bbb','strSecurityCode' => 'ccc');

$rs1 = $client->__call('getcompanyservice',array($param));


$rs = xml2array(htmlspecialchars($result['getcompanyserviceResult']));

Wednesday, July 2, 2008

How to use web service in - Part -> 1

There are few step to add a new web service to

-> First create a new web application.

-> Then go to your project and right click and see there is one option "Add Web References".

-> Then you got this type of pop up window on your screen and in this you enter your web
service url and click "go" button near the url text box. You give one name to your web service
say "Test" above the "Add Reference" button. then click this button and you see they create a
new folder in the "App_WebReferences" and in that floder they create your "Test" floder and
put your web service in this folder.

-> Now in you sample.aspx.cs page add reference of that web service this way.
using Test;
-> Now in pagload or any event you want to used this web service in your page this way. I write
in page load event. To print "Hello wrold".

protected void Page_Load(object sender, EventArgs e)
Service objservice = new Service();

-> Run This sample and you got this result.

Create a web service in

There are few step to create a new web service.

1) Create a new web service application say "TestService". In that you get "Service.asmx" file.

2) In "Service.asmx" file you got this type of content.

using System;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;

[WebService(Namespace = "")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
public class Service : System.Web.Services.WebService
public Service ()
//Uncomment the following line if using designed components

public string HelloWorld()
return "Hello World";

3) When you run this web service application you got this type of

Here you see there is one method "HelloWrold" and other detail of web service.
Click on this method and you get this type of content

In this there is one button "Invoke". When you clik that button you get result
of your web service.

Hello World

4) Take a path for your web service at this time your path like this


If you deploy this web service into iis then you get different pathe like this