Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
API integration with .net Web application
11-12-2017, 06:00 PM
Post: #1
API integration with .net Web application
Hello all

Am quite new to webErp, I have an in-house developed .net application which I want to communicate with webErp through available XMLRPC APIs. Use cases will be like posting a transaction entry from the .net web application to webErp.
Could you provide me with some reference links or starting points to achieve this?

Thanks in advance

Regards
Sume MS
Find all posts by this user
Quote this message in a reply
11-12-2017, 06:28 PM
Post: #2
RE: API integration with .net Web application
There is an API tutorial I wrote in the manual which you should have as part of your implementation.

Tim
Visit this user's website Find all posts by this user
Quote this message in a reply
11-12-2017, 06:41 PM
Post: #3
RE: API integration with .net Web application
Thanks Tim for quick response
I could find the API integration from PHP which is pretty straightforward using XML-RPC.
Do you have any .net library suggestions?

Regards
Sume MS



(11-12-2017 06:28 PM)falkoner Wrote:  There is an API tutorial I wrote in the manual which you should have as part of your implementation.

Tim
Find all posts by this user
Quote this message in a reply
11-12-2017, 06:55 PM
Post: #4
RE: API integration with .net Web application
I don't have experience with .net myself, but this looks like a good starting point http://xml-rpc.net/

It seems fairly current and to have decent documentation.

Tim
Visit this user's website Find all posts by this user
Quote this message in a reply
11-12-2017, 07:19 PM (This post was last modified: 11-12-2017 07:50 PM by s4m3shms.)
Post: #5
RE: API integration with .net Web application
Thanks Tim

Definitely, this would be a great starting point.

Regards
Sume MS
One more question,

Is it possible to have multiple databases in the api/api_php.php if I want to work on multiple companies from the application?

Regards
Sume MS

Sorry I found this is listed as a limitation of the design. Since it is mandatory for my application to work with multiple companies at the same time, I am thinking to create an api that can modify the api_php.php with required corresponding database name before every transaction.
Any comments?

regards
Sume MS
Find all posts by this user
Quote this message in a reply
11-12-2017, 09:33 PM
Post: #6
RE: API integration with .net Web application
Hi, the problem with modifying the api is always to keep compatibility with existing applications that use it.

I would do something like the following (Nb I haven't tried this, so you may need to experiment a little)

Change each function call like this:

function InsertBranch($BranchDetails, $user, $password) becomes function InsertBranch($BranchDetails, $user, $password, $database_name='')

Then each function has a line

$db = db($user, $password);

which needs to be

$db = db($user, $password, $database_name);

Then within api_php.php the function declaration becomes:

function db($user, $password, $database_name) {
if (!isset($_SESSION['AccessLevel']) or $_SESSION['AccessLevel'] == '') {
// Login to default database = old clients.
if ($user != '' and $password != '') {
global $api_DatabaseName;
if ($database_name != '') {
$api_DatabaseName = $database_name;
}
$rc = LoginAPI($api_DatabaseName, $user, $password);
if ($rc[0] == UL_OK) {
return $_SESSION['db'];
}
}
return NoAuthorisation;
} else {
return $_SESSION['db'];
}
}

As I said I haven't actually tried it, but would be interested to know if it works out :-)

Tim
Visit this user's website Find all posts by this user
Quote this message in a reply
11-13-2017, 04:08 PM (This post was last modified: 11-13-2017 04:45 PM by s4m3shms.)
Post: #7
RE: API integration with .net Web application
Hi
Interesting idea, I should give it a try and would let you know.

Thanks very much
Regards
Sume MS

(11-12-2017 09:33 PM)falkoner Wrote:  Hi, the problem with modifying the api is always to keep compatibility with existing applications that use it.

I would do something like the following (Nb I haven't tried this, so you may need to experiment a little)

Change each function call like this:

function InsertBranch($BranchDetails, $user, $password) becomes function InsertBranch($BranchDetails, $user, $password, $database_name='')

Then each function has a line

$db = db($user, $password);

which needs to be

$db = db($user, $password, $database_name);

Then within api_php.php the function declaration becomes:

function db($user, $password, $database_name) {
if (!isset($_SESSION['AccessLevel']) or $_SESSION['AccessLevel'] == '') {
// Login to default database = old clients.
if ($user != '' and $password != '') {
global $api_DatabaseName;
if ($database_name != '') {
$api_DatabaseName = $database_name;
}
$rc = LoginAPI($api_DatabaseName, $user, $password);
if ($rc[0] == UL_OK) {
return $_SESSION['db'];
}
}
return NoAuthorisation;
} else {
return $_SESSION['db'];
}
}

As I said I haven't actually tried it, but would be interested to know if it works out :-)

Tim


Hi

As a quick workaround, if I keep multiple folders for APIs with different databases, would it work?
For example:
http://domain.com/webERP/api-company1/api_xml-rpc.php
http://domain.com/webERP/api-company2/api_xml-rpc.php
http://domain.com/webERP/api-company3/api_xml-rpc.php

Regards
Sume
Find all posts by this user
Quote this message in a reply
11-13-2017, 07:16 PM
Post: #8
RE: API integration with .net Web application
I think it is only api_php.php and api_xml-rpc.php that need a new version. So your client points to api_xml-rpc_1.php which in turn points to api_php_1.php etc, so you shouldn't need separate folders.

Again I haven't actually tried it, but it should work.

If my original solution works it is better because it is more generic and so could be put into the main line code.

Tim
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)