tags:

views:

26

answers:

2

Hi i wrote webservice in .net which return json string

WebService(Namespace = "AndrewRowland")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[ScriptService]
public class Service1 : System.Web.Services.WebService
{

    [WebMethod]
    [ScriptMethod(ResponseFormat = ResponseFormat.Json)]
    public string HelloWorld()
    {
        test Test = new test();
        Test.a = "one";
        Test.b = "two";
        JavaScriptSerializer js = new JavaScriptSerializer();
        return js.Serialize(Test);

    }
}

and now i want to cosume this method 'HelloWorld' in Flex3 but i don't know how to ask about this metod what i done is to put corelib to my libs and wrote httpService:

:

 private function onJSONLoad(event:ResultEvent):void


 {

     var rawData:String = String(event.result);
     var manager = JSON.decode(rawData);

   }

<mx:HTTPService id="service" resultFormat="text"
                url="http://localhost:50174/Service1.asmxn"
                result="onJSONLoad(event)" />
A: 

I don't know .NET well. But, If you're calling a SOAP Web Service, use the WebService tag instead of HTTPService. With WebService you can can call a specific method on the WSDL, kind of like this:

service.HelloWorld(); 

You should read through the livedocs for more details.

www.Flextras.com
A: 

i wrote i use JSON so why u r talking about SOAP?

I don't know .NET, too but it seems that this IS a SOAP-Webservice. Or does the `HelloWorld()`-method get called when you go to `http://localhost:50174/Service1.asmxn` ?
hering