1

I need to call a webservice but I dont care if I get need a response or the service is down (fire and forget). Im currentlly using a try catch to compe with this.

My Question Is there a better way?

Thanks Sp

Bit more detail. I dont want the call to fail even if the webservice is down

1

2 Answers 2

2

This would be a great case for one-way or "fire and forget" serivces:

[ServiceContract]
interface IMyContract
{
   [OperationContract(IsOneWay = true)]
   void MyMethod()
}

Leaves the client with no need to mess with async hoo-ha, just make the call and get on with life.

Sign up to request clarification or add additional context in comments.

Comments

0
   string webServ = "addressofwebservice";
   AsyncCallback asyncCall = new AsyncCallback(CallBack);
   webServ.BeginSomeFunkyMethod(data, asyncCall, webServ);

...

private void CallbackSampleMethod(IAsyncResult asyncResult)
{
   if(asyncResult != null)
   {
       doFunkyStuff();
   }
   // else I really don't care...
}

How about that ?

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.