on 10-04-2016 7:59 AM
We just upgraded our SBO to version 9.2 from 9.0 and the code that connects to the company (di api) is no longer working. I still use the SAP9.0 UI+DI API dlls in C# (is there a newer version?).
The code that would connect:
public class SAPDIDao
{
protected SAPbouiCOM.Application SBOApp = null;
protected Company oCompany = null;
public SAPDIDao(SAPbouiCOM.Application SBOApp)
{
this.SBOApp = SBOApp;
SetConnectionContext();
int errorCode = oCompany.Connect();
if (errorCode != 0) <-- GOT AN ERROR
{
string lastException = "";
oCompany.GetLastError(out errorCode, out lastException);
Console.WriteLine("Company connect error: "+errorCode+", msg: "+lastException); <--- ERROR Printed here
}
}
private int SetConnectionContext()
{
int setConnectionContextReturn = 0;
string sCookie = null;
string sConnectionContext = null;
oCompany = new Company();
sCookie = oCompany.GetContextCookie();
sConnectionContext = SBOApp.Company.GetConnectionContext(sCookie);
if (oCompany.Connected == true)
{
oCompany.Disconnect();
}
setConnectionContextReturn = oCompany.SetSboLoginContext(sConnectionContext);
return setConnectionContextReturn;
}
}
It worked before, but now I get an error:
Company connect error: -131
(My message is in Hungarian, so I translated it): Connection to the License service did not succeed. The License service's address is invalid or the License service stopped running or not responding.
I can log into SBO an everything looks fine, so I don't think the License server is stopped.
Edit: I also cleared the temp, deleted the %temp%\SM_SBO_DLL dir, rebuilded the project (after clean), restarted both applications, running them both with Administrator rights.
Hi Szabolcs,
1. Check if this file exists : C:\*\SAP\SAP Business One DI API\Conf\b1-local-machine.xml
If it exists, then rename file "C:\*\SAP\SAP Business One DI API\Conf\b1-local-machine.xml" to “b1-local-machine.xml.original”
2. Copy the file from here
"C:\*\SAP\SAP Business One\Conf\b1-local-machine.xml"
to
"C:\*\SAP\SAP Business One DI API\Conf\b1-local-machine.xml"
For more info, double check the SAP note https://launchpad.support.sap.com/#/notes/0001658707
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Szabolcs,
There is a new version yes, but it's not mandatory to switch. Your code should still connect, especially since it connected in the past.
Since you made the upgrade did you restart the machine?
Pedro Magueija
If this answer was helpful or correct consider marking it as such.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Szabolcs,
Have a look here: https://scn.sap.com/thread/1209255
If all else fails, try re-installing the ServerTools.
Pedro Magueija
If this answer was helpful or correct consider marking it as such.
I don't have a ServerTools folder, but the license manager is running on the server. Other Addons (that are already installed on the server) are just running fine, so I guess something in my code should be wrong. Where can I get the new SDK? The 9.2 installer had an x86 SDK installer, I uninstalled what I had and installed that, yet I only have 9.0 assemblies in my visual studio.
Hi Szabolcs,
Note that the title of the old interops, are 9.0 but their file version is 9.2.
You should have the new references, but they are located in the Assemblies section in visual studio.
Before you go ahead, have a look here: License server name asked every time on login | SCN (last post)
Since you re-installed B1 perhaps the settings are inconsistent (one with IP and one with machine name)?
Pedro Magueija
If this answer was helpful or correct consider marking it as such.
I am not the one who did the server upgrade, but we used the server ip before, but now we can only list the databases if the server name is selected.
I tried it with the 9.2 assemblies, but same error.
What I don't really understand is, how does logging in with server name or IP affects my addon? My addon will only work if the user logs in with ip? The code looks self explanatory, It should not handle cases like this (i think).
Hi Szabolcs.
It happened that I just encountered the same error, It was working in the morning and suddenly this error.
I tried a lot of things and the one worked for me was :
restart VISUAL STUDIO.
not sure if it should work for you though as many factors could cause this error.
And by the way, since SBO 9.1, there is this file :
C:\Program Files (x86)\SAP\SAP Business One SDK\Lib\SAPBusinessOneSDK.dll
You should reference this instead of SAPBobsCOM and SAPBouiCOM
The new dll is a proxy to the two APIs.
Plus point is :
1. No need to re-reference SBO APIs when upgrading the SBO
2. Works for both 32 and 64 bit
Regards
Edy
Hi Szabolcs,
It's not about your code, but about how B1 finds the license server. Having different settings might cause issues.
Much like everything in SAP B1, it's just a hint, it may not be the cause for your issue.
Pedro Magueija
If this answer was helpful or correct consider marking it as such.
Hi Szabolcs,
The connection string is passed via the command line when an add-on is in "production".
If you are using the development connection string (provided with the documentation), you could have issues with the add-on connecting.
One more thing can you ping the license server (servername:30000)?
Pedro Magueija
If this answer was helpful or correct consider marking it as such.
Before you go ahead, have a look here: License server name asked every time on login | SCN (last post)
I just realized that your link was the solution, thanks!
Hi Szabolcs,
No worries, glad it worked out in the end.
Cheers.
Pedro Magueija
If this answer was helpful or correct consider marking it as such.
User | Count |
---|---|
89 | |
7 | |
6 | |
3 | |
3 | |
3 | |
3 | |
3 | |
3 | |
2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.