Newbie to WCF need few basic question answered<p>hi,<br/>After long time i finally got a project that I can use some WCF.Trouble is I have not time to learn as I should.<br/><br/>I have some questions?<br/><br/>          1)Can a wcf method return list&lt;T&gt; or do I have to return ICollection?<br/><br/>          2)When passing arguments can you pass an object EG Save(Customer customer) or do you have to do Save(string name,string surname etc...) ?<br/><br/>          3)When passing arguments can you pass collection EG  Save(List&lt;customer&gt;customerList) or do you have to pass arrays ?<br/><br/>          4)Is it possible to redirect from an aspx page to a WCF Method ?<br/>              Need to simulate a 3rd party control EG paypal (calling my WCF method &quot;Save&quot; to record the payment into the database and then redirect to an aspx.page&quot; can this be done conceptually?<br/><br/>           5) can you redirect to a web page from a WCF Method?<br/><br/><br/>If you can answer one that will be fine.<br/><br/>THanks a lot as usual<br/><br/></p> <hr class=sig> Thanks for your help© 2009 Microsoft Corporation. All rights reserved.Wed, 08 Jul 2009 12:06:54 Zfad816d2-ebe7-4743-9f9f-00f3d92b6a58http://social.msdn.microsoft.com/Forums/en-US/wcf/thread/fad816d2-ebe7-4743-9f9f-00f3d92b6a58#fad816d2-ebe7-4743-9f9f-00f3d92b6a58http://social.msdn.microsoft.com/Forums/en-US/wcf/thread/fad816d2-ebe7-4743-9f9f-00f3d92b6a58#fad816d2-ebe7-4743-9f9f-00f3d92b6a58devBrixhttp://social.msdn.microsoft.com/Profile/en-US/?user=devBrixNewbie to WCF need few basic question answered<p>hi,<br/>After long time i finally got a project that I can use some WCF.Trouble is I have not time to learn as I should.<br/><br/>I have some questions?<br/><br/>          1)Can a wcf method return list&lt;T&gt; or do I have to return ICollection?<br/><br/>          2)When passing arguments can you pass an object EG Save(Customer customer) or do you have to do Save(string name,string surname etc...) ?<br/><br/>          3)When passing arguments can you pass collection EG  Save(List&lt;customer&gt;customerList) or do you have to pass arrays ?<br/><br/>          4)Is it possible to redirect from an aspx page to a WCF Method ?<br/>              Need to simulate a 3rd party control EG paypal (calling my WCF method &quot;Save&quot; to record the payment into the database and then redirect to an aspx.page&quot; can this be done conceptually?<br/><br/>           5) can you redirect to a web page from a WCF Method?<br/><br/><br/>If you can answer one that will be fine.<br/><br/>THanks a lot as usual<br/><br/></p> <hr class=sig> Thanks for your helpSat, 04 Jul 2009 11:29:58 Z2009-07-04T11:32:01Zhttp://social.msdn.microsoft.com/Forums/en-US/wcf/thread/fad816d2-ebe7-4743-9f9f-00f3d92b6a58#16451531-d4e9-4811-9d3a-3930f24987a6http://social.msdn.microsoft.com/Forums/en-US/wcf/thread/fad816d2-ebe7-4743-9f9f-00f3d92b6a58#16451531-d4e9-4811-9d3a-3930f24987a6Meetu Choudharyhttp://social.msdn.microsoft.com/Profile/en-US/?user=Meetu%20ChoudharyNewbie to WCF need few basic question answered 1)Can a wcf method return list&lt;T&gt; or do I have to return ICollection?<br/><br/>yes your WCF serivce  can retuen list&lt;t&gt; an example is<br/><br/>in Interface: <pre lang="x-c#"> [OperationContract] [WebGet] List&lt;int&gt; UpdateDesignation(Designation desItem);</pre> in class:<br/><br/> <pre> public List&lt;int&gt; UpdateDesignation(PLO.Web.Classes.Designation desItem) { List&lt;int&gt; result = new List&lt;int&gt;(); SqlCommand cmd = new SqlCommand(&quot;UpdateDesignation&quot;, new SqlConnection(GetConnectionString())); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add(new SqlParameter(&quot;did&quot;, desItem.ID)); cmd.Parameters.Add(new SqlParameter(&quot;des&quot;, desItem.DesignationName)); cmd.Connection.Open(); int i = cmd.ExecuteNonQuery(); cmd.Connection.Close(); result.Add(i); return result; }</pre> Answer to your second question :<br/>2)When passing arguments can you pass an object EG Save(Customer customer) or do you have to do Save(string name,string surname etc...) ?<br/><br/>In the above code snippet Designation  is my class and i have passed it as a parameter.<br/> <hr class=sig> Thanks and Regards <br/>Meetu Choudhary <br/>MCPDSat, 04 Jul 2009 12:21:44 Z2009-07-04T12:23:49Zhttp://social.msdn.microsoft.com/Forums/en-US/wcf/thread/fad816d2-ebe7-4743-9f9f-00f3d92b6a58#b3cbc08e-47e2-40c3-97d0-1b14544719a5http://social.msdn.microsoft.com/Forums/en-US/wcf/thread/fad816d2-ebe7-4743-9f9f-00f3d92b6a58#b3cbc08e-47e2-40c3-97d0-1b14544719a5devBrixhttp://social.msdn.microsoft.com/Profile/en-US/?user=devBrixNewbie to WCF need few basic question answeredThanks a lot for your time/reply. <div><br/></div> <div>Waiting for the others as well :)</div> <div><br/></div><hr class="sig">Thanks for your helpSat, 04 Jul 2009 16:46:05 Z2009-07-04T16:46:05Zhttp://social.msdn.microsoft.com/Forums/en-US/wcf/thread/fad816d2-ebe7-4743-9f9f-00f3d92b6a58#56e27708-257e-4093-894a-3b4314252252http://social.msdn.microsoft.com/Forums/en-US/wcf/thread/fad816d2-ebe7-4743-9f9f-00f3d92b6a58#56e27708-257e-4093-894a-3b4314252252Meetu Choudharyhttp://social.msdn.microsoft.com/Profile/en-US/?user=Meetu%20ChoudharyNewbie to WCF need few basic question answeredOK the remaing answers are:<br/><br/> 3)When passing arguments can you pass collection EG  Save(List&lt;customer&gt;customerList) or do you have to pass arrays ?<br/><br/>Answer is : Yes We can do it but need to check third party control's availability for the same<br/><br/>          4)Is it possible to redirect from an aspx page to a WCF Method ?<br/>              Need to simulate a 3rd party control EG paypal (calling my WCF method &quot;Save&quot; to record the payment into the database and then redirect to an aspx.page&quot; can this be done conceptually?<br/><br/>Answer is: <br/>We cant use Response.Redirect() in services <div class="msg Nth">But if you want you can customize services accordingly</div> <div class="msg Nth">Check this:<a href="http://forums.asp.net/t/1275870.aspx">http://forums.asp.net/t/1275870</a><br/><br/>           5) can you redirect to a web page from a WCF Method?<br/><br/><br/>Answer Is:<br/>You can use document.url=getUrl(call webservice) This is a tricky one Its because you cant use Response.Redirect in services You need to customize Now suppose a scenario in WCF services your client send you a SOAP with UID/PWD and you need to login to another site then you can use this by creating a get Url method ok<br/><br/>Sorry at time due to lak of time I was not able to answer other questions.</div><hr class="sig">Thanks and Regards <br/> Meetu Choudhary <br/> MCPDSat, 04 Jul 2009 17:34:49 Z2009-07-04T17:34:49Zhttp://social.msdn.microsoft.com/Forums/en-US/wcf/thread/fad816d2-ebe7-4743-9f9f-00f3d92b6a58#e640f2a7-3c43-46b7-8076-c07d55758902http://social.msdn.microsoft.com/Forums/en-US/wcf/thread/fad816d2-ebe7-4743-9f9f-00f3d92b6a58#e640f2a7-3c43-46b7-8076-c07d55758902Gaurav Arorahttp://social.msdn.microsoft.com/Profile/en-US/?user=Gaurav%20AroraNewbie to WCF need few basic question answeredOh! I joined late the thread. <div><br/></div> <div>Meetu, you wrote well by giving all the answer. I think there is no need for another opinion now.</div>Sat, 04 Jul 2009 18:10:24 Z2009-07-04T18:10:24Zhttp://social.msdn.microsoft.com/Forums/en-US/wcf/thread/fad816d2-ebe7-4743-9f9f-00f3d92b6a58#1deb9fad-08fd-4cee-8779-fcbab21ee9dehttp://social.msdn.microsoft.com/Forums/en-US/wcf/thread/fad816d2-ebe7-4743-9f9f-00f3d92b6a58#1deb9fad-08fd-4cee-8779-fcbab21ee9dedevBrixhttp://social.msdn.microsoft.com/Profile/en-US/?user=devBrixNewbie to WCF need few basic question answeredThank you very much for your replies!!!<br/><br/>Question  4 and 5 I guess require more investigation on my part.<br/><hr class="sig">Thanks for your helpSun, 05 Jul 2009 04:57:38 Z2009-07-05T04:57:38Zhttp://social.msdn.microsoft.com/Forums/en-US/wcf/thread/fad816d2-ebe7-4743-9f9f-00f3d92b6a58#739af925-42a9-4d71-980a-a218bbd12426http://social.msdn.microsoft.com/Forums/en-US/wcf/thread/fad816d2-ebe7-4743-9f9f-00f3d92b6a58#739af925-42a9-4d71-980a-a218bbd12426Steven Cheng - MSFThttp://social.msdn.microsoft.com/Profile/en-US/?user=Steven%20Cheng%20-%20MSFTNewbie to WCF need few basic question answeredHi DevBrix,<br/><br/>As for Question 4 and 5, I think you don't need to accomplish the redirecting (to page or from) in WCF. And WCF is focusing on distributed processing. For redirecing, you can implement it via some ASP.NET programming tricks. For example:<br/><br/>Your ASP.NET page and sychronously call the WCF method and perform Response.Redirect after the method call return.<br/><br/>Or if the service method is long-run and you need to call it asynchronously, then your page should use some client scripts to constantly poll server for the status of the metho call. If the call finishes(and data is ready), perform the redirection to new page.<br/><br/>Anyway, the redirection should be done at ASP.NET page code.<br/><br/>Hope this help some:)<br/><hr class="sig">Please remember to mark the replies as answers if they help and unmark them if they provide no help.Wed, 08 Jul 2009 12:06:54 Z2009-07-08T12:06:54Z