Can you do PHP Data Serivces in REST style with WSF/PHP 2.0.0. Yes certainly you can do it.
Check out this demo about 'RESTful School' and see how can map unique urls to each piece of data you have.
Check "Do REST in PHP - PHP RESTful Data Services" for a guideline of the demo.
Showing posts with label Demo. Show all posts
Showing posts with label Demo. Show all posts
PHP Data Services With WS-Security
Tuesday, September 16, 2008
When it come to a PHP application with WS-Security, you should be using WSF/PHP somewhere. Similarly with the new Data Services library WSF/PHP become the only option to host Data Services with WS-Security.
Read my blog post on Data Services with WS-Security where I used an online DEMO application to demonstrate the use of WS-Security in Data Services.
Read my blog post on Data Services with WS-Security where I used an online DEMO application to demonstrate the use of WS-Security in Data Services.
Labels:
Data Services,
Demo,
WS-Security,
WSF/PHP
Interoperability demo PHP, PERL, RUBY, JAVA, SPRING and .NET Web Services
Thursday, July 24, 2008
If you are around OSCON, don't miss this. There you can see a live demo for interoperability of web services using WSO2 WSF/PHP, WSF/Ruby, WSF/Perl, WSF/Python, WSF/Spring and WSAS and Microsoft .NET technologies. http://www.marketwatch.com/news/story/wso2-adds-three-platforms-microsoft/story.aspx?guid={16B1B777-531B-49FD-82BA-6D4CD426FD2F}&dist=hppr
Labels:
.NET,
Demo,
OSCON,
Stock Trader,
WSAS,
WSF/Perl,
WSF/PHP,
WSF/Spring
WSF/PHP on TechEd IT 2008
Tuesday, June 10, 2008
The interoperability between Microsoft Web Services (.NET 3.5) with WSO2 WSF/PHP and WSAS was presented at TechEd IT 2008. You can read more about this from Jonathan Marsh.
Labels:
.NET,
Demo,
Interoperability,
TechEd,
WSAS
WSDL Generation with and without $classmap option
Sunday, June 8, 2008
The $classmap is an option you can provide to the WSService constructor to tells the WSF/PHP engine that how you map the xml elements to PHP classes in your program.
When you provide classmap option, your service function declration should be such that it input the request object and output the response object.
When you don't provide classmap option, you will have a service function declration with set of input fields as input parameters. (Note that in both cases the response can be either an array or response, only the request parameter set is different from each other in two cases)
You can see how the WSDL is genererting for both above cases, which will also demonstrate the different between the service fuction declarations.
1. When the $classmap is provided, http://labs.wso2.org/wsf/php/php2wsdltool.php?example=Example3
The function declration is
/**
* echoValue function
* @param object Foo $echoString echoString description
* @return object FooResponse $echoStringResponse
*/
function echoValue($echoString){
}
2. When the $classmap is not provided, http://labs.wso2.org/wsf/php/php2wsdltool.php?example=Example4
The function declration is
/**
* echoValue function
* @param array of object Foo $param1 param1 description
* @param string $param2
* @return array of object Boo $ret_value
*/
function echoValue($param1, $param2){
}
You can find more details at here, http://wso2.org/project/wsf/php/1.3.2/docs/wsdl_generation_api.html
When you provide classmap option, your service function declration should be such that it input the request object and output the response object.
When you don't provide classmap option, you will have a service function declration with set of input fields as input parameters. (Note that in both cases the response can be either an array or response, only the request parameter set is different from each other in two cases)
You can see how the WSDL is genererting for both above cases, which will also demonstrate the different between the service fuction declarations.
1. When the $classmap is provided, http://labs.wso2.org/wsf/php/php2wsdltool.php?example=Example3
The function declration is
/**
* echoValue function
* @param object Foo $echoString echoString description
* @return object FooResponse $echoStringResponse
*/
function echoValue($echoString){
}
2. When the $classmap is not provided, http://labs.wso2.org/wsf/php/php2wsdltool.php?example=Example4
The function declration is
/**
* echoValue function
* @param array of object Foo $param1 param1 description
* @param string $param2
* @return array of object Boo $ret_value
*/
function echoValue($param1, $param2){
}
You can find more details at here, http://wso2.org/project/wsf/php/1.3.2/docs/wsdl_generation_api.html
Labels:
1.3.*,
Class Map,
Demo,
Example,
WSDL Generation
Data Services With WSF/PHP
Friday, March 14, 2008
Today we host an initial version of demo to illustrate how you can do Data Services with WSF/PHP. The demo is built top of an framework which can be used to expose your data in the database as a Web Service in easy steps. There you only need to specify the input and result format as xml and the specific SQL query.
Hope this will be really useful for people who were eager to see how Data Services can be done in PHP.
Hope this will be really useful for people who were eager to see how Data Services can be done in PHP.
Labels:
Data,
Data Services,
Demo,
Demo Site,
WSF/PHP
[ANN] WSO2 WSF/PHP Demo site Launched
Tuesday, March 11, 2008
WSO2 WSF/PHP team is pleased to announce the launch of WSO2 WSF/PHP Demo Site - http://labs.wso2.org/wsf/php
WSO2 WSF/PHP Demo site is a place where users can try out demonstrations powered by WSO2 Web Service Framework for PHP (WSF/PHP) online. In addition to that it gives the facility to study, view the source code and refer related articles, tutorials for each demo.
We invite the WSF/PHP community to login to the site and give feedback on demos by rating and commenting on them.
You can post suggestions and possible improvements to the demo site via WSO2 WSF/PHP mailing list wsf-php-user@wso2.org
Thanks for you interest in WSO2 WSF/PHP Demo site
-- WSO2 WSF/PHP Team --
http://wso2.org/projects/wsf/php
WSO2 WSF/PHP Demo site is a place where users can try out demonstrations powered by WSO2 Web Service Framework for PHP (WSF/PHP) online. In addition to that it gives the facility to study, view the source code and refer related articles, tutorials for each demo.
We invite the WSF/PHP community to login to the site and give feedback on demos by rating and commenting on them.
You can post suggestions and possible improvements to the demo site via WSO2 WSF/PHP mailing list wsf-php-user@wso2.org
Thanks for you interest in WSO2 WSF/PHP Demo site
-- WSO2 WSF/PHP Team --
http://wso2.org/projects/wsf/php
Simple Calculator - Demo of use of WSDL mode
Here are the steps I followed to create a simple Calculator Service + client.
1. Stated with the CalculatorDoc.wsdl found in here, http://svn.apache.org/repos/asf/webservices/axis2/trunk/c/test/resources/wsdl/CalculatorDoc.wsdl
2. Generated server side code using the wsdl2php.php script packed with the WSO2 WSF/PHP 1.2.1.
3. Run the wsdl2php.php script from command prompt with the following arguments.
/my/home/scripts/wsdl2php.php -s CalculatorDoc.wsdl
Here '-s' means for the server side.
4. I redirected output to the service.php in my linux system, so the command was like
/my/home/scripts/wsdl2php.php -s CalculatorDoc.wsdl > service.php
In a case this this doesn't work for you copy and paste the code to the service.php file.
5. Filled the adding/ subtraction/ multiplication/ division algorithm inside method bodies. There are helping comments which guide you what are the types of parameters and return value in the function, here is my way of doing it.
6. Now put the service.php in to your web root directory or some sub directory inside the web root and make sure it is correctly deployed by typing the location in the browser. For an example, I put my service.php inside calculator sub directory inside the web root, so I tested in the browser by typing http://localhost/calculator/service.php
Note: that this doesn't test the algorithm of the service, but just it make sulre the service and the operation set are correctly deployed.
7. So now you can write a client to test the service operation, You can generate a client with the following command,
/my/home/scripts/wsdl2php.php CalculatorDoc.wsdl
Note that the '-s' is dropped.
8. Go through the TODO comments and fill the client logic by filling sample input to test the service,
9. One more thing, The wsdl is coded with it s endpoint, but for you to test you need to change the endpoint to where you have actually test the service, for an example in my case to " http://localhost/calculator/service.php"
You can do the change in the wsdl. But there is an option in the WSClient constructor where you can give the service endpoint.
So my new WSClient constructor looks like this,
10. That is all I did, And Finally run the client with the following command,
php client.php
And I received the expected output as following,
3 + 4 = 7
3 - 4 = -1
3 * 4 = 12
3 / 4 = 0.75
1. Stated with the CalculatorDoc.wsdl found in here, http://svn.apache.org/repos/asf/webservices/axis2/trunk/c/test/resources/wsdl/CalculatorDoc.wsdl
2. Generated server side code using the wsdl2php.php script packed with the WSO2 WSF/PHP 1.2.1.
3. Run the wsdl2php.php script from command prompt with the following arguments.
/my/home/scripts/wsdl2php.php -s CalculatorDoc.wsdl
Here '-s' means for the server side.
4. I redirected output to the service.php in my linux system, so the command was like
/my/home/scripts/wsdl2php.php -s CalculatorDoc.wsdl > service.php
In a case this this doesn't work for you copy and paste the code to the service.php file.
5. Filled the adding/ subtraction/ multiplication/ division algorithm inside method bodies. There are helping comments which guide you what are the types of parameters and return value in the function, here is my way of doing it.
// define PHP functions that maps to WSDL operations
function add($input) {
// TODO: fill in the business logic
// NOTE: $input is of type add
$a = $input->arg_0_0;
$b = $input->arg_1_0;
$c = $a + $b;
// NOTE: should return an object of type addResponse
$res = new addResponse();
$res->addReturn = $c;
return $res;
}
function sub($input) {
// TODO: fill in the business logic
// NOTE: $input is of type sub
$a = $input->arg_0_1;
$b = $input->arg_1_1;
$c = $a - $b;
// NOTE: should return an object of type subResponse
$res = new subResponse();
$res->subReturn = $c;
return $res;
}
function mul($input) {
// TODO: fill in the business logic
// NOTE: $input is of type mul
$a = $input->arg_0_2;
$b = $input->arg_1_2;
$c = $a * $b;
// NOTE: should return an object of type mulResponse
$res = new mulResponse();
$res->mulReturn = $c;
return $res;
}
function div($input) {
// TODO: fill in the business logic
// NOTE: $input is of type div
$a = $input->arg_0_3;
$b = $input->arg_1_3;
$c = $a / $b;
// NOTE: should return an object of type divResponse
$res = new divResponse();
$res->divReturn = $c;
return $res;
}
6. Now put the service.php in to your web root directory or some sub directory inside the web root and make sure it is correctly deployed by typing the location in the browser. For an example, I put my service.php inside calculator sub directory inside the web root, so I tested in the browser by typing http://localhost/calculator/service.php
Note: that this doesn't test the algorithm of the service, but just it make sulre the service and the operation set are correctly deployed.
7. So now you can write a client to test the service operation, You can generate a client with the following command,
/my/home/scripts/wsdl2php.php CalculatorDoc.wsdl
Note that the '-s' is dropped.
8. Go through the TODO comments and fill the client logic by filling sample input to test the service,
// create input object and set values
$input = new add();
//TODO: fill in the class fields of $input to match your business logic
$input->arg_0_0 = 3;
$input->arg_1_0 = 4;
// call the operation
$response = $proxy->add($input);
//TODO: Implement business logic to consume $response, which is of type addResponse
echo "3 + 4 = {$response->addReturn}\n";
$input = new sub();
//TODO: fill in the class fields of $input to match your business logic
$input->arg_0_1 = 3;
$input->arg_1_1 = 4;
// call the operation
$response = $proxy->sub($input);
//TODO: Implement business logic to consume $response, which is of type subResponsee
echo "3 - 4 = {$response->subReturn}\n";
$input = new mul();
//TODO: fill in the class fields of $input to match your business logic
$input->arg_0_2 = 3;
$input->arg_1_2 = 4;
// call the operation
$response = $proxy->mul($input);
//TODO: Implement business logic to consume $response, which is of type mulResponsee
echo "3 * 4 = {$response->mulReturn}\n";
$input = new div();
//TODO: fill in the class fields of $input to match your business logic
$input->arg_0_3 = 3;
$input->arg_1_3 = 4;
// call the operation
$response = $proxy->div($input);
//TODO: Implement business logic to consume $response, which is of type divResponsee
echo "3 / 4 = {$response->divReturn}\n"
9. One more thing, The wsdl is coded with it s endpoint, but for you to test you need to change the endpoint to where you have actually test the service, for an example in my case to " http://localhost/calculator/service.php"
You can do the change in the wsdl. But there is an option in the WSClient constructor where you can give the service endpoint.
So my new WSClient constructor looks like this,
// create client in WSDL mode
$client = new WSClient(array ("wsdl" =>"CalculatorDoc.wsdl",
"to" => "http://localhost/calculator/service.php",
"classmap" => $class_map));
10. That is all I did, And Finally run the client with the following command,
php client.php
And I received the expected output as following,
3 + 4 = 7
3 - 4 = -1
3 * 4 = 12
3 / 4 = 0.75
Labels:
Calculator,
Demo,
Tutorial,
WSDL mode,
wsdl2php
PHP Amazon Client Demo
Thursday, March 6, 2008
This demo shows you how to consume the Amazon e-commerce SOAP API with PHP. It is a live demo, that you can view online and if you ever wonder how to do that in PHP, the source code is also available.
There is an associated tutorial too, that you can find in the above link. The tutorial explains step-by-step what you have to do to consume the Amazon API.
Subscribe to:
Posts (Atom)