Hello all,

I have a problem with Flex Builder 2 and Web Service.

I develop the flex project that connect with web service and I want to
deploy this project but when run the page after release does not get data
from database 

But local no problem .

I don't know where is the problem. May be in web service namespace or wsdl
property in WebService tage in flex.

At local I'm  use <mx:WebService id="dataService"
wsdl="http://localhost:2008/myProj/Service.asmx?WSDL";> and no problem

But in online use <mx:WebService id="dataService"
wsdl="http://my_domain/Service.asmx?WSDL";> but not work.

 

And this is a simple example for code :

 

Flex part

<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"; layout="absolute"
creationComplete="{creationCompleteHandler()}">

 

                <mx:Script>

                                <![CDATA[

                                                import
mx.rpc.events.ResultEvent;

                                                private function
creationCompleteHandler():void {

 
dataService.SendFeedBack(); }

                                                private function
GetDataHandler(evt:ResultEvent):void {

                                                                Txt11.text =
evt.result.diffgram.DocumentElement.MyTable.Mail; }

                                ]]>

                </mx:Script>

                <!--<mx:WebService id="dataService"
wsdl="http://localhost:2008/myProj/Service.asmx?WSDL";>-->

                <mx:WebService id="dataService"
wsdl="http://my_domain/Service.asmx?WSDL";>

                                <mx:operation name="SendFeedBack"
result="GetDataHandler(event)"/>

                </mx:WebService>

                <mx:Label id="Txt11" color="Red" x="219" y="78" width="395"
height="33"/>

</mx:Application>

 

Web Service Part

using System;

using System.Web;

using System.Web.Services;

using System.Web.Services.Protocols;

using System.Data;

using System.Net.Mail;

 

[WebService(Namespace = "http://www.my_domain.com/";)]

[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]

public class Service : System.Web.Services.WebService

{

    public DataTable SendFeedBack()

    {

        DataTable DT = new DataTable("MyTable");

        DT.Columns.Add("Mail");

        DataRow DR = DT.NewRow();

        DR[0] = "Your mail has been sent.";

        DT.Rows.Add(DR);

        return DT;

    }  

}

Reply via email to