tags:

views:

262

answers:

2

I am creating a wcf service. When i add the service as a "Web reference" to my web site (I do this by using the url: http://localhost/myservice.svc?wsdl ) and then call the web methods exposed by the service, I get a "Operation has timed out" exception. However when i add the service as a "Service Reference" to the site, the calls work fine.

The reason iam adding it as a web reference is, i want to expose the wcf service to all clients like java, php .....

I have looked at the article in "http://blogs.msdn.com/juveriak/archive/2008/03/18/wcf-proxy-that-works-with-different-clients.aspx", but i have not tried converting the wsdl to a typed proxy as suggested by this article.

Any ideas on why i get a time out error when using it as a web reference?

A: 

Likely you're using WsHttpBinding rather than BasicHttpBinding. .NET 2.0 web services cannot consume a WsHttpBinding service.

The problem is one of protocol. Web service protocols are constantly changing, adding security, federated identity, and so forth. As they change, older technologies can't communicate using the newer protocols.

Thankfully, WCF will allow you to use multiple protocols in a single service -- just set up separate endpoints for each protocol you want to use. Be wary, however, as some are more secure than others.

Regarding versioning, the MessageVersion class is a good starting point.

Edit: I should have mentioned that you need to use MessageVersion as part of a custom TextMessageEncodingBindingElement binding, like so:

<bindings>
    <customBinding>
        <binding name="MyBinding">
            <textMessageEncoding messageVersion="Soap11WSAddressing10"/>
            <httpTransport/>
        </binding>
    </customBinding>
</bindings>
Randolpho
how is MessageVersion a way to version messages?? This tells you whether it's SOAP 1.1 or SOAP 1.2 - it doesn't give you the ability to specify "this is my service v1" or "my service v2".
marc_s
I have added a "BasicHttpBinding" section to the wcf service.
Nick
@Nick: let me know how it goes
Randolpho
@marc_s: I suppose I should have also mentioned the fact that you need to use MessageVersion as part of a CustomBinding. I shall edit...
Randolpho
Found an excellent article that answers my question:http://www.keithelder.net/blog/archive/2008/01/17/Exposing-a-WCF-Service-With-Multiple-Bindings-and-Endpoints.aspx
Nick
+2  A: 

Found an excellent article that answers my question:

http://www.keithelder.net/blog/archive/2008/01/17/Exposing-a-WCF-Service-With-Multiple-Bindings-and-Endpoints.aspx

Nick