Pergunta

I am working with the Pingdom API in a Flex 4 AIR Application, and using the Data/Services builder built into Flash Builder 4. Pingdom's API is built on SOAP (for now at least), and Flash Builder 4 was able to import the WSDL file just fine, but when I try to send the Auth_login request in my token the result variable is null. I am not sure if I am looking in the wrong place, or what. To be exact I am looking at Auth_loginResult.token.result for the value.

Is token.result the correct place to look? If result is null is their anyway to figure out why it is null, meaning checking if the WSDL is available or not, and if it is a valid request?

I am running a Net Monitor in the app to make sure it is online.

My code is as follows for the login process

<?xml version="1.0" encoding="utf-8"?>
<s:View xmlns:fx="http://ns.adobe.com/mxml/2009"
        xmlns:s="library://ns.adobe.com/flex/spark"
        xmlns:pingdomapi="services.pingdomapi.*"
        title="Login">
    <fx:Script>
        <![CDATA[
            import valueObjects.Auth_CredentialsData;


            protected function login(event:MouseEvent):void
            {
                var credentials:Auth_CredentialsData = new Auth_CredentialsData;
                credentials.username = txt_username.text;
                credentials.password = txt_password.text;
                Auth_loginResult.token = pingdomAPI.Auth_login('****',credentials);
                trace(Auth_loginResult.token.result);
            }
        ]]>
    </fx:Script>
    <fx:Declarations>
        <s:CallResponder id="Auth_loginResult"/>
        <pingdomapi:PingdomAPI id="pingdomAPI"/>
    </fx:Declarations>
    <s:Label x="10" y="10" text="Username"/>
    <s:TextInput id="txt_username" x="10" y="41" text="david.long@cagedata.com"/>
    <s:Label x="10" y="104" text="Password"/>
    <s:TextInput id="txt_password" x="10" y="135" displayAsPassword="true" text="Simpsons#1"/>
    <s:Button id="btn_login" y="198" right="30" label="Login" click="login(event)"/>
</s:View>
Foi útil?

Solução 2

After letting this question sit I am going to close it, as it seams there is a error with the Pingdom API WSDL. I will report the error and hope to see it fixed in the future with their upcoming REST API.

Outras dicas

According to this, you should be looking for the sessionId element of the Auth_LoginResponse.

Even though this question has been abandoned, someone might pass by with the same question.

The reason that the result is null, is that the call is asynchronous. The response had not arrived yet, when Dave tried to trace it.

Instead, trace in the result and/or error handler of the Auth_loginResult CallResponder, like this:

<s:CallResponder id="Auth_loginResult" result="trace(event.result)" error="trace(event)"/>
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top