Question on wrapping web services in Flex 4


hi all,

 

a brief intro:

 

- have several java based web services (jax-ws/soap) i've written on server side.
- services secured via wssecurity.
- i'm writing flex app consume above services.

 

in flex 3, i've had manually tackle wrapping of these services on client because of limited/unpredictable access underlying flex base classes , members.  needed able manage soap headers of web service calls insert appropriate wss header info prior service calls, there handful of other issues flex 3 implementation made use of default generated mappings unuseable (or @ least not worth time).

 

i hoping flex 4 did better job this, looks there still problems using generated wrapper code...  got wondering if not doing things proper flex way.  i've done lot of reading on web, maybe here can offer advice.

 

here's example of i'm doing:

 

i'm importing wsdl services in flash builder 4 (data | connect web service...).  here's example snippet of flex 4 generated class 1 of services:

 

internal class _super_sessionmanagerservice extends com.adobe.fiber.services.wrapper.webservicewrapper
{
    // constructor
    public function _super_sessionmanagerservice()
    {
        // initialize service control
        _servicecontrol = new mx.rpc.soap.mxml.webservice();
        var operations:object = new object();
        var operation:mx.rpc.soap.mxml.operation;
       
        operation = new mx.rpc.soap.mxml.operation(null, "logout");
        operations["logout"] = operation;
  
        _servicecontrol.operations = operations;
        try
        {
            _servicecontrol.convertresulthandler = com.adobe.serializers.utility.typeutility.convertresulthandler;
        }
        catch (e: error)
        { /* flex 3.4 , eralier not support convertresulthandler functionality. */ }

 

        _servicecontrol.service = "sessionmanagerservice";
        _servicecontrol.port = "sessionmanagerport";
        wsdl = "https://localhost:8181/app/service/sessionmanagerservice?wsdl";
        model_internal::loadwsdlifnecessary();
   
        model_internal::initialize();
    }

 

    public function logout(id:string) : mx.rpc.asynctoken
    {
        model_internal::loadwsdlifnecessary();
        var _internal_operation:mx.rpc.abstractoperation = _servicecontrol.getoperation("logout");
        var _internal_token:mx.rpc.asynctoken = _internal_operation.send(id) ;

 

        return _internal_token;
    }

 

... et. al.
}

 


so vantagepoint, there still familiar problems this:

 

1) url hard coded in constructor of generated base class service , there no way alter value before class constructed (at point attempts load wsdl , initialize service).  know can edit value in generated class, , team need remember of services each time they're regenerated (which since ongoing , growing project.)  problem since developing , deploying in several different environments several different server url's.  seems me never want hard code url anyway since ties binaries specific server (or virtual or url or etc.) - don't see why decision made since causes more problems solves (i.e. why not pass value parameter ctor?)

 

2) if attempt copy/paste constructor derived class better manage 1 above, member variables out of scope since they're declared private in webservicewrapper base class.  so, no solution there.

 

3) when attempt @ webservicewrapper base class try , gain little insight how might come work-around, flex 4 telling me can't find source code (and can't seem find source class anywhere...)  so, no hope solution.

 

4) finally, in logout method in above class, there still no way me intercede in web service call insert wss headers prior call being made server.  'model_internal' not acessible outside generated class, overriding method seems pointless.  i've looked around , there doesn't seem flex alternative handling web service security headers, looks still need manually provide @ least additional functionality, generated code doesn't account wanting set/update soap headers.

 


again, know can start hacking class special might need, hoping leave generated stuff untouched since reimplementing tweaks/fixes each time need regenenerate service wrapper.

 

am missing something?  there way wrap web services in flex app without having write bunch of roll-your-own wrappers?

 

thanks,
ken

hello,

 

1) please file enhancement request in https://bugs.adobe.com/flex/ on how want pass wsdl url service. parameter service constructor?. 'wsdl' variable of webservicewrapper can overridden in subclass ( sessionmanagerservice) in case new url loaded again.

 

2) member variables _servicecontrol (actual webservice instance) , wsdl accessible in subclass sessionmanagerservice. use _servicecontrol override endpointuri or port.

 

3) wrapper classes part of fiber.swc, not part of opensource sdk.

 

4) override (copy paste , modify) logout method in subclass generated (sessionmanagerservice). import model_internal namespace com.adobe.fiber.core.model_internal. use _servicecontrol.addheader or _servicecontrol.addsimpleheader add headers.

 

only _super_sessionmanagerservice regenerated when change happens.

 

-radhakrishna



More discussions in Flex (Read Only)


adobe

Comments

Popular posts from this blog

Joomla site hacked, cant see front and - Joomla! Forum - community, help and support

Christian Home School Programs - Joomla! Forum - community, help and support

Trouble with PF_OutFlag_I_USE_AUDIO and PF_CHECKOUT_LAYER_AUDIO