administration mode
Pssst...Ferdy is the creator of JungleDragon, an awesome wildlife community. Visit JungleDragon

 

Article: PHP & Web Services »

FERDY CHRISTANT - NOV 11, 2005 (07:07:52 PM)

Today I investigated how to create and consume web services in PHP. I was planning on writing an article about it, but found two extensive articles on the subject existing:

Both use the free NuSOAP library to both create and consume services in PHP. Instead of writing a similar article, I will cover two things:

  • Show the result of my own example, and explain how it is different
  • Demonstrate an effective way to test web services using a free tool called SoapUI

The code

Since my point is to get you up and running with web services in PHP, I'm keeping the actual service simple. My service exists out of a single "add" method that takes two integer values and returns the total, also as an integer. Following the approach in the article above, the end result of my PHP project is like this ("webservice" is my project's root folder):

FileDescription
webservice/libs/functions.phpContains the implementation of the add function
webservice/libs/nusoap.phpSOAP library
webservice/client.phpTests the web service
webservice/server.phpSOAP server

Go ahead a have a look at the source code of these files. Compared to the examples in the forementioned articles, there is only one difference, but it is an important one. Instead of including the function implementation in the server.php file, which generates the WSDL file, I have put the implementation in a separate file. Both approaches work, the difference is merely conceptual. I see a web service merely as a wrapper around existing functionality. A web service should define functionality, yet not implement it.

One cool feature of the NuSOAP library is that of web service inspection. If you open the server.php file in a browser, you will get something like this:


This basically is a friendly presentation of the methods in the WSDL file that is generated by server.php. Note that if you open server.php?wsdl you will get the raw XML output of the WSDL file. In this simple example, we have a single method defined in our service: ws_add.

Testing the web service

The project's file list contains a file named "client.php". This file performs a simple test on our web service, also using the NuSOAP library:

<?php
require_once('libs/nusoap.php');
$wsdl="http://yourhost/webservice/server.php?wsdl";
$client=new soapclient($wsdl, 'wsdl');
$param=array('int1'=>'15.00', 'int2'=>'10');
echo $client->call('add', $param);
?>

Although fairly easy, you may not want to write a test for each method you define in a web service like this, especially if your web service consumers are not other PHP scripts. Luckily, there's a more easy and effective way of testing a web service: SoapUI.

SoapUI is a free tool that allows you to test any web service. Let's see how we can use SoapUI to test our web service. I'll focus on a simple test, and leave you to play with the other features.

  • Download, install and start SoapUI
  • Go to File->New WSDL Project
  • Give your project any name
  • Choose a location to store your SoapUI project file
  • Right-click on your new project, and go to Add WSDL from URL
  • Enter http://yourhost/webservice/server.php?wsdl
  • Choose Yes to generate default requests for all methods
  • Expand the project tree and double-click on "Request1":
  • This is where the magic starts. You will now see a split-screen window. On the left, you will see your SOAP request. On the right, the SOAP response, which is empty because we haven't done anything yet. The thing to do now is to edit the parameters in the SOAP request. In the request you see two question marks ("?") for the values of the integer parameters of the ws_add function. Edit the values for your test purpose.
  • Click on the green "Play" button in the top of the window to send the SOAP request. The right panel has now returned the SOAP response. Inspect the "total" return value of the response to see if the ws_add web service is functioning properly.

click to enlarge

Conclusion

My conclusion is simple. Using the NuSOAP library, both creating and consuming web services is simple and effective. In combination with the SoapUI tool to test your work, you will become even more productive. As for next steps, keep in mind that the NuSOAP library can also use the XML-RPC and REST methods for web services.

Share |

Comments: 84
Reviews: 23
Average rating: rating
Highest rating: 5
Lowest rating: 1

COMMENT: DENNIS ATTINGER email

NOV 15, 19:22:21

comment » Leuk artikel! Erg duidelijk. Volgens mij kunnen we best wel vermelden dat uit testen bleek dat er goede ontwikkel- en testtools beschikbaar zijn om Webservices te bouwen met PHP. En is zie dan geen bezwaar om naar dit artikel te verwijzen.

