I am writing my first SVC and am missing something. It all compiles fine but the page does not seem to return anything from my service.
Service Code:
namespace RivWorks.Web.Services
{
[ServiceContract(Namespace = "http://www.rivworks.com/ws/")]
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
public class PlayerService
{
[OperationContract]
public string Decrypt(string interactive)
{
return RivWorks.Security.Cryptography.Internal.Decrypt(interactive);
}
[OperationContract]
public void LogEvent(Int64 HistoryRequestID, string VideoPath, string Action, string Target, string ClientDateTime, string UrlReferrer, float Offset, string TimeZone)
{
DateTimeOffset dt = RivWorks.DateTimeInfo.ConvertFromFlash(ClientDateTime);
RivWorks.Membership.UserInfo userInfo = RivWorks.DateTimeInfo.GetUserInfo(dt, Offset, TimeZone, "Log Request");
RivWorks.Data.Player.LogEvent(HistoryRequestID, VideoPath, Action, Target, userInfo, UrlReferrer);
}
}
}
My ASPX code:
<body>
<form id="form1" runat="server">
<h1>Greeting</h1>
<div>
<asp:Literal id="PutFrameHere" runat="server" />
</div>
<hr />
<asp:ScriptManager ID="SM1" runat="server">
<Services>
<asp:ServiceReference Path="~/Services/PlayerService.svc" />
</Services>
</asp:ScriptManager>
<script type="text/javascript">
function OnDecrypt(result) {
www.rivworks.com.ws.PlayerService.Decrypt($get("encryptedText").value, OnDecryptComplete, OnError, null);
}
function OnDecryptComplete(result) {
alert("Complete: " + result.toString());
}
function OnError(result) {
alert("Error: " + result.toString());
}
</script>
Enter encrypted string:<input type="text" id="encryptedText" />
<br />
<input type="button" value="Decrypt" onclick="OnDecrypt()"? />
</form>
</body>
When I click the button, nothing appears to happen. I would expect an error or a string in response. Using FireBug and ServiceCapture do not reveal anything. ServiceCapture does not show any requests coming out.
On a slightly different note - what would I need to do to let a Flash and/or Flex app call into the service correctly? I don't do either so am curious as to what the command should look like (to give our flash/flex developers a sample to work from.)
Any hints, tips, tricks?
Forgot to say that I was using a tutorial found at http://www.pluralsight.com/community/blogs/fritz/archive/2008/01/31/50121.aspx
From my web.config:
<system.serviceModel>
<behaviors>
<endpointBehaviors>
<behavior name="RivWorks.Web.Services.PlayerServiceAspNetAjaxBehavior">
<enableWebScript />
</behavior>
</endpointBehaviors>
</behaviors>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
<services>
<service name="RivWorks.Web.Services.PlayerService">
<endpoint address="" behaviorConfiguration="RivWorks.Web.Services.PlayerServiceAspNetAjaxBehavior"
binding="webHttpBinding" contract="RivWorks.Web.Services.PlayerService" />
</service>
</services>
</system.serviceModel>
</configuration>
Forgive me - I am not exactly clear on what your were looking for. I also dropped out the sections that did not change when I added WCF.
<%@ ServiceHost Language="C#"
Debug="true"
Service="RivWorks.Web.Services.PlayerService"
CodeBehind="PlayerService.svc.cs" %>
Not quite a match...