Figured out
a weird issue with Flex 2.0 / Flash Player 9 . Your comments
welcome.
Issue:
When you are calling
any webservice where the API contains a
method/function/operation named 'logout' your call wont be
processed.
and you get the
exception mentioned in trace .
Just to confirm the
issue I tried writing webservice in Intersystems Cache and .NET
1.0 .
The issue lies with
webmethod name 'logout' , if its renamed to something else the life is
good.
Trace
:
TypeError: Error
#1034: Type Coercion failed: cannot convert
MC{mx.rpc.soap.mxml::[EMAIL PROTECTED]
mx.rpc::AbstractService/logout()[EMAIL PROTECTED] to mx.rpc.soap.Operation.
at mx.rpc.soap::WebService/::createOperationsFromPort()
at mx.rpc.soap::WebService/::setPort()
at mx.rpc.soap::WebService/http://www.adobe.com/2006/flex/mx/internal::wsdlHandler()
at flash.events::EventDispatcher/flash.events:EventDispatcher::dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at mx.rpc.soap::WSDLParser/dispatchEvent()
at mx.rpc.soap::WSDLParser/::parseCompleted()
at mx.rpc.soap::WSDLParser/http://www.adobe.com/2006/flex/mx/internal::httpResultHandler()
at flash.events::EventDispatcher/flash.events:EventDispatcher::dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at mx.rpc::AbstractInvoker/http://www.adobe.com/2006/flex/mx/internal::dispatchRpcEvent()
at mx.rpc::AbstractInvoker/http://www.adobe.com/2006/flex/mx/internal::resultHandler()
at mx.rpc::Responder/result()
at mx.rpc::AsyncRequest/acknowledge()
at ::DirectHTTPMessageResponder/completeHandler()
at flash.events::EventDispatcher/flash.events:EventDispatcher::dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at flash.net::URLLoader/flash.net:URLLoader::onComplete()
at mx.rpc.soap::WebService/::createOperationsFromPort()
at mx.rpc.soap::WebService/::setPort()
at mx.rpc.soap::WebService/http://www.adobe.com/2006/flex/mx/internal::wsdlHandler()
at flash.events::EventDispatcher/flash.events:EventDispatcher::dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at mx.rpc.soap::WSDLParser/dispatchEvent()
at mx.rpc.soap::WSDLParser/::parseCompleted()
at mx.rpc.soap::WSDLParser/http://www.adobe.com/2006/flex/mx/internal::httpResultHandler()
at flash.events::EventDispatcher/flash.events:EventDispatcher::dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at mx.rpc::AbstractInvoker/http://www.adobe.com/2006/flex/mx/internal::dispatchRpcEvent()
at mx.rpc::AbstractInvoker/http://www.adobe.com/2006/flex/mx/internal::resultHandler()
at mx.rpc::Responder/result()
at mx.rpc::AsyncRequest/acknowledge()
at ::DirectHTTPMessageResponder/completeHandler()
at flash.events::EventDispatcher/flash.events:EventDispatcher::dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at flash.net::URLLoader/flash.net:URLLoader::onComplete()
Code:
.Net
(C#) Webservice
----------------------------------
using
System;using
System.Collections;using
System.ComponentModel;using
System.Data;using
System.Diagnostics;using
System.Web;using
System.Web.Services;namespace
TestWS{
[WebService(Namespace="http://vishwajit.com")]
public class Service1 : System.Web.Services.WebService{
public Service1(){
InitializeComponent();
}
private IContainer components = null; private void InitializeComponent(){
}
protected override void Dispose( bool disposing ){
if(disposing && components != null){
components.Dispose();
}
base.Dispose(disposing);}
[WebMethod]
public string login(string loginId , string password){
return "ok" ;}
[WebMethod]
public string logout(string sessionId){
return "ok" ;}
}
//class}
//namespaceFlex 2.0
(AS3) Code for Webservice Client
--------------------------------------------------------------------
<?xml
version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="creationCompleteHandler()" >
<mx:WebService id="loginWS"
wsdl="http://vishwajit/TestWS/Service1.asmx?WSDL"
useProxy="false"
fault="wsFault(event)" >
<mx:operation name="login" result="getLoginResult(event)" >
<mx:request xmlns="" >
<username>a1</username>
<password>a1</password>
</mx:request>
</mx:operation>
</mx:WebService>
<mx:Script>
<![CDATA[
import mx.controls.Alert;
public function creationCompleteHandler()
{
loginWS.login.send();
}
public function getLoginResult(result : Object)
{
Alert.show(loginWS.login.lastResult + "");
}
public function wsFault(fault:Object)
{
Alert.show(""+fault);
}
]]>
</mx:Script>
</mx:Application>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="creationCompleteHandler()" >
<mx:WebService id="loginWS"
wsdl="http://vishwajit/TestWS/Service1.asmx?WSDL"
useProxy="false"
fault="wsFault(event)" >
<mx:operation name="login" result="getLoginResult(event)" >
<mx:request xmlns="" >
<username>a1</username>
<password>a1</password>
</mx:request>
</mx:operation>
</mx:WebService>
<mx:Script>
<![CDATA[
import mx.controls.Alert;
public function creationCompleteHandler()
{
loginWS.login.send();
}
public function getLoginResult(result : Object)
{
Alert.show(loginWS.login.lastResult + "");
}
public function wsFault(fault:Object)
{
Alert.show(""+fault);
}
]]>
</mx:Script>
</mx:Application>
--------------------------
Thank
you.
Feedback / comments
welcome.
Vishwajit Girdhari
The best way to be
prepared for future is to invent
it !
Flex
Blog: http://flexiness.blogspot.com
--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
SPONSORED LINKS
| Software development tool | Software development | Software development services |
| Home design software | Software development company |
Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe
__,_._,___

