tag:blogger.com,1999:blog-43151946644294551352024-03-07T23:00:38.776-08:00PHP Web ServicesPHP Web services: SOAP, REST, WS-*, SOA and WOA with PHP.Samisahttp://www.blogger.com/profile/00210607048713861579noreply@blogger.comBlogger227125tag:blogger.com,1999:blog-4315194664429455135.post-6271670729256133132011-09-03T22:53:00.001-07:002011-09-03T22:56:21.472-07:00WSO2 Con for all.<p><a href="http://lh6.ggpht.com/-pzqbU5vN8cs/TmMS-hucH9I/AAAAAAAAAdE/BXMLUMPlCp8/s1600-h/image%25255B9%25255D.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://lh4.ggpht.com/-R3BlwuHDWAc/TmMS_57BXAI/AAAAAAAAAdI/o6gYM9C8_Fw/image_thumb%25255B5%25255D.png?imgmax=800" width="719" height="165" /></a> WSO2 con is probably the biggest open source IT event happening in Sri Lanka. Apart from the other open source events that took place in the past like FOSSSL and Apache Con Asia, WSO2 Con is the only IT conference that brings together industry leaders from around the world to share their knowledge and experiences in Sri Lanka.  </p> <p>Modeled after Apache Con, WSO2 Con has added tutorial tracks to the conference this year in addition to speaker sessions and key notes. Just like it was in last year, some greats in the industry will be delivering keynotes. Also some fantastic sessions have been lined up to share experiences in building open source middleware and solving integration problems using those software. </p> <p>If you want to dive deep and learn stuff hands on , don’t miss the tutorial tracks. There is nothing like learning from someone who has actually been there and done it. </p> <p>Add to that the great food that will be served, you are in for an event you will remember. </p> <p>Find out more about WSo2 Con at <a href="http://wso2.com/events/wso2con-2011-colombo/">http://wso2.com/events/wso2con-2011-colombo/</a></p> <p><a href="http://lh6.ggpht.com/-dpEGFEpKvJg/TmMTAmT0sNI/AAAAAAAAAdM/1DPOiCdGqns/s1600-h/image%25255B5%25255D.png"> </a></p> nandikajayawardanahttp://www.blogger.com/profile/11920576746810295004noreply@blogger.com2tag:blogger.com,1999:blog-4315194664429455135.post-22541822238789463392010-12-31T00:22:00.001-08:002010-12-31T00:23:11.759-08:00?xsd option added to WSF/PHP<p> ?xsd is an standard option to serve an xsd file imported within a wsdl. This was a missing feature in WSF/PHP. In WSF/PHP automatic wsdl generation, it does not generate additional xsds which are imported by the wsdl and hence this option would not be required. However, with wsdl mode, you could have additional xsds imported in the wsdl. Now you can obtain these xsds with the option ?xsd=xsdfilename.xsd.</p> <p><a href="http://lh6.ggpht.com/_honSoB4kSVs/TR2Sq3n9LwI/AAAAAAAAAZ0/Hiunkxw5tgg/s1600-h/image%5B3%5D.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://lh4.ggpht.com/_honSoB4kSVs/TR2St2e7RlI/AAAAAAAAAZ4/h0suAYA88Ig/image_thumb%5B1%5D.png?imgmax=800" width="700" height="275" /></a></p> nandikajayawardanahttp://www.blogger.com/profile/11920576746810295004noreply@blogger.com1tag:blogger.com,1999:blog-4315194664429455135.post-75092698720168681962010-12-30T23:15:00.001-08:002010-12-30T23:15:07.398-08:00How to statically serve a wsdl with WSF/PHP.<p>WSF/PHP has two modes of operations. When using wsdl mode, you will always start with a wsdl and hence, that wsdl will be served for ?wsdl request. On the other hand, you can write a service with annotations and the corresponding wsdl will be generated for you. However, when using the xml-in-out mode with WSMessage object as the input and output parameter for the operation, its better to be able to serve a wsdl that is saved in the server since auto generated wsdl’s schema might not match the operation accepted xml.</p> <p>Getting this done is quite simple. all you need to do is to set the option “<u><strong>omitProcesswsdl</strong></u>” in <strong>WSService</strong> operations array to true.  </p> <table border="0" cellspacing="0" cellpadding="2" width="676"><tbody> <tr> <td valign="top" width="674"> <p>$opParams = array("testFunction"=>"WSMESSAGE"); </p> <p>$service = new WSService(array(  "wsdl"=>"mystaticwsdl.wsdl", <br />        "omitProcesswsdl"=>TRUE, <br />        "opParams"=>$opParams, <br />        "operations" => $operations, <br />        "actions"=>$actions );</p> </td> </tr> </tbody></table> <div>By specifying omitProcesswsdl, you can prevent WSF/PHP from trying to process the operation as a WSDL Mode operation. Also note that you would need to set your function as of type WSMESSAGE by using opParams. This is a work about which is not required for current svn trunk. </div> <div> </div> <div> <br /></div> nandikajayawardanahttp://www.blogger.com/profile/11920576746810295004noreply@blogger.com0tag:blogger.com,1999:blog-4315194664429455135.post-22815675136335582872010-07-05T02:12:00.001-07:002010-07-05T02:17:49.234-07:00WSO2 Web Services Framework for PHP 2.1.0 Released<p>We are pleased to announce the release of v2.1.0 of  wso2 wsf/php. This release comes after quite some time since the 2.0.0 release was back in late 2008. Since then a lot of changes have token place in the underlying code base of WSF/PHP. The WS-Security handling has been improved and updated and that functionality is now available with this release of WSF/PHP. In addition to that, this release is built and tested for PHP 5.3. Many users have been querying about a PHP 5.3 compatible release for a while and with this release, all the issues users had with installing and running on php 5.3 will be solved. </p> <p>You can download the release from <a href="http://wso2.org/downloads/wsf/php">http://wso2.org/downloads/wsf/php</a>.</p> <p>You can find the complete release note here.</p> <p><a href="https://svn.wso2.org/repos/wso2/branches/wsf/php/2.1.0/NEWS">https://svn.wso2.org/repos/wso2/branches/wsf/php/2.1.0/NEWS</a></p> <p>Enjoy WSO2 WSF/PHP 2.1.0.</p> nandikajayawardanahttp://www.blogger.com/profile/11920576746810295004noreply@blogger.com0tag:blogger.com,1999:blog-4315194664429455135.post-28294252378120766572010-05-21T11:09:00.001-07:002010-05-21T11:16:26.313-07:00Configure https with WS-Security<p>Using WS-Security Username Token alone with Transport level security, HTTPS, is quite common. By default, Username token is used with WS-Security Signature. Lets look at how to configure WS-Security Username Token with WSF/PHP.</p> <p>Since, by default, WSF/PHP tries to sign the username token credentials, you would need to specify client certificate and the private key for configuring Username Token.</p> <p>e.g</p> <blockquote> <p><strong>$security_options = array("useUsernameToken" => TRUE ); </strong></p> <p><strong>$policy = new WSPolicy(array("security" => $security_options)); </strong></p> <p><strong>$security_token = new WSSecurityToken(array("user" => "Raigama", <br />                                            "password" => "RaigamaPW", <br />                                            "passwordType" => "Digest", <br />                                            "privateKey" => $my_key, <br />                                              "certificate" => $my_cert));</strong></p> </blockquote> <p>I have copied a code snippet from the username token sample. As you can see, we are only configuring username token by using the option <strong>useUsernameToken</strong> in the policy configuration. However, for the WSSecurityToken configuration, I have passed both the “<strong>privateKey</strong>” option and “<strong>certificate</strong>” option. The private key refer to the client’s private key and certificate refer to client’s certificate which contains the public key of the client.  This is because, by default, UsernameToken uses signature to enhance security of username token. </p> <p>Often you would need to use https transport and plaintext username password instead of a signed username token.  You can easily enable this option by specifying a policy file and an empty <strong>transportBinding</strong> element within it as follows.</p> <blockquote> <p><em><strong><wsp:Policy xmlns:wsp="</strong></em><a href="http://schemas.xmlsoap.org/ws/2004/09/policy""><em><strong>http://schemas.xmlsoap.org/ws/2004/09/policy"</strong></em></a> <br /><em><strong>    xmlns:sp="</strong></em><a href="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702""><em><strong>http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702"</strong></em></a><em><strong>> <br />    <wsp:ExactlyOne> <br />        <wsp:All> <br />            <font color="#ff8000"><sp:TransportBinding> <br />                <wsp:Policy> <br />                </wsp:Policy> <br />            </sp:TransportBinding> <br /></font>            <sp:SignedSupportingTokens> <br />                <wsp:Policy> <br />                    <sp:UsernameToken <br />                        sp:IncludeToken="</strong></em><a href="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702/IncludeToken/AlwaysToRecipient""><em><strong>http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702/IncludeToken/AlwaysToRecipient"</strong></em></a><em><strong>> <br />                        <wsp:Policy> <br />                            <sp:WssUsernameToken10 /> <br />                        </wsp:Policy> <br />                    </sp:UsernameToken> <br />                </wsp:Policy> <br />            </sp:SignedSupportingTokens> <br />        </wsp:All> <br />    </wsp:ExactlyOne> <br /></wsp:Policy></strong></em></p> </blockquote> <p><strong><em>Now create the WSPolicy object by using the policy file.</em></strong></p> <p><strong><em>$policy = new WSPolicy($policy_string);</em></strong></p> <p>In the WSClient options change<strong> “to”</strong> endpoint from <strong>“http”</strong> to <strong>“https”</strong> and specify the <strong>“CACert”</strong> option.</p> nandikajayawardanahttp://www.blogger.com/profile/11920576746810295004noreply@blogger.com3tag:blogger.com,1999:blog-4315194664429455135.post-46544588299580671522010-05-21T10:45:00.001-07:002010-05-21T10:45:32.908-07:00How to configure https for Apache2.2 and consume PHP web services over https<p><strong>Step 1.</strong></p> <p>Create a Certificate Authority, <strong>CA</strong>.</p> <blockquote><strong>openssl genrsa -des3 -out ca.key 4096</strong> <br /><strong>openssl req -new -x509 -days 365 -key ca.key -out ca.crt</strong> </blockquote> <p><em>Now we have a certificate authority certificate to sign the certificate for the server.</em></p> <strong><em></em></strong> <p><strong>Step 2.</strong></p> <p>Generate a key for the server.</p> <blockquote> <p><strong><em>openssl genrsa -des3 -out server.key 4096</em></strong></p> </blockquote> <p>Generate a certificate signing request</p> <blockquote> <p><strong><em>openssl req -new -key server.key -out server.csr</em></strong></p> </blockquote> <p>Optional step : remove the passphrase from the key</p> <blockquote> <p>Rename server.key to server.key.bac.</p> <p><strong><em>openssl rsa -in server.key.bac -out server.key</em></strong></p> </blockquote> <p><strong>Step3. </strong></p> <blockquote> <p>Sign the generated key with certificate authority</p> <p><strong><em>openssl x509 -req -days 365 -in server.csr -CA ca.crt -CAkey ca.key -set_serial 01 -out server.crt</em></strong></p> </blockquote> <p>Now we have the necessary keys and certificates to configure Apache2.2 server to enable <strong>https</strong></p> <p><strong>Step4.</strong></p> <blockquote> <p>copy the generated keys, certificates to a directory named keys under the conf directory.</p> <p>Uncomment ssl module and ssl configuration file in httpd.conf.</p> <p><strong>LoadModule ssl_module modules/mod_ssl.so</strong></p> <p><strong>Include conf/extra/httpd-ssl.conf</strong></p> </blockquote> <p><strong>Step 5. </strong></p> <p>configure https in httpd-ssl.conf file located in conf/extra directory. Use the default settings and specify the following Files to match your local settings.</p> <blockquote> <p><strong>SLCertificateFile "F:/Apache2.2/conf/keys/server.crt"</strong></p> <p><strong>SSLCertificateKeyFile "F:/Apache2.2/conf/keys/server.key"</strong></p> <p><strong>SSLCACertificateFile "F:/Apache2.2/conf/keys/ca.crt"</strong></p> <p><strong>#SSLVerifyClient require</strong></p> <p><strong>SSLVerifyDepth 1</strong></p> </blockquote> <p>SSLVerifyClient and SSLVerifyDepth options would only be required, if you want the client to authenticate to the server using a certificate and a passphrase. </p> <p>Now you have successfully configured https for your server. </p> <p>When connecting to the server, you can obtain the servers certificate by using openssl. </p> <p><strong>openssl s_client –connect </strong><a href="http://localhost"><strong>localhost</strong></a><strong>:443 > scert.pem</strong></p> <p>Now open the scert.pem and remove the unnecessary. Only the content within the -----BEGIN CERTIFICATE----- and -----END CERTIFICATE----- needed for the certificate. You certificate would look like</p> <p><strong>-----BEGIN CERTIFICATE-----</strong></p> <p><strong></strong></p> <p><strong>-----END CRETIFICATE-----</strong></p> <p><strong>Step 6. </strong></p> <p>Now we can connect to a service deployed in Apache server using https and consume it.</p> <blockquote> <p>$client = new WSClient(array(“to”=>”https://localhost/webservices/service1.php”,</p> <p>                                                “CACert”=>”cert.pem”));</p> <p>$response = $client->request($input);</p> </blockquote> <p><strong>Much more detailed discussion on implementing https alone with Axis2/C is available <a href="http://wso2.org/library/articles/ssl-enabled-web-services-apache-axis2-c">here.</a></strong></p> nandikajayawardanahttp://www.blogger.com/profile/11920576746810295004noreply@blogger.com1tag:blogger.com,1999:blog-4315194664429455135.post-24089087286761912072010-02-25T08:18:00.000-08:002010-02-25T08:22:51.972-08:00BAM Tool for PHP<a href="http://wso2.org/projects/bam">Business Activity Monitoring (BAM)</a>, open source tool, can be used to monitor PHP Web services as well. <div><br /></div><div>You can use the generic mode of the tool and monitor Web services as well as all PHP deployments in general. </div><div><br /></div><div>Here is an article on <span class="Apple-style-span" style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 14px; font-weight: bold; line-height: 16px; "><a href="http://wso2.org/library/articles/business-activity-monitoring-introduction">Business Activity Monitoring - An Introduction</a> <span class="Apple-style-span" style="font-family: Georgia, serif; font-weight: normal; line-height: normal; font-size: 16px; ">to learn more about BAM</span></span></div>Samisahttp://www.blogger.com/profile/00210607048713861579noreply@blogger.com0tag:blogger.com,1999:blog-4315194664429455135.post-70012516728182555492009-10-12T11:18:00.001-07:002009-10-12T11:18:32.273-07:00SOA Workshop<p><a href="http://lh3.ggpht.com/_honSoB4kSVs/StNy8P9bbGI/AAAAAAAAAIo/lHWMqFTeRgM/s1600-h/us-soa-workshop-banner%5B5%5D.jpg"><img style="border-right-width: 0px; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" border="0" alt="us-soa-workshop-banner" src="http://lh5.ggpht.com/_honSoB4kSVs/StNy9psbxHI/AAAAAAAAAIs/HD1ZCCzdGQo/us-soa-workshop-banner_thumb%5B3%5D.jpg?imgmax=800" width="563" height="644" /></a> </p> <p>Here is an opportunity to get hands on experience on implementing SOA. </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p>You can find more details here. <a href="http://ww2.wso2.org/~nandika/soa-workshop.pdf">http://ww2.wso2.org/~nandika/soa-workshop.pdf</a>. and of course visit <a href="http://wso2.com">http://wso2.com</a> to register.</p> nandikajayawardanahttp://www.blogger.com/profile/11920576746810295004noreply@blogger.com0tag:blogger.com,1999:blog-4315194664429455135.post-3183714093003174262009-09-01T10:25:00.001-07:002009-09-01T10:25:55.946-07:00Common Issue with Certificates created on Windows<p>One of the common issues faced when dealing with certificates for doing SSL communication or WS-Security is that the certificates created on windows does not work on Linux. This is due to the addition of Windows Specific characters to the certificate. I have seen so many users struggle to get SSL/HTTPS working due to this problem. </p> <p>So easiest thing to do, if you want to run a client with HTTPS on Linux with a certificate created on windows, just do a dos2unix on the certificate.  :)</p> <p>This should help you save a lot of time. </p> nandikajayawardanahttp://www.blogger.com/profile/11920576746810295004noreply@blogger.com1tag:blogger.com,1999:blog-4315194664429455135.post-50533115350785574162009-09-01T10:04:00.001-07:002009-09-01T10:12:54.250-07:00Building WSF/PHP with PHP 5.3.0<p>Since the release of PHP5.3.0 number of requests were there inquiring the compatibility of WSF/PHP with PHP 5.3.0.  I tried it out on windows and I only encountered minor issues. These issues are now fixed on the svn trunk. Here is how you can build WSF/PHP from the svn source to use with PHP 5.3.0.</p> <p>First download both PHP 5.3.0 source and binary distributions from php.net. You will also need to download the binary tools such as bison.exe which are required to build the PHP source. </p> <p>Next you need to run the buildconf.bat contained with the php source in order to build the windows specific headers. </p> <p>Now you are ready to build wsf/php for php 5.3.0. </p> <p>Get the svn source of wsf/php from  <a title="https://wso2.org/repos/wso2/trunk/wsf/php" href="https://wso2.org/repos/wso2/trunk/wsf/php">https://wso2.org/repos/wso2/trunk/wsf/php</a>.</p> <p>svn co <a title="https://wso2.org/repos/wso2/trunk/wsf/php" href="http://wso2.org/repos/wso2/trunk/wsf/php">http://wso2.org/repos/wso2/trunk/wsf/php</a> wsfphp</p> <p>Now cd to wsfphp directory and open the configure.in file and set php configurations as follows.</p> <p>PHP_SRC_DIR = E:\php\php-5.3.0 <br />PHP_BIN_DIR = E:\php\php-5.3.0-Win32 <br />BINDLIB_DIR = E:\php\bindlib-cvs-vc8</p> <p>Of course you need to set the other dependencies according to your machine configurations. </p> <p>Now run the build.bat file. This will build wsf/php binary for php 5.3.0</p> nandikajayawardanahttp://www.blogger.com/profile/11920576746810295004noreply@blogger.com6tag:blogger.com,1999:blog-4315194664429455135.post-81519049422565399012009-08-22T10:35:00.000-07:002009-08-22T10:41:49.930-07:00Servey: Tools for PHP Web Services?This is a servery to find out, what PHP progremmers need the most when it comes to dealing with Web services. <div><br /></div><div>Please feel free to comment on this blog post. </div><div><br /></div><div>What is your wishlist when it comes to PHP Web servies? What tools are you looking for?</div><div><br /></div><div>How about something similar to PHP MyAdmin for PHP Web services? Point to the service, and just use it?</div><div><br /></div><div>What about hosting? Do you have trhoube consuming services from hosted PHP instances? </div><div><br /></div><div>What about IDE integration? Would you like it to be intergated with, say, Eclipse? </div><div><br /></div><div>Feel free to let us know. </div>Samisahttp://www.blogger.com/profile/00210607048713861579noreply@blogger.com4tag:blogger.com,1999:blog-4315194664429455135.post-50759557180258538002009-07-23T22:46:00.001-07:002009-07-23T22:46:37.836-07:00WSO2 WSF/CPP 2.0.0 Released<p>WSO2 WSF/CPP 1.0.0 was released sometime back with the intention of providing a C++ API for C++ developers while leveraging the capabilities of WSF/C Web Services Stack. It only had the Client API. With this new release,the product has been significantly enhanced with the addition of a Service API, Code Generation support for C++, and Many WS-Security features. WSF/C++ can be deployed on both Apache2, and IIS. Also it has the stand alone http server as well. You can download WSF/C++ from <a href="http://wso2.org/downloads/wsf/cpp">http://wso2.org/downloads/wsf/cpp</a>. </p> <p>Here is the complete release note.</p> <p> </p> <p>WSO2 Web Services Framework for C++ (WSO2 WSF/C++) 2.0.0 Released</p> <p>=================================================================</p> <p>WSO2 WSF/C++ team is pleased to announce the release of WSO2 WSF/C++ 2.0.0.</p> <p>You can download this release from: <a href="http://wso2.org/downloads/wsf/cpp">http://wso2.org/downloads/wsf/cpp</a></p> <p>WSO2 Web Services Framework for C++ (WSO2 WSF/C++) is a standards compliant, enterprise</p> <p>grade, open source, C++ library for providing and consuming Web services in C++, based on the popular,</p> <p>WSO2 WSF/C library.</p> <p>Project home page:</p> <p><a href="http://wso2.org/projects/wsf/cpp">http://wso2.org/projects/wsf/cpp</a></p> <p>-------------</p> <p>Key Features</p> <p>=============</p> <p>1. Client API to consume Web services</p> <p>      * ServiceClient class with one-way and two-way service invocation support</p> <p>        for SOAP 1.1, and SOAP 1.2.</p> <p>      * Options class to facilitate configuring the client for both SOAP and REST options.</p> <p>2. Service API to provide Web Services</p> <p>      * ServiceSkeleton class to extend from to implement services.</p> <p>2. Attachments with MTOM</p> <p>      * Binary optimized</p> <p>      * Non-optimized (Base64 binary)</p> <p>      * Attachment Caching Support</p> <p>3. WS-Addressing</p> <p>      * Version 1.0</p> <p>      * Submission</p> <p>4. WSPolicy </p> <p>5. WS-Security</p> <p>      * Username Token </p> <p>      * Timestamp Token </p> <p>      *  Signing</p> <p>      *  Encryption </p> <p>      * WS-SecurityPolicy based configuration  </p> <p>      * Reply detection</p> <p>      * WS-Trust</p> <p>      * WS-Secure Conversation   </p> <p>6. Code generation Tool</p> <p>      * By providing a wsdl and options, generate client stubs and service skeletons</p> <p>        in C++ using the code generation tool. </p> <p>7. SSL enabled transport layer</p> <p>8. WS-Reliable Messaging</p> <p>9. Has all the capabilities available from WSF/C library.</p> <p>--------------------------------</p> <p>Major Changes Since Last Release</p> <p>================================</p> <p>1. Service API which enable implementing services in C++.</p> <p>2. Code Generation tool for C++.</p> <p>3. Documentation Improved.</p> <p>4. WS-Security Additions including</p> <p>    * WS-Secure Conversation</p> <p>    * Replay Detection </p> <p>5. Many bug fixes.</p> <p>-------------------</p> <p>Known Issues</p> <p>-------------------</p> <p>Dual channel scenarios could cause crash issues.</p> <p>-------------------</p> <p>Reporting Problems</p> <p>===================</p> <p>Issues can be reported using the public JIRA available at:</p> <p><a href="https://wso2.org/jira/browse/WSFCPP">https://wso2.org/jira/browse/WSFCPP</a></p> <p>----------------------</p> <p>Contact Us</p> <p>===========</p> <p>Please subscribe to our user or developer mailing lists. For details on how</p> <p>to subscribe please visit: <a href="http://wso2.org/mail">http://wso2.org/mail</a></p> <p>We welcome your early feedback on this implementation.</p> <p>Thank you for your interest in WSO2 WSF/C++.</p> <p>-- WSO2 WSF/C++ Team --</p> nandikajayawardanahttp://www.blogger.com/profile/11920576746810295004noreply@blogger.com1tag:blogger.com,1999:blog-4315194664429455135.post-76973123467463529782009-03-15T05:33:00.001-07:002009-03-15T05:33:35.053-07:00Free Live Online Training<p>WOS2 is offering a live online training session for WSF/PHP free of charge this week. This is a one time offer. So hurry up and register now if you are willing to participate.</p> <p>To register , visit w<a href="http://www.wso2.com">ww.wso2.com</a></p> nandikajayawardanahttp://www.blogger.com/profile/11920576746810295004noreply@blogger.com3tag:blogger.com,1999:blog-4315194664429455135.post-38014475893793907572009-03-01T21:12:00.001-08:002009-03-01T21:12:08.340-08:00Dealing with Log files<p>WSF/PHP uses two log files to log down certain messages useful for tracing and debugging incase of an error. These logs are handled by the underlying WSF/C Framework. It supports a log rotation as well.</p> <p>Following are the log level supported by WSF/PHP.</p> <p>Log values are set to the wsf.log_level php.ini entry.</p> <p><strong>0 -> CRITICAL  ( Only critical errors will be logged ) <br />1 -> ERROR      ( Errors will be logged) <br />2 -> WARNING  ( Errors and Warnings will be logged) <br />3 -> INFO       ( Errors , Warnings and Information will be logged) <br />4 -> DEBUG   ( All log messages including debug messages will be logged)</strong></p> <p>When you have enabled log higher log levels, a large number of log messages are done to the log file which result in the log file growing rapidly with the number of messages processed. This would not be a problem if you are running your system for testing. But if you are running it on production this could cause some problems, because we noticed that these is a issue in the log rotation scheme for WSF/PHP 2.0.0. Due to this issue, a number of users have complained that apache stopped working as well. <font color="#ff0000">Therefore it is recommenced that you used the log level <strong>0</strong> on production systems. </font></p> nandikajayawardanahttp://www.blogger.com/profile/11920576746810295004noreply@blogger.com2tag:blogger.com,1999:blog-4315194664429455135.post-44477423184648012072009-02-13T08:42:00.000-08:002009-02-13T08:44:16.842-08:00Case Study - PHP Data Services To Extract Content from Drupal DatabaseIn this case study "<a href="http://wso2.org/library/case-studies/case-study-php-data-services-extract-drupal-database"> PHP Data Services Extract Content from Drupal Database</a>", I intended to present how Data Service concepts can be applied to extract data with marketing value from a CMS database and publish it as web services. I used the drupal instance deployed at <a href="http://wso2.org/">http://wso2.org</a> as the CMS for the use case. And as the data service framework, I used <a href="http://wso2.org/projects/wsf/php">WSF/PHP</a> data services library, as it requires minimum changes to the existing infrastructure (the LAMP stack).Dimuthuhttp://www.blogger.com/profile/14112312266389635163noreply@blogger.com3tag:blogger.com,1999:blog-4315194664429455135.post-54616871391391722492009-01-05T05:07:00.000-08:002009-01-05T05:10:18.312-08:00Article Introducing PHP Data ServicesNow you can view the article "<a href="http://wso2.org/library/articles/introduction-php-data-services" mce_href="http://wso2.org/library/articles/introduction-php-data-services">Introduction to PHP Data Services</a>" from <a href="http://wso2.org">Oxygen Tank</a> library.<br /><p>If you are thinking of adapting SOA in to your database backed PHP applications, this article will be a good starting point.</p>Dimuthuhttp://www.blogger.com/profile/14112312266389635163noreply@blogger.com3tag:blogger.com,1999:blog-4315194664429455135.post-14414115838740723872008-12-27T02:55:00.000-08:002008-12-27T02:58:37.612-08:00PHP Web Services - Authentication Based on Client’s IPThis blog post <a href="http://www.dimuthu.org/blog/2008/12/27/php-web-services-authentication-based-on-clients-ip/" title="Permanent Link to PHP Web Services - Authentication Based on Client’s IP">PHP Web Services - Authentication Based on Client’s IP</a> explains with code samples how a PHP web service can be written to authenticate clients based on their IPs.Dimuthuhttp://www.blogger.com/profile/14112312266389635163noreply@blogger.com3tag:blogger.com,1999:blog-4315194664429455135.post-27464452296227984232008-12-20T22:29:00.001-08:002008-12-20T22:30:15.439-08:00REST Vs SOAP<p>Both REST ( Representational states transfer) and SOAP is widely adopted techniques for building distributed systems. REST is an architectural style for implementing systems on top of HTTP infrastructure.  A large number of Specifications has been developed on top of SOAP and there are large number of SOAP stacks both open source and proprietary out there implementing large part of this WS* stack. </p> <p>Both these d techniques have their advantages and drawbacks. Here are few of the advantages and disadvantages of each paradigm.</p> <p><strong>REST</strong></p> <p><strong>Advantages </strong></p> <blockquote> <p>1. Based on few simple principles which are already in wide adoption on the Web itself</p> <p>2. Can be implemented very quickly.</p> <p>3. Ideal for providing simple API's to the users. (Eq Whether Services, Flicker, Yahoo REST services )</p> <p>4. Amount of learning required to get started is minimum in comparison to SOAP</p> <p>5. Has a very large following amount the scripting community</p> </blockquote> <p><strong>Disadvantages</strong></p> <blockquote> <p>1. If the system is a very large one, then designing based on REST could become a very complex task. </p> </blockquote> <blockquote> <p>2. Implementing Security on a REST system is one major issues. Although HTTPS, and HTTP Authentication can be used,  they only provide transport level security.</p> </blockquote> <p><strong>SOAP</strong></p> <p><strong>Advantages</strong> </p> <blockquote> <p>1. Well designed mature technology</p> <p>2. Has been widely adopted in industry</p> <p>3. Large number of SOAP stacks available to choose from.</p> <p>4. Has support for Both Transport level and message level security which is a big advantage over REST.</p> <p>5. Supports multiple protocol bindings ( Not just HTTP)</p> <p>6. Ideal for implementing complex enterprise  systems since the SOAP Stacks cater for security, reliability, transactions ect.</p> </blockquote> <p><strong>Disadvantages</strong></p> <blockquote> <p>1. Complex in comparison to REST</p> <p>2. Big learning curve required</p> <p>3. Difficult to debug a complex system</p> </blockquote> <p>One great thing about using WSF/PHP is that it can support Both of these techniques simultaneously. However, if you are building a complex system which require  security, I would always recommend the use of SOAP.</p> nandikajayawardanahttp://www.blogger.com/profile/11920576746810295004noreply@blogger.com2tag:blogger.com,1999:blog-4315194664429455135.post-80571918429435481952008-12-18T09:53:00.000-08:002008-12-18T09:55:27.550-08:00Data Services Best PracticesIs that data services are for converting database tables to web service operations?. Is that the right way to adapt SOA?. This post titled '<a href="http://www.dimuthu.org/blog/2008/12/18/data-services-best-practices/">Data Services Best Practices</a>' explains how you should develop data services without violating SOA principlesDimuthuhttp://www.blogger.com/profile/14112312266389635163noreply@blogger.com1tag:blogger.com,1999:blog-4315194664429455135.post-72805679194731100432008-12-14T10:05:00.000-08:002008-12-14T10:08:24.412-08:00Sending Encrypted Binary Messages With PHP Web ServicesWeb services has made the communication between heterogeneous environments (say PHP with .NET or Java) a reality. It has defines standards for communicate not only with texts but also with binaries. And more importantly you can keep these communication confidential using encrypted messages according to your requirement. In the post "<a href="http://www.dimuthu.org/blog/2008/12/14/sending-encrypted-binary-messages-with-php-web-services/">Sending Encrypted Binary Messages With PHP Web Services</a>" , we will look at how we can implement such a system with PHP in one side.Dimuthuhttp://www.blogger.com/profile/14112312266389635163noreply@blogger.com1tag:blogger.com,1999:blog-4315194664429455135.post-46850941077762109462008-12-07T05:06:00.000-08:002008-12-07T05:11:52.540-08:00PHP Data Services with PostgreSQLIf you are using postgreSQL as your backend database and you are wondering how to write a web service exposing data on there, this post will be a good guide for you, <a href="http://www.dimuthu.org/blog/2008/12/07/php-data-services-with-postgresql/">PHP Data Services with PostgreSQL</a>.Dimuthuhttp://www.blogger.com/profile/14112312266389635163noreply@blogger.com0tag:blogger.com,1999:blog-4315194664429455135.post-29099312949458545602008-12-04T08:20:00.001-08:002008-12-04T08:26:43.101-08:00Using command line to debug your Web Service<p>You can actually run your PHP Web Service on the command line. One may wonder what the use of doing that ?</p> <p>The main use case is that, you can test your service, without having to write a client. It is specially useful, if your are following the code first approach.  You can find the code for actually doing this in one of the WSF/PHP samples. It is in fact the simplest sample of all. The echo_service.php.</p> <p>Lets have a look at how this becomes possible.</p> <p> <strong>WSService->reply()</strong> function takes an optional string argument .  </p> <p>1. You can pass the actual XML string expected from the client to the reply function. Then, the service can be executed on the command line to see the actual executed output from an operation.</p> <blockquote> <p>However, this would work only in cases where you using SOAP Body dispatching or WS-Addressing.</p> <p>In SOAP Body dispatching case, the XML qualified name of the child element of soap body is used to identify the operation which should be invoked.</p> <p>In case of WS-Addressing, the addressing action header is used. </p> </blockquote> <p>2. Lets look at a code sample on implementing this.  This is the echo_service.php sample that comes with WSF/PHP</p> <blockquote> <p><?php</p> <p><strong>$requestPayloadString</strong> = <font color="#ff0000"><<<XML <br /><soapenv:Envelope xmlns:soapenv="</font><a href="http://www.w3.org/2003/05/soap-envelope" ?="?"><font color="#ff0000">http://www.w3.org/2003/05/soap-envelope"</font></a><font color="#ff0000">> <br />   <soapenv:Header/> <br />   <soapenv:Body> <br />     <ns1:echoString xmlns:ns1="</font><a href="http://wso2.org/wsfphp/samples" ?="?"><font color="#ff0000">http://wso2.org/wsfphp/samples"</font></a><font color="#ff0000">> <br />         <text>Hello World!</text> <br />     </ns1:echoString> <br />    </soapenv:Body> <br /></soapenv:Envelope> <br />XML; </font></p> <p>function echoFunction($inMessage) { </p> <p>    $outMessage = new WSMessage($inMessage->str); </p> <p>    return $outMessage; <br />} </p> <p>$operations = array("echoString" => "echoFunction"); </p> <p>$service = new WSService(array("operations" => $operations)); <br /><strong>$service->reply($requestPayloadString); </strong></p> <p>?></p> <p>I have highlighted the important code segments. Note how the Expected soap envelope string is passed to the reply() function as an argument.</p> </blockquote> <p>3. Now you can execute this service on the command line and get the result.</p> <blockquote> <p>php echo_service.php</p> <p>Now you should see the expected output soap envelope after invoking the echoString operation.</p> </blockquote> <p>4. You can also generate the WSDL for the service on the command line as well. Simply set the reply function argument string to "wsdl" or "wsdl2".</p> <blockquote> <p><strong>$service->reply("wsdl"); </strong></p> </blockquote> <p><strong>5. </strong>Now you can re execute the service and get the wsdl for the service on the command line.</p> <blockquote> <p>php echo_service.php</p> </blockquote> <p>This is a very useful feature for debugging your hand coded services  :).</p> nandikajayawardanahttp://www.blogger.com/profile/11920576746810295004noreply@blogger.com1tag:blogger.com,1999:blog-4315194664429455135.post-89309298885884358822008-11-27T09:51:00.000-08:002008-11-27T09:53:05.010-08:00Steps to Convert a SQL Query to a Data ServiceWith WSF/PHP Data Service library, you can convert a SQL query to a Data Service very easily in few steps. Here are the steps, described in "<a href="http://www.dimuthu.org/blog/2008/11/27/steps-to-convert-sql-query-to-a-data-service/">Steps to Convert a SQL Query to a Data Service</a>"Dimuthuhttp://www.blogger.com/profile/14112312266389635163noreply@blogger.com0tag:blogger.com,1999:blog-4315194664429455135.post-38185135693499724622008-11-26T10:00:00.000-08:002008-11-26T10:02:42.481-08:005 Facts About WS-Addressing Action in WSF/PHPWS-Addressing Action is used by web services to dispatch the operation for an incoming request SOAP message. This blog "<a href="http://www.dimuthu.org/blog/2008/11/26/5-facts-about-ws-addressing-action-in-wsfphp/">5 Facts About WS-Addressing Action</a>" present you some facts about WSF/PHP API for WS-Addressing.Dimuthuhttp://www.blogger.com/profile/14112312266389635163noreply@blogger.com0tag:blogger.com,1999:blog-4315194664429455135.post-18859904493307260902008-11-25T07:32:00.000-08:002008-11-25T07:38:25.587-08:00The Use of SOAP Action with WSF/PHPThe SOAP action is mainly used for dispatching of web service operations. This post about "<a href="http://www.dimuthu.org/blog/2008/11/25/the-use-of-soap-action-with-wsfphp/">The Use of SOAP Action with WSF/PHP</a>" talks about how SOAP action is presented in a message and how it can be used to write web services and consumers with WSF/PHP.Dimuthuhttp://www.blogger.com/profile/14112312266389635163noreply@blogger.com1