Dennis «

COMMENT: DA

OCT 15, 07:21:30 AM

comment » Change following line

echo $client->call('add', $param);

to following line

echo $client->call('ws_add', $param); «

COMMENT: VIOLA

OCT 23, 02:03:10 AM

comment » have a question

What editor do you use to perform "Right-click on your new project, and go to Add WSDL from URL" «

COMMENT: TOM VAN LEIJSEN email

NOV 21, 13:23:17

comment » Please help me!

I've tried many, many examples. But by every example i'm trying i get only a boolean(false) back from my soap server.

Also in your example, could you please help me. «

COMMENT: GIZMOPOP emailrating

DEC 4, 09:18:41 PM

comment » thankmuch! «

COMMENT: DEEPTHI TALLURI email

DEC 17, 12:55:59 PM

comment » i am using wamp server,i have downloaded four files. This is the url i have used to test the webservice. http://localhost/webservice/client.php.

I got the follwing error

Fatal error: Cannot redeclare class soapclient in F:\wamp\www\webservice\libs\nusoap.php on line 7240

could you please give me the solution for this «

COMMENT: NGUYỄN NHÂN TÂM email

JAN 15, 2008 - 02:30:39 AM

comment » thank for your share . «

COMMENT: EGON

MAR 28, 2008 - 02:30:03 PM

comment » >Fatal error: Cannot redeclare class soapclient in >F:\wamp\www\webservice\libs\nusoap.php on line 7240

You have 2 soapclient's i think you work with php5.2 and included there to

the php_soap module delete that one

or nusoap or php_soap but not both «

COMMENT: HELLO emailrating

APR 11, 2008 - 12:30:34 PM

comment » Good work...... «

COMMENT: SHAJI rating

APR 24, 2008 - 09:36:23 AM

comment » gud «

COMMENT: EDDIE emailrating

APR 29, 2008 - 10:34:41 PM

comment » I get this in the response window:

Catchable fatal error: Object of class soapval could not be converted to string in C:\wamp\www\libs\nusoap.php on line 3613 «

COMMENT: PRITAM email

MAY 9, 2008 - 11:47:09 AM

comment » Hi, I tried out this NuSOAP but I am facing problems while implementing in this way.

1. I got this error "

Fatal error: Cannot redeclare class soapclient in C:\wamp\www\soap\lib\nusoap.php on line 7240". After so much hunting for sol'n on google.....I got some sol'ns... such as replace the class and function name from "soapclient" to "nusoap_client", "nusoapclientPE" etc....

I tried out the solution and the error was GONE! 18

BUT.....I didnt get any thing after this....means I am getting blank screen o n my browser.

2. I debugged it with call() function in nusoap.php file. In that the return variable getting blank...... Now I dont know why this is happening?

Please let me know the sol'n on this AEAP. its a urgent for me.

For your reference ...

1)I am using WAMP5 Ver 1.6.6 as a server.

2)Also my host port is 81(i.e. localhost:81).

3)OS-> Win XP Prof.

Hope you will reply me with the sol'n AEAP.

Thanks,

Pritam «

COMMENT: MANOHAR rating

MAY 23, 2008 - 12:39:31 AM

comment » Works good. I had to change the nusoap.php to change soapclient to soapclient2 as soapclient is already defined somewhere in php. However, the issue I'm looking at is that the client page is empty/blank. I think it's the same issue as TOM VAN LEIJSEN's. Else good work and thanks much. «

COMMENT: CARLOS OROZCO emailhomepagerating

JUN 8, 2008 - 17:49:15

comment » "Catchable fatal error: Object of class soapval could not be converted to string in C:\wamp\www\libs\nusoap.php on line 3613"

I fix this problem making an upgrade of the unsoap library on http://sourceforge.net/projects/nusoap/ and all works like a charm. Thanks to the author for the valuable info.

Best Regards, «

