User login

problem WSSecurity using WSDL API generation

Forums :

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?

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Hi faborm,

Hi faborm,

as far as i know, you have to use WSA when you want to use security-tokens. (Source: wso2.org/forum/thread/3555#comment-5728)

I'm sorry, but i don't know, how you can use WSA with the proxy-object of the client.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.