Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8882689
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T20:38:28+00:00 2026-06-14T20:38:28+00:00

I have been consuming a webservice with a javascript library and accessing the webservice

  • 0

I have been consuming a webservice with a javascript library and accessing the webservice via ExternalInterface calls back and forth from C# to Javascript and vice-versa. I no longer want to do this and am almost finished re-writing the library in C#. Most of it is working fine.

Unfortunately, there are a series of (static) methods in the javascript that I am finding very, very difficult to replicate in C#. Methods that have operators like this, for example:

 static LongEmul dCb (LongEmul b) {
        var c = ~b.l + 1 & 4194303;
        var d = ~b.m + (c == 0 ? 1 : 0) & 4194303;
        var e = ~b.h + (c == 0 && d == 0 ? 1 : 0) & 1048575;
        return tBb(c, d, e);
    } 

This is my attempt at refactoring the javascript: not very good. How can I create some kind of DOM or Javascript parser object on startup, write the javascript methods or full class to this object, and then call methods in the object with parameters from c# and receive return values back. I know this sounds a bit like the ExternalInterface approach I’m replacing, but I’m intrigued to find out if a method in Javascript syntax can be called from C# in any way.

I’d appreciate any help at all with this.

Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T20:38:31+00:00Added an answer on June 14, 2026 at 8:38 pm

    You may want to use Jint, a JavaScript interpreter for .NET.
    Jint allows you to feed it with some JavaScript code and not only interprets it, but even lets you call JS methods directly from your .NET code.

    From the Jint website:

    script= @"
      function square(x) { 
        return x * x; 
      };
    
      return square(number);
      ";
    
    var result = new JintEngine()
      .SetParameter("number", 3)
      .Run(script));
    
    Assert.AreEqual(9, result);
    

    Update

    Calling a specific JS method (from the docs):

    JintEngine jint = new JintEngine();
    jint .Run(@"
      var f = function (x, y) {
        return x * y;
      }
    ";
    
    Console.WriteLine(jint.CallFunction("f", 2, 3)); // Displays 6
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a WCF service that I am consuming, and have been doing well
I have been consuming a service for some time in development, and have been
I have a problem that has been consuming me for days. I have a
I have been reading the book of Windows via C/C++. In chapter 8, page
I have been working in trying to optimize a webservice that is required to
I have been catching up with MVC4 Web API and WCF Data Service. From
Recently, i have been handed over with an ash report from DBA. To me
Let's say we have a time consuming query described below : (SELECT ... FROM
I have been developing an app for iPad and consuming the Web Service in
I have been tasked with obtaining a response from a SOAP request, using classic

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.