COMMENT: GML email

JUN 12, 2008 - 10:26:28 AM

comment » Hi!

I've a question . How can I test several webs services at once, with soapUI tool?

Thanks it advance «

COMMENT: CARLOS

JUL 3, 2008 - 17:48:33

comment »

thanks thanks thanks !!!!!!! After many days of fighting with WS this doc I finish close some ideas and be able to walk my own webserver .... thanks again! and sory for my bad inglish. I am argentine!!! «

COMMENT: HEENA

AUG 15, 2008 - 02:14:46 AM

comment » Hi i copied all files and tried to run it but is just went blank... no output...

and i m getting this error

PHP Catchable fatal error: Object of class soapval could not be converted to string in /development/meshconference/meshampintranet/web/nusoap.php on line 3613

please help me to find out whats wrong... «

COMMENT: REDDRAGON email

AUG 21, 2008 - 11:11:03 AM

comment » hello..can anyone give me an example of nusoap with a web service that access a database..a simple insert will do 18 «

COMMENT: SD

AUG 22, 2008 - 11:29:13 AM

comment » 19 «

COMMENT: ANGGA LINGGA emailhomepagerating

AUG 22, 2008 - 05:49:45 PM

comment » Thank you for this information. 18 18 «

COMMENT: RENJITH

SEP 20, 2008 - 05:11:05 AM

comment » what are advantages of webservice in php «

COMMENT: RENJITH

SEP 20, 2008 - 05:12:58 AM

comment » Can anyone give me the example of php webservice «

COMMENT: MARTIN email

NOV 22, 2008 - 14:51:24

comment » The examples is fine but in order to make it work you have to change a bit.

first change the call to the webservice in 'client.php'

echo $client->call('ws_add', $param); «

COMMENT: MARTIN email

NOV 22, 2008 - 14:52:01

comment » second you have to change the definition of the function in 'server.php'

function ws_add($int1, $int2){

#return new soapval('return','xsd:integer',add($int1, $int2));

return add($int1, $int2);

} «

COMMENT: MARTIN email

NOV 22, 2008 - 14:54:29

comment » oh come on!!!

HTTP Web Server: Lotus Notes Exception - The formula has exceeded the maximum allowable memory usage. «

COMMENT: MARTIN email

NOV 22, 2008 - 14:54:56

comment » in case of trouble add the following at the end of 'client.php'

debug_str;?> «

COMMENT: WEBDESIGN emailhomepage

DEC 16, 2008 - 11:05:11

comment » Very nice explenation :) i was just looking for a WSDL light shine on my code !

THX «

COMMENT: SUDHAKAR email

MAR 23, 2009 - 09:55:07 AM

comment » Cannot redeclare class soapclient in C:\wamp\www\soap\lib\nusoap.php on line 7240 i am getting this type error i am using Xamp so plz tell me the solutiojn 04 «

COMMENT: JASPAL SINGH emailhomepage

APR 8, 2009 - 11:26:41 AM

comment » I like the article and the same code for creating my own web service as well. «

COMMENT: MUHAMMAD SOHAIL emailhomepagerating

APR 18, 2009 - 12:47:07 PM

comment » Great tutorial and great discussion. Very helpful.

Finally I have successfully created nusoap web service.

Thanks to all of you. «

COMMENT: SATISH email

APR 25, 2009 - 03:17:41 PM

comment » Hi ya,

can you please tell how to append data in nusoap web service in single url address field. can you please say for above example.

best,

satish «

COMMENT: RAHEEL rating

MAY 6, 2009 - 04:04:04 PM

comment » Hi,

This was pretty simple and handy example for a beginner to start with web services in php.

I have one issue. Web services in php doesn't allow session management. I have spend a whole day in finding out some stuff but nothing paid my bills. I was trying a simple task i.e. refresh already instantiated session just to keep session alive. The main aim is that my vendor wants to access web service to keep the session alive by accessing it after every 20 minutes. ASP.net seems to have this facility but not php.

