问题
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?
回答1:
- 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 :)
回答2:
It is quite late, but i stumbled on the same problem today, here is how I solved it :
I created a ConfigLoader singleton, in charge of loading configuration via a XML file
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(); }
来源:https://stackoverflow.com/questions/7205634/changing-wsdl-of-flex-4-5-autogenerated-service-proxy-classes