1

I have a WCF service that plays nicely with WCF clients but the most crucial of clients I need it to work with is an ASMX client. How could I make my WCF service compatible with ASMX clients?

I've followed this guide but to no avail(albeit I'm know 100% sure I have implemented it correctly)

Below is my ServiceContract and OperationContracts. My Web.config has no MEX endpoints.

  <ServiceContract()>
<XmlSerializerFormat(Use:=OperationFormatUse.Literal, Style:=OperationFormatStyle.Document)>
Public Interface racoSMS
    <OperationContract(Action:="http://tempuri.org/ReceiveSMS", ReplyAction:="http://tempuri.org/ReceiveSMS")>
    Function ReceiveSMS(ByVal securityKey As String, ByVal from As String, ByVal message As String) As ServiceResult
    <OperationContract(Action:="http://tempuri.org/Test", ReplyAction:="http://tempuri.org/Test")>
    Function Test(ByVal securityKey As String) As ServiceResult
End Interface
GoodBoyNYC
  • 159
  • 5
  • 18
  • 1
    What binding do you use ? What's the error ? what have you tried ? – Paciv Sep 18 '12 at 17:03
  • Initially I thought WCF would work with ASMX by default so I didn't do anything out of the ordinary but received an Contract mismatch error with an ASMX client trying to connect. I've since added XmlSerializerFormat and the Action bits in to the OperationContracts. I've changed the binding to BasicHTTPBinding but nothing yet. – GoodBoyNYC Sep 18 '12 at 17:48
  • Pleas visit the following link for solution. http://stackoverflow.com/a/30482561/4944540 – rahul kumar May 27 '15 at 15:04
  • I followed the link you provided and worked. Thanks! – erick2red Sep 16 '16 at 21:21

1 Answers1

1

Your question is quite vague. A few things to note:

  • Yes, you can use WCF to create a service that's compatible with ASMX-style web services.
  • Use of BasicHttpBinding is highly recommended.
  • Transport security (SSL) should be possible, but other than that be wary of fancy features (e.g. I don't think ASMX's support message security, for one).
  • Pay attention to the namespace of your Data- and Service Contract, make sure it's what the ASMX side expects (or be prepared to change code on that side). Same with the Action and ReplyAction (I can see from your sample code you've taken care of that).
  • What serialization type and SOAP style you need can indeed depend on what the client is expecting, use attributes accordingly.
  • I've heard of Web Service Enhancements to etend the ASMX end with some capabilities, but haven't used it myself.

As it is, I guess this is pretty much an answer to your question. You said that you did all this "to no avail", but you'll need to be more specific (either here, or possibly even in new question(s)) for us to help you.

Jeroen
  • 60,696
  • 40
  • 206
  • 339
  • I've followed the guide I linked in the OP as closely as I could. My only means of testing it is to enable the service and see if it begins to process the queue of messages from the ASMX client. I believe I'm missing the namespace on side of things. I wasn't aware of WCF could have a namespace to it(still fairly new to it). – GoodBoyNYC Sep 20 '12 at 15:13
  • Thank you. This is what I needed to get going in the right direction. One question though, I've attempted in including a namespace within my serviceContract (http://foobar.com:777/foo") but I lose functionality. Any method I've defined is lost. How can I go about resolving this? – GoodBoyNYC Sep 20 '12 at 19:16
  • Good to hear it helps. I'm not sure what you mean by "lose", but you may have most success if you start a new SO question on it, with some more details, etc. GL! – Jeroen Sep 20 '12 at 19:47