Wish somebody can come up with some solution.

Thanks in advance «

COMMENT: SAGAR J email

MAY 15, 2009 - 03:21:18 PM

comment » Superb example. Thanks i loved it.

Finally through the WebService.

Just one thing

for PHP 5.2 use

d/l new nusoap library and use

$client=new nusoap_client($wsdl, array('wsdl'));

LOL «

COMMENT: SAURABH emailhomepage

MAY 25, 2009 - 06:33:17 PM

comment » I have a problem while consuming Java web service in PHP; the error is

No Deserializer found to deserialize a 'http://com.myserver.webservice/myWS.xsd:ArrayOfcom_myservertype_WeoTrvFamilyParamInUser; using encoding style http://schemas.xmlsoap.org/soap/encoding/. [java.lang.IllegalArgumentException]

Any one Any Idea?

Thanks heaps everyone

Saurabh «

COMMENT: RAJ GOHIL

JUN 5, 2009 - 08:34:46 PM

comment » if you get "Notice: Undefined variable: HTTP_RAW_POST_DATA" error Please open Server.php file add find $server->service($HTTP_RAW_POST_DATA);

and replace with following 2 lines.

if ( !isset( $HTTP_RAW_POST_DATA ) ) $HTTP_RAW_POST_DATA =file_get_contents( 'php://input' );

$server->service($HTTP_RAW_POST_DATA);

I hope this would help. «

COMMENT: MOHAN KRISHANA

JUN 24, 2009 - 01:34:39 PM

comment » Hello perer,

Its really a nice one , Guys http://vinsomania.blogspot.com/2009/06/php-web-services-with-nusoap.html

its really nice

cooll

Krishna «

COMMENT: BHARAT email

JUL 27, 2009 - 12:30:19 PM

comment » Hi thanx for the giving the gide-lines but i'm beginner in php and want to create web service in php so can you please give me stapes.. 17 «

COMMENT: BANAVOZ homepage

AUG 12, 2009 - 04:17:06 PM

comment » Hello, thank you for this post,

Here is another example of using built-in PHP SOAP extension:

http://banavoz.com/2009/08/implementing-soap-web-service-in-php/

Have a nice day! «

COMMENT: SUEN email

AUG 25, 2009 - 09:55:35

comment » Hi ~

I have tried to use SoapUI to test but how could I test the php soap server by the client.php?

thx a lot~ «

COMMENT: ALEX email

OCT 2, 2009 - 04:56:26 PM

comment » Hello

I am actually using soapUI and I also think it is great. It saves a lot of time.

I would like to be able to change the endpoint on php if different than the one given on the wsdl file. I magaed to do this on soapUI but so far I have been unable to do it on a php file.

Hope you can help. «

COMMENT: SHAUN emailhomepage

OCT 13, 2009 - 11:09:08

comment » I'd definatley recommend the nusoap library which has also been pointed out by someone else in this comment list.

Reasons:

Good with OOPHP5+

Very well structured

Rather easy to understand/implament 17 «

COMMENT: TAN-TAN emailhomepage

OCT 14, 2009 - 10:43:57 AM

comment » I try to release a PHP WSDL BPEL engine, base on PHP CLI application server.

Any help would be appreciated.

http://code.google.com/p/ezerphp/ «

COMMENT: BIBHU emailrating

NOV 5, 2009 - 05:58:47 AM

comment » Just upgrade the nusoap.php works fine as it is mentioned in the article.

Thanks «

COMMENT: ERIK rating

NOV 30, 2009 - 11:34:48

comment » very nice article.

But I needed to implement Martin's 2 fixes to the client and server to get the example to work.

But otherwise, a very well written article. «

COMMENT: SUNIL JOSEPH emailhomepage

DEC 2, 2009 - 12:11:51 PM

comment » The tutorial is very excellent.. when I run the client.php, I came across an exception as follows

