Simplified Object Access Protocol (SOAP) is a specification that enables applications to communicate with other applications. It provides a framework for connecting Web sites and applications to create Web services. These Web services link different sites and applications together to perform functions that the individual components or sites are not capable of. SOAP provides a mechanism by which each service can expose its features and communicate with other services. Using SOAP, one can link services offered by different systems together as components and use these components to build a complex information system application in a much shorter timeframe.
High-Level diagram of SOAP in a distributed system
Advantages of SOAP
1. SOAP is an open standard that is built upon open technologies such as XML and HTTP. It is not vendor-specific and therefore less intimidating to smaller players in the industry. As a result it is being accepted uniformly by the industry, thus improving its chances of being the de-facto standard for true distributed interoperability.
2. SOAP based distributed systems are loosely-coupled. As a result they are easier to maintain because they can be modified independently of other systems.
3. When used over HTTP protocol, SOAP packets can easily bypass firewalls if their content is not deemed malicious.
Disadvantages of SOAP
1. SOAP’s relied on HTTP for transport of XML data in the version 1.0 of its specification. HTTP requires a stateless request/response architecture that is not appropriate under all circumstances. While one can work around the state problem it requires additional coding.
2. All SOAP data is serialized and passed by value and currently there is no provision for passing data by reference. This could lead to synchronization problems if multiple copies of the same object are being passed at the same time.
SOAP Architecture
Wednesday, April 28, 2010
Introduction of SOAP Architecture
Tuesday, April 27, 2010
Configure Virual host in Apache
Virtual hosting is a method for hosting multiple domain names on a computer using a single IP address. This allows one machine to share its resources, such as memory and processor cycles, to use its resources more efficiently.
One widely used application is shared web hosting. Shared web hosting prices are lower than a dedicated web server, because this allows many customers to be hosted on a single server.
Setting Up A Virtual Host in Apache
Setting up a virtual host in the Apache web server is not exactly a PHP topic, but many PHP developers use the Apache web server to test web pages on their development machine.
There is a lot of information around on how to do this, but the first time I tried it, I found the existing information to be more confusing than helpful. Hopefully, this page will simplify the process a bit. Please note that this information pertains to setting up a virtual host in Apache on a Windows machine for use as a local testing server.
Configuring Apache
The first file we'll need to edit is the Apache httpd.conf file. If you installed the Apache software using the download from the Apache web site, you should have a menu item that will open this file for editing. Click Start->Programs->Apache HTTP Server->Configure Apache Server->Edit the Apache httpd.conf Configuration File. If you don't have that start menu item, start your text editor and open the file. It will be in a sub-folder named conf of your Apache folder. For example, mine is here:
C:\Program Files\Apache Group\Apache\conf\httpd.conf
Notes for Apache Server Versions Since 2.2 Configuration
Note that Apache changed the preferred method for configuring the Apache server with the release of Apache 2.2. For versions beginning with 2.2, the peferred configuration is more modular. Setting up a virtual host as described here will still work with the newer versions, but to follow the modular approach, the editing of httpd.conf is only to uncomment (remove the # from the beginning of the following line:
#Include conf/extra/httpd-vhosts.conf
Everything else is entered in the file httpd-vhosts.conf, which will be located in the extra folder below the below the folder containing httpd.conf. As mentioned, the method described here will still work.
Security
Version 2.2 also changed some of the default security configuration parameters. To set things up the way you'll need them, you'll need to add the following block to either your httpd.conf file, just above the virtual hosts, or to your httpd-vhosts.conf file:
<Directory "C:\ My Sites ">
Order Deny,Allow
Allow from all
</Directory>
Simple Steps are:
1. Open the vhosts file in the apache folder and create a virtual path and the name which will be map the related folder and the server name for example
<VirtualHost 127.0.0.1>
DocumentRoot "C:\My Sites\Site1"
ServerName original
</VirtualHost>
<VirtualHost 127.0.0.1>
DocumentRoot "C:\My Sites\Site2"
ServerName testing
</VirtualHost>
2. Open 'hosts' file which is present in path "C:\WINNT\system32\drivers\etc\hosts"
add the server name to them. This will tell the apache that both the server
names should be responded For example
127.0.0.1 original
127.0.0.1 testing
Restart the apache server and your done
Tuesday, April 20, 2010
PHP OOPS - Polymorphism
What is Polymorphism?
Polymorphism in PHP5 is a technique where the function to be called is detected based on the class object calling it at runtime. The basis of Polymorphism is Inheritance and function overridden.
Example – Basic Polymorphism
class BaseClass
{
public function myMethod()
{
echo "BaseClass method called";
}
}
class DerivedClass extends BaseClass
{
public function myMethod()
{
echo "DerivedClass method called";
}
}
function processClass(BaseClass $c)
{
$c->myMethod();
}
$c = new DerivedClass();
processClass($c);
Output:
DerivedClass method called
Here i am declaring BaseClass and DerivedClass but i am calling the the processClass with the Derived Class Object.
Monday, April 19, 2010
Jooma Events
The events triggered in Joomla! are:
These are the related methods trigged when a particular event occurs
Authentication
* onAuthenticate
Content
* onPrepareContent
* onAfterDisplayTitle
* onBeforeDisplayContent
* onBeforeContentSave (new in 1.5.4)
* onAfterContentSave (new in 1.5.4)
Editors
* onInit
* onGetContent
* onSetContent
* onSave
* onDisplay
* onGetInsertMethod
Editors XTD (Extended)
* onDisplay
Seach
* onSearch
* onSearchAreas
System
* onAfterInitialise
* onAfterRoute
* onAfterDispatch
* onAfterRender
User
* onLoginUser
* onLoginFailure
* onLogoutUser
* onLogoutFailure
* onBeforeStoreUser
* onAfterStoreUser
* onBeforeDeleteUser
* onAfterDeleteUser
XML-RPC
* onGetWebServices
What is DTD? Types of DTD?
The doctype declaration should be the very first thing in an HTML document, before the html tag.
The doctype declaration is not an HTML tag; it is an instruction to the web browser about what version of the markup language the page is written in.
The doctype declaration refers to a Document Type Definition (DTD). The DTD specifies the rules for the markup language, so that the browsers can render the content correctly.
Doctypes Available in the W3C Recommendations
HTML 4.01 Strict
This DTD contains all HTML elements and attributes, but does NOT INCLUDE presentational or deprecated elements (like font). Framesets are not allowed.
HTML 4.01 Transitional
This DTD contains all HTML elements and attributes, INCLUDING presentational and deprecated elements (like font). Framesets are not allowed.
HTML 4.01 Frameset
This DTD is equal to HTML 4.01 Transitional, but allows the use of frameset content.
XHTML 1.0 Strict
This DTD contains all HTML elements and attributes, but does NOT INCLUDE presentational or deprecated elements (like font). Framesets are not allowed. The markup must also be written as well-formed XML.
XHTML 1.0 Transitional
This DTD contains all HTML elements and attributes, INCLUDING presentational and deprecated elements (like font). Framesets are not allowed. The markup must also be written as well-formed XML.
XHTML 1.0 Frameset
This DTD is equal to XHTML 1.0 Transitional, but allows the use of frameset content.
Saturday, April 17, 2010
What is Http? Types of Headers in HTTP
The Hypertext Transfer Protocol (HTTP) is an Application Layer protocol for distributed, collaborative, hypermedia information systems.
HTTP is a request-response standard typical of client-server computing. In HTTP, web browsers or spiders typically act as clients, while an application running on the computer hosting the web site acts as a server. The client, which submits HTTP requests, is also referred to as the user agent. The responding server, which stores or creates resources such as HTML files and images, may be called the origin server. In between the user agent and origin server may be several intermediaries, such as proxies, gateways, and tunnels.
HTTP is not constrained in principle to using TCP/IP, although this is its most popular implementation platform. Indeed HTTP can be "implemented on top of any other protocol on the Internet, or on other networks." HTTP only presumes a reliable transport; any protocol that provides such guarantees can be used.
Resources to be accessed by HTTP are identified using Uniform Resource Identifiers (URIs)—or, more specifically, Uniform Resource Locators (URLs)—using the http or https URI schemes.
Requests Headers:
These are the following request headers:
Accept Content-Types that are acceptable
Accept-Charset Character sets that are acceptable
Accept-Encoding Acceptable encodings
Accept-Language Acceptable languages for response
Cache-Control Used to specify directives that MUST be obeyed by all caching
mechanisms along the request/response chain
Content-Type The mime type of the body of the request (used with POST and PUT
requests)
Host The domain name of the server (for virtual hosting), mandatory since
HTTP/1.1
Pragma Implementation-specific headers that may have various effects
anywhere along the request-response chain.
Responses
These are the response headers
Accept Content-Types that are acceptable
Accept-Charset Character sets that are acceptable
Accept-Encoding Acceptable encodings
Accept-Language Acceptable languages for response
Cache-Control Used to specify directives that MUST be obeyed by all caching
mechanisms along the request/response chain
Content-Type The mime type of the body of the request (used with POST and PUT
requests)
Host The domain name of the server (for virtual hosting), mandatory since
HTTP/1.1
Pragma Implementation-specific headers that may have various effects
anywhere along the request-response chain.
WWW-Authenticate Indicates the authentication scheme that should be used to access
the requested entity.
Set-Cookie an HTTP cookie
Send Mail using SMTP Authentication
Sending Mail from PHP Using SMTP Authentication - Example
require_once "Mail.php";
$from = "Sandra Sender
$to = "Ramona Recipient
$subject = "Hi!";
$body = "Hi,\n\nHow are you?";
$host = "mail.example.com";
$username = "smtp_username";
$password = "smtp_password";
$headers = array ('From' => $from,
'To' => $to,
'Subject' => $subject);
$smtp = Mail::factory('smtp',
array ('host' => $host,
'auth' => true,
'username' => $username,
'password' => $password));
$mail = $smtp->send($to, $headers, $body);
if (PEAR::isError($mail)) {
echo("
" . $mail->getMessage() . "
");
} else {
echo("Message successfully sent!
");
}
?>
Sending Mail from PHP Using SMTP Authentication and SSL Encryption - Example
require_once "Mail.php";
$from = "Sandra Sender
$to = "Ramona Recipient
$subject = "Hi!";
$body = "Hi,\n\nHow are you?";
$host = "ssl://mail.example.com";
$port = "465";
$username = "smtp_username";
$password = "smtp_password";
$headers = array ('From' => $from,
'To' => $to,
'Subject' => $subject);
$smtp = Mail::factory('smtp',
array ('host' => $host,
'port' => $port,
'auth' => true,
'username' => $username,
'password' => $password));
$mail = $smtp->send($to, $headers, $body);
if (PEAR::isError($mail)) {
echo("" . $mail->getMessage() . "
");
} else {
echo("Message successfully sent!
");
}
?>