Hi,
I am not sure if my
answer is really the answer, since I personally dont use the Webservice tag,
but the webservice action script classes.
When a webservice is
initialized, it will load the wsdl from an URL. This can take some time and is
an asynchronous process. This means that the webservice loads the WSDL in the
background. If it is not finished loading/parsing the wsdl and you try to
invoke an operation it will return errors.
Try to wait a few
seconds and invoke it then, if the error still remains, then this is the
reason. How to solve it? I did it like this:
secWsImpl = new WebService();
secWsImpl.addEventListener(LoadEvent.LOAD,
handleWsLoaded);
secWsImpl.addEventListener("fault",
handleWsError);
secWsImpl.loadWSDL("/FlexTestWebServices/wsdl/SecurityWebServiceRpcEnc8080.wsdl");
In the method
handleWsLoaded you can then invoke an operation if youd like, or enable a
button or something like that.
Cheers,
Frnack
From:
[EMAIL PROTECTED]ups.com
[mailto:[EMAIL PROTECTED]ups.com] On Behalf Of Derek Adams
Sent: Sunday, August 06, 2006 11:56
PM
To:
[EMAIL PROTECTED]ups.com
Subject: [flexcoders] Re:
WSDLError:Element not resolvable
Did you
have any luck figuring this one out? I am having the same
problem. The
first call to a particular operation always fails, then
all calls after
that work fine. Even weirder is the fact that a call
to another operation
on the same service is successful right before
the other call
fails.
--- In [EMAIL PROTECTED]ups.com,
"flexava" <[EMAIL PROTECTED]> wrote:
>
> I ran into a strange
problem when I was trying to call a web
> service.Here's the
source:
> <?xml version="1.0" encoding="utf-8"?>
>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
>
layout="vertical">
> <mx:Script>
>
<![CDATA[
> import mx.rpc.events.FaultEvent;
> import
mx.controls.Alert;
> import mx.rpc.events.ResultEvent;
>
import
com.adobe.cairngorm.control.CairngormEventDispatcher;
>
import com.ceno.umc.control.LoginEvent;
>
> private
function onResult(event :
ResultEvent) : void
> {
>
Alert.show(event.result.toString
(),"result");
> }
>
> private function onFault(event :
FaultEvent) : void
>
{
>
Alert.show
(event.fault.faultString,"faultString");
>
}
> ]]>
> </mx:Script>
> <mx:WebService
id="aService" service="umc/umc/auth"
>
port="umc/umc/authHttpPort"
> wsdl="http://localhost:8008/ws/services/umc/umc/auth?
wsdl"
>
showBusyCursor="true"
> result="onResult(event)"
fault="onFault(event)">
> <mx:operation name="login"
resultFormat="e4x">
> <mx:request>
>
<req>
> <subject>
> admin
>
</subject>
> <username>
> admin
>
</username>
> <password>
> admin
>
</password>
> </req>
> </mx:request>
>
</mx:operation>
> </mx:WebService>
> <mx:Button
label="Login" click="aService.login.send()"/>
>
</mx:Application>
> when I clicked the login button it first
showed me an error dialog
saying:
> [WSDLError
faultString="Element
http://cmd.umc.ceno.com:loginResponse
>
not resolvable" faultCode="WSDL.BadElement"
faultDetail="null"]
> at
>
mx.rpc.soap::WSDLParser/http://www.adobe.com/2006/flex/mx/internal::p
arseMessage()
>
at mx.rpc.soap::WSDLOperation/parseMessages()
>
at
>
mx.rpc.soap::Operation/http://www.adobe.com/2006/flex/mx/internal::in
vokePendingCall()
>
at mx.rpc.soap::Operation/send()
> at Function/http://adobe.com/AS3/2006/builtin::apply()
>
at mx.rpc.soap.mxml::Operation/send()
> at
WSTest/___Button1_click()
> then I clicked the login button
again,eveything worked.Any idea?
Thanks.
>