Fatal error: Uncaught SoapFault exception: [Client] Function ("call") is not a valid method for this service in D:\xampp\htdocs\webservice\client.php:6 Stack trace: #0 [internal function]: SoapClient->__call('call', Array) #1 D:\xampp\htdocs\webservice\client.php(6): SoapClient->call('ws_add', Array) #2 {main} thrown in D:\xampp\htdocs\webservice\client.php on line 6

I am using XAMPP 1.7.0 in Windows XP

Any help is appreciated

thanks in advance «

COMMENT: SOFA rating

JAN 7, 2010 - 15:08:38

comment » After some problems, I was able to run sucessfully this example - also with SoapUI (which has immediatelly worked).

Thank you for very usefull article «

COMMENT: ASHIM SIKDER emailrating

JAN 11, 2010 - 08:52:12 PM

comment » I have tried in local with all the given suggestion but don't work. When I upload all the files to online server then it works fine. Thanks to everybody for valuable comments.

Things need to keep in mind.

1. download Updated version nusoap.php from http://sourceforge.net/projects/nusoap/

2. in client.php file enter online hosting server name [not localhost] $wsdl="http://onlinehostingserver/server.php?wsdl";

2. in client.php file change to $client=new nusoap_client($wsdl, array('wsdl'));

Thanks

Ashim «

COMMENT: SANJEET KUMAR email

MAR 18, 2010 - 12:04:06 PM

comment » I have an issues, web service is in php and client in java.PHP web service receive data sent from java client but java client always receive null.Please help me. «

COMMENT: SANJEET KUMAR email

MAR 18, 2010 - 12:49:06 PM

comment » how can we write a java client for a webservice developed using php NuSoap,if u could give me an example for this,it would be appreciated «

COMMENT: FERDY

MAR 18, 2010 - 21:10:47

comment » @Sanjeet. You will build a java client for a PHP web service like you build them for any web service. PHP Nu SOAP exposes a web service, the fact that it runs on PHP is entirely irrelevant. «

COMMENT: GARRY rating

MAR 30, 2010 - 07:18:40 PM

