Accessing Duplex WCF Services in SL 3.0


when ms released sl 3.0, posted walk-throughs supposed folks understand how write , access duplex wcf services in sl 3.0:

 http://msdn.microsoft.com/en-us/library/dd470105(vs.96).aspx

i've been trying work, , i'm running bit of difficulty.  i've created duplex service in question, , far can tell, it's , running, e.g., navigating http://localhost:59363/duplexservice.svc gives me expected page.  , can reference client, , build proxies.

however, in mainpage constructor, demo says should insert following code:

            endpointaddress address = new endpointaddress("http://localhost:59363/duplexservice.svc");
            custombinding binding = new custombinding(
                new pollingduplexbindingelement(),
                new binarymessageencodingbindingelement(),
                new httptransportbindingelement());
            duplexserviceclient proxy = new duplexserviceclient(binding, address);
            proxy.receivereceived += new eventhandler<receivereceivedeventargs>(proxy_receivereceived);
            proxy.orderasync("
widget", 3);
            reply.text = "
sent order of 3 widgets." + environment.newline;

and unfortunately, it's throwing compile error on "proxy.receivereceived":

error 6 'duplexclient.orderservice.duplexserviceclient' not contain definition 'receivereceived' , no extension method 'receivereceived' accepting first argument of type 'duplexclient.orderservice.duplexserviceclient' found (are missing using directive or assembly reference?) c:\source\temp\silverlightduplexservice\duplexclient\mainpage.xaml.cs 30 19 duplexclient

and of course, when check generated code, there's no reference receivereceived there.

there are references receive method various places in client's wsdl files, e.g., in silverlight.wsdl:

<?xml version="1.0" encoding="utf-8"?>

<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:xsd="http://www.w3.org/2001/xmlschema" xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract" xmlns:tns="silverlight" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:wsa10="http://www.w3.org/2005/08/addressing" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" targetnamespace="silverlight" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">

<wsdl:types>

<xsd:schema targetnamespace="silverlight/imports">

<xsd:import namespace="silverlight" />

<xsd:import namespace="http://schemas.microsoft.com/2003/10/serialization/" />

<xsd:import namespace="http://schemas.datacontract.org/2004/07/duplexservice" />

<xsd:import namespace="http://schemas.microsoft.com/2003/10/serialization/arrays" />

</xsd:schema>

</wsdl:types>

<wsdl:message name="iduplexservice_order_inputmessage">

<wsdl:part name="parameters" element="tns:order" />

</wsdl:message>

<wsdl:message name="iduplexservice_receive_outputcallbackmessage">

<wsdl:part name="parameters" element="tns:receive" />

</wsdl:message>

<wsdl:porttype name="iduplexservice">

<wsdl:operation name="order">

<wsdl:input wsaw:action="silverlight/iduplexservice/order" message="tns:iduplexservice_order_inputmessage" />

</wsdl:operation>

<wsdl:operation name="receive">

<wsdl:output wsaw:action="silverlight/iduplexservice/receive" message="tns:iduplexservice_receive_outputcallbackmessage" />

</wsdl:operation>

</wsdl:porttype>

</wsdl:definitions>

 and in service.wsdl:

<?xml version="1.0" encoding="utf-8"?>
<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:i0="silverlight" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:xsd="http://www.w3.org/2001/xmlschema" xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract" xmlns:tns="http://tempuri.org/" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:wsa10="http://www.w3.org/2005/08/addressing" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" name="orderservice" targetnamespace="http://tempuri.org/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
<
wsp:policy wsu:id="custombinding_iduplexservice_policy">
<
wsp:exactlyone>
<
wsp:all>
<
msb:binaryencoding xmlns:msb="http://schemas.microsoft.com/ws/06/2004/mspolicy/netbinary1" />
<
wsaw:usingaddressing />
</
wsp:all>
</
wsp:exactlyone>
</
wsp:policy>
<
wsdl:import namespace="silverlight" location="" />
<
wsdl:types />
<
wsdl:binding name="custombinding_iduplexservice" type="i0:iduplexservice">
<
wsp:policyreference uri="#custombinding_iduplexservice_policy" />
<
soap12:binding transport="http://schemas.xmlsoap.org/soap/http" />
<
wsdl:operation name="order">
<
soap12:operation soapaction="silverlight/iduplexservice/order" style="document" />
<
wsdl:input>
<
soap12:body use="literal" />
</
wsdl:input>
</
wsdl:operation>
<
wsdl:operation name="receive">
<
soap12:operation soapaction="silverlight/iduplexservice/receive" style="document" />
<
wsdl:output>
<
soap12:body use="literal" />
</
wsdl:output>
</
wsdl:operation>
</
wsdl:binding>
<
wsdl:service name="orderservice">
<
wsdl:port name="custombinding_iduplexservice" binding="tns:custombinding_iduplexservice">
<
soap12:address location="http://localhost:59363/duplexservice.svc" />
<
wsa10:endpointreference>
<
wsa10:address>http://localhost:59363/duplexservice.svc</wsa10:address>
</
wsa10:endpointreference>
</
wsdl:port>
</
wsdl:service>
</
wsdl:definitions>

so far can tell, i've followed demo pretty closely, , i've gone , double-checked everything, it's possible i've missed step somewhere.

any suggestions?  has else been able demo work?  or 3.0 clients not yet correctly generate duplex proxies?  workarounds?

i figured out problem. turns out when installed sl 3.0 sdk, said going uninstall sl 2.0, didn't. "tool" being run generate reference.cs file still sl 2.0 instance of slsvcinst.exe. uninstalled sl 2.0 sdk manually, , visual studio started using sl 3.0 instance of slsvcinst.exe. life better (though still not perfect, see later posts).


Silverlight  >  Accessing Web Services with Silverlight



Comments

Popular posts from this blog

Conditional formatting a graph vertical axis in SSRS 2012 charts

Register with Power BI failed

SQL server replication error Cannot find the dbo or user defined function........