0

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)"}

GarethOwen
  • 6,075
  • 5
  • 39
  • 56
  • 1
    There is a plugin for Fiddler that will let you inspect the binary messages sent by the SL client: http://archive.msdn.microsoft.com/wcfbinaryinspector – TheNextman Dec 08 '11 at 16:05
  • Very helpful - thanks. I think you should write this as an answer, rather than just adding as a comment. – GarethOwen Dec 09 '11 at 08:11

2 Answers2

0

What's your WCF endpoint config like? I am guessing it's using TcpBinary and as such you will NOT be able to just 'reverse engineer' it, since there's also a lot of SOAP handling messages going around...

I would suggest adding a NEW WCF endpoint, configured for JSON, that way you'd be able to call the exact same method but from different clients at separate endpoints.

Leon
  • 4,532
  • 1
  • 19
  • 24
  • thanks Leon - we already have a JSON endpoint which we can call successfully for other CRUD operations. But not this type of 'Invoke' operation. – GarethOwen Dec 08 '11 at 13:30
  • so what do the WCF trace logs show when you POST to your "Invoke" operation? – Leon Dec 08 '11 at 13:31
0

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

TheNextman
  • 12,428
  • 2
  • 36
  • 75
  • Thanks, this helps. But also, I discovered that the silverlight forums seem to be a better resource for WCF-RIA questions. – GarethOwen Dec 10 '11 at 21:35