GithubHelp home page GithubHelp logo

Comments (5)

Yortw avatar Yortw commented on June 19, 2024

Hi,

client.Invoke returns the response from the server deserialised as the generic type specified after Invoke, so when it says

    client.Invoke<int>

The <int> part says we expect an integer returned from the server, and the result of the Invoke call will be an integer. You ask for a different type of result by changing the generic argument;

  //Request a string
    var greeting = await client.Invoke<string>
    (
	    "GetGreeting", 
	    new Dictionary<string, object>()
	    {
    		{ "Language", "English" },
	    	{ "Name", "Yort" }
	    }
    ).ConfigureAwait(false);


  //Request a 'customer' where 'Customer' is  class you've defined.
    var foundCustomer = await client.Invoke<Customer>
    (
	    "GetCustomerById", 
	    new Dictionary<string, object>()
	    {
    		{ "Id", 1234 },
	    }
    ).ConfigureAwait(false);

If the server returns an error, or a network error occurs etc. then an exception is thrown. So you either get the type you asked for as the result, or an exception. There is no access to 'underlying data' as the point of the library is to abstract away the transport/protocol details. You either get a valid response from the server or an exception.

I hope that helps.

from spooky.

DNATechAdmin avatar DNATechAdmin commented on June 19, 2024

from spooky.

Yortw avatar Yortw commented on June 19, 2024

Wow, that's annoying they didn't follow the spec. Forks are welcome!

If it's going to be on Github then just in the Readme.md is fine for attribution, thanks 😊 if not then a comment in the main client class or assemblyinfo would be OK.

The more important thing I'd ask is that you make sure the namespaces, assemblies and embedded id's (like any COM guids in assemblyinfo.cs) are changed so that if anybody needs to use both libs together they don't conflict.

Good luck with your project!

from spooky.

Yortw avatar Yortw commented on June 19, 2024

Thinking about this, but it may be possibly for you just to replace the jsob project. The core spooky Lib might still work, if you just replace the bit that does the request/response formatting. I recently did this to support XML-RPC. Maybe this is what you meant though?

from spooky.

DNATechAdmin avatar DNATechAdmin commented on June 19, 2024

from spooky.

Related Issues (2)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.