Published on WSO2 Oxygen Tank (http://wso2.org)

problem WSSecurity using WSDL API generation

By faborm
Created 2008-05-26 06:02

Hi,

 

I did a test using WSSecurity and WSDL API generation but I have a problem when the client consume the WebService.

I call a function of the service in the client but I not get return of the function.

Somebody help me?

---------------------------------------------

source service

**

 * @return string $s

 * (xs:string)

 */

function test() {

    return array("s" => "AAAA");

}



$security_options = array("useUsernameToken" => TRUE);

$policy = new WSPolicy(array("security" => $security_options));

$security_token = new WSSecurityToken(array("user" => "Raigama",

                                            "password" => "RaigamaPW",

                                            "passwordType" => "Digest"));





$operations = array("test"=>"test");

$opParams = array("test"=>"MIXED");

// Create service with options

$service = new WSService(array("operations"=>$operations,

                               "opParams"=>$opParams,

                               "policy" => $policy,

                               "securityToken" => $security_token));



// Reply to requests

$service->reply();

-------------------------------------------

-------------------------------------------

source client

 

class testRequestWrapper

{

   

}



class testResponseWrapper

{

    public $s;

}



$class_map = array("test" => "testRequestWrapper",

                   "testResponse" => "testResponseWrapper");



try {



    // Set up security options

    $security_options = array("useUsernameToken" => TRUE );

    $policy = new WSPolicy(array("security" => $security_options));

    $security_token = new WSSecurityToken(array("user" => "Raigama",

                                                "password" => "RaigamaPW",

                                                "passwordType" => "Digest"));

   

    // Create client with options

    $client = new WSClient(array("wsdl" => "http://localhost/~fabio/wso2service/service.php?wsdl",

                                 "classmap" => $class_map,

                                 "useWSA" => TRUE,

                                 "policy" => $policy,

                                 "securityToken" => $security_token));

       

    // Send request and capture response

    $proxy = $client->getProxy();

   

    $input = new testRequestWrapper();



    $val = $proxy->test($input);



    print "<pre>";

    print_r ($val);

    print "</pre>";

} catch (Exception $e) {



        if ($e instanceof WSFault) {

                printf("Soap Fault: %s\n", $e->Reason);

        } else {

                printf("Message = %s\n",$e->getMessage());

        }

}

-------------------------------------------

Other question is how I enable encryption in comunication between service and client.

which the standard used for authentication between client and server?

which the standard used in the communication using encryption?


Source URL:
http://wso2.org/forum/thread/3637