Here you will find a free php scripts, php resources, php tutorials, web resources , jquery
Here you will find a free php scripts, php resources, php tutorials, web resources , jquery
Here is solution how to access php web service in dot net windows application(Hello world application)
Please make little donation if you are like my hard work
- Create new folder and rename it to "server" on your server space
- ( local user just create in htdocs. )
- Download Nusoap library from
- nusoap it is zip file
- You have to extract the "lib" folder from it and paste to web root(I.E htdocs).
- Now create new php file in sever folder and rename it to "server.php"
- Paste the following code in it.
server.php
//include required class for build nnusoap web service server
require_once('../lib/nusoap.php');
// Create server object
$server = new soap_server();
// configure WSDL
$server->configureWSDL('hello world', 'urn:hellowsdl');
// Register the method to expose
$server->register('hello_world', // method
array('name' => 'xsd:string'), // input parameters
array('return' => 'xsd:string'), // output parameters
'urn:hellowsdl', // namespace
'urn:hellowsdl#hello', // soapaction
'rpc', // style
'encoded', // use
'Says hello world to client' // documentation
);
// Define the method as a PHP function
function hello_world($pName) {
return 'Hello world from, ' . $pName;
}
// Use the request to (try to) invoke the service
$HTTP_RAW_POST_DATA = isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA : '';
$server->service($HTTP_RAW_POST_DATA);
1.Open Visual Studio and create Windows Froms Application
(File->New->Project->Windows->Windows Forms Application).
2.Now Create label (Tools->Label ) name it to "lblname"
3.Now create textbox(Tools->TextBox) renamed it to "Txtname".
4.Now Create button (Tools->Button) renamed it to "btn_call_web_service_1"
5.Add Web Service Reference( Right click on your project and click on Add service Reference)
6.Service window will open now click on "Advance button located at bottom"
7.Service Reference Setting window will open Click on "Add Web Reference" button at bottom.
8.Now Add Web Reference window will open Enter server url
http://localhost:8080/webservice/nusoap/server/server.php?wsdl and click on "Go"
9.Now the services founds is displayed on window enter name of web service as "hello_world_from_php" and click on " Add Reference " button.
10.Now Double Click on call web service button created on form.
11.Code Window will open
12.Paste the bellow code and run application Your web service is now worked
(File->New->Project->Windows->Windows Forms Application).
2.Now Create label (Tools->Label ) name it to "lblname"
3.Now create textbox(Tools->TextBox) renamed it to "Txtname".
4.Now Create button (Tools->Button) renamed it to "btn_call_web_service_1"
5.Add Web Service Reference( Right click on your project and click on Add service Reference)
6.Service window will open now click on "Advance button located at bottom"
7.Service Reference Setting window will open Click on "Add Web Reference" button at bottom.
8.Now Add Web Reference window will open Enter server url
http://localhost:8080/webservice/nusoap/server/server.php?wsdl and click on "Go"
9.Now the services founds is displayed on window enter name of web service as "hello_world_from_php" and click on " Add Reference " button.
10.Now Double Click on call web service button created on form.
11.Code Window will open
12.Paste the bellow code and run application Your web service is now worked
Dim webservice As New hello_world_from_php.helloworld MsgBox(webservice.hello_world(txtname.Text))








9 comments:
thanks very much, it's really help me
That is a nice piece of code.
Very simple, very usefull.
Thanks for sharing.
Thanks! simple is the best^^
hi, i have craete a vb.net window application using nusoap web services. There is a module in my app. which runs every 2.5 sec (on timer tick event). On each tick event of timer this module call a web service method inside a background worker. It return some records in xml than this xml bind to datagridview. now the problem is sometime it shows :: The underlying connection was closed : A connection that was expected to be kept alive was closed.
how to solved it..
Hi,
I read your tutorial and followed the steps and it worked like a charm. I really appreciate this article
execute and result easy, i like. thanks very much. By Andreson
Can anyone upload the ziped project files, as i am a newbee?
Thanks for this post, it helped me a lot
Excellent pieces. Keep posting such kind of information on your blog. I really impressed by your blog.
Post a Comment