comment » demo not working! cant find any demo for webservice in php :( «

COMMENT: NIKUNJ emailhomepage

APR 21, 2010 - 06:22:19 PM

comment » 06 hi ! well nice post here I implements how to call php nusoap web service in .net

http://my-source-codes.blogspot.com/2010/04/access-php-web-service-in-vbnet.html «

COMMENT: JAWAD email

APR 22, 2010 - 09:53:26 AM

comment » That's a great tutorial. Thanx to all of you guys. The discussion is great. «

COMMENT: J email

MAY 14, 2010 - 03:50:15 PM

comment » question ferdy, I'm not particularly using nusoap but the SOAP class in PHP 5.3 so far so good, I can fetch things easily but then I'm getting confused how I can customize the result

ps. I look at the response and in my case it's in XML, now I'm thinking to bind the result with my XSLT and now I'm pretty much have no idea how that would be done...or maybe if the result is actually is in array, I might simply take each content of the array out and place them in the HTML tags without the needs of XSLT (also save my day if I want to paginate the result)

thanks.

J «

COMMENT: AMAN homepagerating

JUN 11, 2010 - 12:41:18 PM

comment » 16 .......Hey every thing is working fine but the output is not displayed by the client.php........ wats wrong in that???????

i have updated the links in client for the WSDL and also uses NuSOAP for PHP5

no error is coming but it also not showing the output!!!!

PLz Help,

Thanx in Advance «

COMMENT: GREG

AUG 19, 2010 - 02:32:59 PM

comment » its showing only 1 for any input.

please help me «

COMMENT: BRIAN

AUG 30, 2010 - 03:29:14 PM

comment » I was having the same problem Aman is having - everything seemed right, no errors, but no output. This was when when I was working locally with a virtual server. When I posted the server file to an actual webserver and directed my local client file it worked! 18 Thanks Ashim! «

COMMENT: PAUL email

DEC 6, 2010 - 06:52:31 PM

comment » Syntax on this line should be:

echo $client->__call('ws_add', $param);

It was missing the double-underscore in the example and didn't work until I added it. «

COMMENT: PAUL email

DEC 6, 2010 - 06:55:57 PM

comment » I meant to add that this is the FIRST tutorial on PHP/WSDL that I've actually been able to make work, so thank you! «

COMMENT: SANDEEP VERMA emailhomepagerating

DEC 7, 2010 - 08:42:19 AM

comment » Very Good!

How to test all web services in PHP? «

COMMENT: ZAILANI emailrating

JAN 3, 2011 - 04:09:06 AM

comment » pls help me.....how to retrieve username and password in php using SOAPUI... 03 «

COMMENT: QWERTY homepagerating

JAN 3, 2011 - 02:15:37 PM

comment » testing url for testing comments.. «

COMMENT: BAIBHAV email

FEB 2, 2011 - 12:22:48 PM

comment » thanks,

This site helped me a lot as I'm new to ws. «

COMMENT: BENMAK homepage

FEB 11, 2011 - 02:28:50 PM

comment » make sure "extension=php_soap.dll" is disabled in php.ini file «

COMMENT: AMIT email

FEB 19, 2011 - 06:50:46 AM

comment » This article is very help full for me. Can any body tell me how can i return array or multiple values from web services .. «

COMMENT: CHAMIKA email

FEB 24, 2011 - 12:23:26 PM

comment » Thank you very much for ur help. but i got these issue.

1. Fatal error: Cannot redeclare class soapclient in D:\xampp\htdocs\webservice\libs\nusoap.php on line 7240

Then i took the latest nusoap.php and replaced with the old one.

server.php is working as you said.

but client.php gives

Warning: SoapClient::SoapClient() expects parameter 2 to be array, string given in D:\xampp\htdocs\webservice\client.php on line 4

Fatal error: Uncaught SoapFault exception: [Client] SoapClient::SoapClient() [soapclient.soapclient]: Invalid parameters in D:\xampp\htdocs\webservice\client.php:4 Stack trace: #0 D:\xampp\htdocs\webservice\client.php(4): SoapClient->SoapClient('http://localhos...', 'wsdl') #1 {main} thrown in D:\xampp\htdocs\webservice\client.php on line 4

Can i have any solution for this problem. «

COMMENT: CHAMIKA email

FEB 25, 2011 - 07:26:34 AM

comment » if you use

require_once('libs/nusoap.php');

$wsdl="http://xxx.xxx.x.xxx/webservice/server.php?wsdl";

$client=new nusoap_client($wsdl);

$param=array('int1'=>'15.00', 'int2'=>'10');

echo $client->call('ws_add', $param);

Then the above problem won't come!!! this is i think

NuSOAP's class name is 'soapclient'. PHP5 includes a SOAP extension whose class name is also 'soapclient'. As a result, you effectively can't use NuSOAP with PHP5. NuSOAP for PHP5 simply changes the class name to 'nusoap_client'.

28 «

COMMENT: ROTCEH

MAR 21, 2011 - 16:26:35

comment » Hello i recently worked at a project where i developed some web services on Php 5.1.6 and OS Windows but when i tried to deploy the work on a server on linux with php 5.3.2 BUM!!!!!!! this error apear:

"Message: Assigning the return value of new by reference is deprecated

Filename: lib/nusoap.php"

i don't know what to do, because i could't find any update to nusoap library thats works well with php 5.3.2

Someone can share the solution? «

COMMENT: JEDRZEJ rating

JUN 21, 2011 - 11:13:41

comment » Good «

COMMENT: BIJAY KARM emailhomepage

JUN 21, 2011 - 12:40:32 PM

comment » I have downloaded all the 4 files and put in the wamp,

but when i start that client.php

but it doesn't shows the result.

Note: i have put all the files in appropiate folder «

COMMENT: MBENTO emailrating

JUN 27, 2011 - 16:49:09

comment » Many thanks, it works just fine. :) «

COMMENT: DAAN rating

JUL 18, 2011 - 12:16:21 PM

