Highlighted

a .NET WCF service with multiple contracts through Flex Builder 3’s Import Web Service (WSDL) Wizard

xumichael

24-12-2008

Hi all,



I ran into a problem when importing a .NET WCF service with
multiple contracts through Flex Builder 3’s Import Web
Service (WSDL) Wizard.



Environment:



.NET 3.5 Framework, Visual Studio 2008, Flex Builder 3,
Windows XP SP2



To make it simple, my scenario is:



I defined 2 interfaces (really are contracts)
“IFoo1” and “IFoo2”. My WCF service
“FooService” implemented IFoo1 and IFoo2. I am hosting
the “FooService” in a console app. From the .NET side,
everything works. The service was running at
http://localhost:8086/FooService.



Now I imported the
http://localhost:8086/FooService?wsdl
in Flex Builder 3. The proxies generated were wrong.



There were 2 bindings which is correct. If I choose
Foo1HttpBinding, only proxies for IFoo1 were generated; if I select
Foo2HttpBinding, then only proxies for IFoo2 were generated. OK,
then I tried to put each set of proxies into its own package, still
not work.



Now I am concerned, is there anything wrong with my
operation? Or Flex does not support WCF Service with multiple
contracts, which means I need to put every operation inside one
interface(contract)?



Thank you very much for your help.



Thanks

Michael



The abstraction of my codes are shown below:



namespace MyNamespace

{

[ServiceContract(Name = "IFoo1", Namespace = "
http://services.mycompany.com/2009/12")

public interface IFoo1

{

[OperationContract]

string Foo1();

}



[ServiceContract(Name = "IFoo2", Namespace = "
http://services.mycompany.com/2009/12")

public interface IFoo2

{

[OperationContract]

string Foo2();

}



[ServiceBehavior(Namespace = "
http://services.mycompany.com/2009/12",
InstanceContextMode = InstanceContextMode.PerCall)]

public class FooService : IFoo1, IFoo2

{

public string Foo1()

{

return "Foo1";

}



public string Foo2()

{

return "Foo2";

}

}

}



In the app.config:



<services>

<service name="MyNamespace.FooService">

<host>

<baseAddresses>

<add baseAddress="
http://localhost:8086/FooService"
/>

</baseAddresses>

</host>



<endpoint address="Foo1" binding="basicHttpBinding"

name="Foo1HttpBinding" bindingNamespace="
http://services.mycompany.com/2009/12"

contract="MyNamespace.IFoo1" />



<endpoint address="Foo2" binding="basicHttpBinding"

name="Foo2HttpBinding" bindingNamespace="
http://services.mycompany.com/2009/12"

contract="MyNamespace.IFoo2" />



</service>