WSFault Object encapsulates the information related to SOAP Fault and stores them as properties of the WSFault object.
WSFault object has the following properties.
Reason, Code, Detail and Role. In addition it has a property "str" which contains the entire Fault xml as a string.
So Obtaining the Fault and Getting Information from it is very simple.
All what is required it to catch the exception object, check whether it is actually a WSFault object, and read the fault properties.
For example, to obtain the Soap Fault Reason , one can use the following code sample.
try{
// Some WSClient related code goes here.
}catch (Exception $e) {
if ($e instanceof WSFault) {
printf("Soap Fault: %s\n", $e->Reason);
} else {
printf("Message = %s\n",$e->getMessage());
}
}
Read documentation from full detail.
Showing posts with label Virus. Show all posts
Showing posts with label Virus. Show all posts
Thursday, January 31, 2008
Wednesday, January 30, 2008
Implementing a Service using a PHP Class
WSF/PHP supports implementing a service using a php class. One of the advantages of implementing the service Operations with in a class is that is gives the ability to pass arguments to the constructor of the class.
Following is a simple example.
class Bar{
private $value = "";
function __construct($str){
$this->value = $str;
}
function echoValue($inMessage){
$responsePayloadString = <<<XML
<ns1:echostring ns1="<a href=">http://wso2.org/projects/wsf/php</a>">
<value>$this->value</value> </ns1:echoString>
XML;
return new WSMessage($responsePayloadString);
}
}
$operations = array("echoString" => "echoValue");
$service = new WSService(
array( "classes" => array("Bar" =>
array("operations" =>$operations,
"args" => array("Hello")
)
)));
$service->reply();
Note that Bar class is just a very simple PHP class. It's constructor takes a string argument and echo that value.
Next you have to define the Operations array with is very simple.
Next you need to tell the WSService class about your class, its defined operations and its arguements.
WSService options array accepts a parameter named "classes" which is an associative array. Its key is the class name and value is another array with contains the "operations" options and "args" options. "operations" are the operations defined in the class. The "args" is an array of arguments to the constructor of the corresponding class. Since the "Bar" class has a single argument constuctor, we are providing an string.
Following is a simple example.
class Bar{
private $value = "";
function __construct($str){
$this->value = $str;
}
function echoValue($inMessage){
$responsePayloadString = <<<XML
<ns1:echostring ns1="<a href=">http://wso2.org/projects/wsf/php</a>">
<value>$this->value</value> </ns1:echoString>
XML;
return new WSMessage($responsePayloadString);
}
}
$operations = array("echoString" => "echoValue");
$service = new WSService(
array( "classes" => array("Bar" =>
array("operations" =>$operations,
"args" => array("Hello")
)
)));
$service->reply();
Note that Bar class is just a very simple PHP class. It's constructor takes a string argument and echo that value.
Next you have to define the Operations array with is very simple.
Next you need to tell the WSService class about your class, its defined operations and its arguements.
WSService options array accepts a parameter named "classes" which is an associative array. Its key is the class name and value is another array with contains the "operations" options and "args" options. "operations" are the operations defined in the class. The "args" is an array of arguments to the constructor of the corresponding class. Since the "Bar" class has a single argument constuctor, we are providing an string.
Monday, January 21, 2008
Manually Removing Viruses ( Part 1)
Last month, I had my machine infected with a couple of viruses and had to delete them manually. In the process I learned quite a lot of stuff about viruses. In addition I came accross some very usefull set of tools.
1. How do you know whether you system is infected by a virus. Following are the most common set of symtoms of virus infected machine.
1. Disables Task Manager.
2. Disables Command prompt
3. Diables Registry editor
4. Computer Slows down
5. Folder options menu removed
6. Show Hidden files option disabled.
7. My Computer drive now open by double click.
8. Automatic shutdown
Most of the viruses put an autorun entry when they infect a machine so that, when the system boots up next time, the virus is automatically executed. So even if we find and delete the virus from one location, next moment , the virus will be back there because the virus process is running. Therefore you will need a tool that enables you to see the running processes and autorun entries.
Process Expolrer and Autoruns are two such very usefull tools.
Since most of the viruses will have the hidden attribute set, and they disables the show hidden files option, you will need a tool that enables you to see the hidden files. One such tool is WINRAR.
Before going to to detail on how get rid of viruses, It is important to know how to stay out of viruses.
The most common way of virus spreading nowadays is through usb pen drives. When you have the autorun feature enabled ( this is the default ), the moment you plug in an
infected pen drive, your machine will also get the virus.
So the first step in preventing viruses is to disable the autorun.
You can find how to disable autorun from here.
1. How do you know whether you system is infected by a virus. Following are the most common set of symtoms of virus infected machine.
1. Disables Task Manager.
2. Disables Command prompt
3. Diables Registry editor
4. Computer Slows down
5. Folder options menu removed
6. Show Hidden files option disabled.
7. My Computer drive now open by double click.
8. Automatic shutdown
Most of the viruses put an autorun entry when they infect a machine so that, when the system boots up next time, the virus is automatically executed. So even if we find and delete the virus from one location, next moment , the virus will be back there because the virus process is running. Therefore you will need a tool that enables you to see the running processes and autorun entries.
Process Expolrer and Autoruns are two such very usefull tools.
Since most of the viruses will have the hidden attribute set, and they disables the show hidden files option, you will need a tool that enables you to see the hidden files. One such tool is WINRAR.
Before going to to detail on how get rid of viruses, It is important to know how to stay out of viruses.
The most common way of virus spreading nowadays is through usb pen drives. When you have the autorun feature enabled ( this is the default ), the moment you plug in an
infected pen drive, your machine will also get the virus.
So the first step in preventing viruses is to disable the autorun.
You can find how to disable autorun from here.
Subscribe to:
Posts (Atom)