comment » Thanks.Very useful.. «

COMMENT: VASAGAN email

JUL 28, 2011 - 12:35:35 PM

comment » Can i nusoap for buil wsdl file in document - literal??? .. Please adivice me «

COMMENT: WARLORD emailhomepage

AUG 17, 2011 - 05:36:09 AM

comment » Best thing is if your keyword targeted pages are part of the ordinary menu-structure. But it still makes sense to promote certain keywords in a site-wide navigation.php simple xml But make it good for usability. In a footer element add links to the most viewed pages from Google Analytics,

thank you, «

COMMENT: FARHAD email

AUG 22, 2011 - 01:33:37 PM

comment » Hi,

Any one can how to create a web servicces using php,actually i'm new in web services,

i'm waiting for your response. «

COMMENT: ALMAS emailrating

SEP 9, 2011 - 02:40:06 PM

comment » When I run the script webservice/server.php, it shows blank.

Please tell me the details.

Thanks «

COMMENT: RALPH VAN DER HORST emailhomepage

SEP 22, 2011 - 08:27:31 AM

comment » Thanks for this example. With some tweaking it worked perfectly. I had it up and running in half an hour!

many thanks

Ralph van der horst

Freelance Testconsultant in The Netherlands «

COMMENT: RALPH VAN DER HORST emailhomepage

SEP 22, 2011 - 08:41:38 AM

comment » Regarding "Catchable fatal error: Object of class soapval could not be converted to string in C:\wamp\www\libs\nusoap.php on line 3613"

Quick solution:

I have edited and decomment this in nusoap.php and the soapui test worked like a charm. «

COMMENT: MAURIZIO emailhomepagerating

SEP 27, 2011 - 12:41:37 AM

comment » OMG, I have tried and tried to find anything useful online to start SOAP on PHP and this is by far the best most comprehensible and complete tutorial that I could find!

Thank you so much!

P.S. I am on linux and it works there as well «

COMMENT: SANDEEP PATHAK emailhomepage

OCT 12, 2011 - 11:55:39 AM

comment » Hello All,

I am a web developer working in india ... with a company . i just want to know the initial steps for creating webservices ... i mean do any one have any refrence website which show me the tutorial of creating web services in php...please help me asap its quite impotent for me «

COMMENT: JAMES VINCE emailhomepage

OCT 14, 2011 - 13:24:13

comment » The server worked fine for me, but when I use the client I get the following error:

Fatal error: Uncaught SoapFault exception: [Client] SoapClient::SoapClient(): Invalid parameters in /var/www/webservice/client.php:10 Stack trace: #0 /var/www/webservice/client.php(10): SoapClient->SoapClient('http://127.0.0....', 'wsdl') #1 {main} thrown in /var/www/webservice/client.php on line 10

Any help?

P.s I have only altered to set the server as http://127.0.0.1/webservice/server.php?wsdl «

COMMENT: ARUN KUMAR GUPTA email

NOV 1, 2011 - 07:32:40 AM

comment » I have downloaded all four file and then I have made rename the class soapclient to soapclient1 in nusoap.php and same in client.php.

After running the script client.php, there are nothing to print, no output. «

COMMENT: ERIK SOLIS

JAN 11, 2012 - 11:30:24 P.M.

comment » Code for the client.php

require_once('libs/nusoap.php');

$wsdl="http://localhost/server.php?wsdl";

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

$param=array('int1'=>'1515.00', 'int2'=>'1515');

echo $client->call('ws_add', $param);

perfect !! «

COMMENT: TAHUITE email

FEB 2, 2012 - 11:34:25 P.M.

comment » I'm trying to delimit the int1 to 5 max length, but I can't solve my problem, someone have the answer?

Thanks a lot. «

RATE THIS CONTENT (OPTIONAL)
Was this document useful to you?
 
rating Awesome
rating Good
rating Average
rating Poor
rating Useless
CREATE A NEW COMMENT
required field
required field HTML is not allowed. Hyperlinks will automatically be converted.