Changing WSDL of Flex 4.5 Autogenerated Service Pr

2019-09-11 14:02发布

I used Flash Builder's 4.5 capability to auto generate a proxy class for a given SOAP service. Everything works fine and dandy, except for the fact that the WSDL url is hardcoded into the auto-generated proxy class.

Now, when I deploy the Flex app onto the production server, I want to change the path of the SOAP service, which will be obtained from a config file. The internals of the service will be exactly the same. In the code snippet below, I try to swap wsdl url manually in a subclass of the auto-generated proxy which is Adobe's recommended approach...

/**
     * Override super.init() to provide any initialization customization if needed.
     */
    protected override function preInitializeService():void
    {

        super.preInitializeService();
        // Initialization customization goes here

        super.wsdl = "http://s174667r2ycj0l1/mscviewer/MySecretService.asmx?wsdl";
        super.useProxy = false;
    }

However, I always get the following error: "[RPC Fault faultString="You must specify the WSDL location with useProxy set to false." faultCode="Client.WSDL" faultDetail="null"] at mx.rpc.soap::WebService/loadWSDL()"

Can someone tell me what I am doing wrong here, or if there is a better way to swap wsdl locations?

2条回答
唯我独甜
2楼-- · 2019-09-11 14:09
  • Go to .model folder into your flex project package and open .fml file
  • Change the uri for your wsdl

I do that when i want to deploy my fb projects because adobe does not have information about this.

.sorry for my english :)

查看更多
姐就是有狂的资本
3楼-- · 2019-09-11 14:32

It is quite late, but i stumbled on the same problem today, here is how I solved it :

  1. I created a ConfigLoader singleton, in charge of loading configuration via a XML file

  2. In my webservice class :

    import com.adobe.fiber.core.model_internal;
    import flash.events.*;
    
    protected override function preInitializeService():void
    {
       ConfigLoader.instance.addEventListener('config_file_loaded',confLoaded);
       ConfigLoader.instance.load();
    }
    
    private function confLoaded(e:Event):void
    {
       _serviceControl.service = "bModelo";
       _serviceControl.port = "bModeloSoap";
       wsdl = ConfigLoader.instance.url;
       model_internal::loadWSDLIfNecessary();
    }
    
查看更多
登录 后发表回答