Search code examples
javascriptjsonwcf-ria-services

How to call following the WCF-RIA Services method from javascript


Our Domain service has the following 'Invoke' operation:

public void SaveImportedUrl(CRIAImportedUrl i_importedUrl)

public class CRIAImportedUrl
{
    [Key]
    public Uri Url { get; set; }
    public string Title { get; set; }
    public string Description { get; set; }

    // ... more properities
}

I want to call this from a javascript client (over the JSON endpoint). By looking at the call (in fiddler) from a silverlight client, I can see I need to POST to the 'SubmitChanges' url. But the silverlight client uses the binary endpoint and I cannot see what the content of the POST message looks like.

Does anyone know how to do this? Or is it possible to 'reverse engineer' the silverlight code, either by getting hold of the source code or decoding the binary encoded POST message contents?

(We manage to successfully call 'CRUD' operations (http://stackoverflow.com/questions/8179504/how-to-insert-entity-over-wcf-ria-services-json-endpoint), but this 'Invoke' operation is still a mystery)

EDIT---

error message von server, wenn der POST message contents =

{
"Url":"http://www.bbc.co.uk/",
"Title":"a title",
"Description":"adesc"
}

{"ErrorCode":500,"ErrorMessage":"Object reference not set to an instance of an object.","IsDomainException":false,"StackTrace":" at System.ServiceModel.DomainServices.Hosting.ChangeSetProcessor.CreateChangeSet(IEnumerable1 changeSetEntries)\u000d\u000a at System.ServiceModel.DomainServices.Hosting.ChangeSetProcessor.Process(DomainService domainService, IEnumerable1 changeSetEntries)\u000d\u000a at System.ServiceModel.DomainServices.Hosting.SubmitOperationBehavior.SubmitOperationInvoker.InvokeCore(Object instance, Object[] inputs, Object[]& outputs)"}


Solution

  • There is a plugin for Fiddler that will let you inspect the binary messages sent by the SL client: WCF Binary Inspector