[
https://issues.apache.org/jira/browse/FLEX-25959?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15230629#comment-15230629
]
Alexander Konovalov commented on FLEX-25959:
--------------------------------------------
The problem is that flex doesn't recognize @namespace variable at runtime. The
problem can be solved replacing @namespace with attribute("namespace").
For example:
OLD code:
> delete schemaXML[importQName].(@namespace == importURI)[0];
NEW code:
> delete schemaXML[importQName].(attribute("namespace") == importURI)[0];
I've solved that by monkey-patching original mx.rpc.xml.SchemaLoader class. It
has 2 places in code to be replaced (lines 98 and 107 for Flex 4.6).
> "Variable @namespace is not defined" Exception when Using Service Classes
> Generated from WCF WSDL
> -------------------------------------------------------------------------------------------------
>
> Key: FLEX-25959
> URL: https://issues.apache.org/jira/browse/FLEX-25959
> Project: Apache Flex
> Issue Type: Bug
> Components: RPC: WebService
> Affects Versions: Adobe Flex SDK 4.1 (Release)
> Environment: Affected OS(s): All OS Platforms
> Affected OS(s): All OS Platforms
> Language Found: English
> Reporter: Adobe JIRA
>
> Steps to reproduce:
> 1. Create a WCF service with an operation that returns a System.Data.DataSet
> object.
> 2. Using Flex Builder's "Connect to Web Service...", generate the client
> classes for the service, pointing to the WSDL of the new service.
> 3. Create and run an application that instantiates the service class, and
> tries to invoke service methods.
>
> Actual Results:
>
> An exception is thrown when the service class is instantiated. This happens
> when the internal web service code tries to load the WSDL, and fails
> (probably model_internal::loadWSDLIfNecessary() ). The SchemaLoader tries to
> access the namespace attribute of each <xsd:import> element, without first
> checking whether the attribute exists.
> There is no way to catch this exception, because it happens in a callback
> that is not exposed to customization.
> ReferenceError: Error #1065: Variable @namespace is not defined.
> at
> mx.rpc.xml::SchemaLoader/schemaImports()[E:\dev\4.x\frameworks\projects\rpc\src\mx\rpc\xml\SchemaLoader.as:107]
> at
> mx.rpc.wsdl::WSDLLoader/schemaImports()[E:\dev\4.x\frameworks\projects\rpc\src\mx\rpc\wsdl\WSDLLoader.as:273]
> at
> mx.rpc.wsdl::WSDLLoader/resultHandler()[E:\dev\4.x\frameworks\projects\rpc\src\mx\rpc\wsdl\WSDLLoader.as:167]
> at flash.events::EventDispatcher/dispatchEventFunction()
> at flash.events::EventDispatcher/dispatchEvent()
> at
> HTTPOperation/http://www.adobe.com/2006/flex/mx/internal::dispatchRpcEvent()[E:\dev\4.x\frameworks\projects\rpc\src\mx\rpc\http\HTTPService.as:989]
> at
> mx.rpc::AbstractInvoker/http://www.adobe.com/2006/flex/mx/internal::resultHandler()[E:\dev\4.x\frameworks\projects\rpc\src\mx\rpc\AbstractInvoker.as:318]
> at
> mx.rpc::Responder/result()[E:\dev\4.x\frameworks\projects\rpc\src\mx\rpc\Responder.as:56]
> at
> mx.rpc::AsyncRequest/acknowledge()[E:\dev\4.x\frameworks\projects\rpc\src\mx\rpc\AsyncRequest.as:84]
> at
> DirectHTTPMessageResponder/completeHandler()[E:\dev\4.x\frameworks\projects\rpc\src\mx\messaging\channels\DirectHTTPChannel.as:446]
> at flash.events::EventDispatcher/dispatchEventFunction()
> at flash.events::EventDispatcher/dispatchEvent()
> at flash.net::URLLoader/onComplete()
>
> Expected Results:
> In any case, an exception should not be thrown where it is impossible for the
> client to catch it. Ideally, we should be able to decide if and when the WSDL
> is requested - doing it as part of the service class construction is
> surprising behavior, and seems like bad design.
> If the Flex Builder "Test Operation" window can test the service
> successfully, which it can, then there should be a way to use that service
> successfully from code. Currently, this is not the case.
>
> Workaround (if any):
>
>
> Notes:
> We know it is bad practice to use the .NET DataSet class to expose data
> through a web service. But sometimes we have no choice in the matter as the
> service client.
> * http://www.mail-archive.com/[email protected]/msg91261.html
> *
> http://stackoverflow.com/questions/1188201/web-service-wcf-service-is-it-ever-better-to-return-a-dataset
> *
> http://www.dotnetconsult.co.uk/weblog2/PermaLink,guid,0a7cd196-c36b-4afa-ab02-5e4e6829c42d.aspx
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)