SDK - My Experience

This forum is dedicated to the JobBoss SDK (Software Development Kit), it's usage and implementation issues.
Post Reply
User avatar
Oso Rojo
Site Admin
Posts: 7
Joined: Wed Apr 12, 2017 5:47 pm

SDK - My Experience

Post by Oso Rojo » Mon Apr 17, 2017 7:22 pm

This thread is a chronology of my experience with the JobBoss SDK and its implementation into our operations. The target environment is an ASP .Net website written in C#. I'll explain the application later in the Applications forum. For now I'm taking baby steps and working on a proof of concept.

Starting off I need to get the Jbinterface.exe COM object into the .Net environment. I ran this command in a Command Prompt window with Administrator privileges.

"C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\NETFX 4.0 Tools\tlbimp" "C:\Program Files (x86)\JobBOSS\JBInterface.exe" /out:"C:\Program Files (x86)\JobBOSS\JBRequestProcessorNet.dll"

For the why and how details review this webpage;
https://msdn.microsoft.com/en-us/librar ... s.71).aspx

So now in my JobBoss directory I have a new dll called JBRequestProcessorNet.dll. My .Net project is a console app to keep things as simple as possible. I'm using Visual Studio 2010, this is the version of Visual Studio that creates our intranet.

In the Solution Explorer, open the References group. Right click on References and select Add Reference ... In the Add Reference dialog select COM on the left side. Browse to the folder that contains the new dll you created above. Select the dll and then hit the Add button. Close this dialog box and you should have a reference to the dll above. (Note: You can name this dll something else if you desire.)

Now add a reference to this dll at the top of your code page.
using JBRequestProcessorNet;

Now you can instantiate the JBRequestProcessor like any other object in .Net.
JBRequestProcessorNet.JBRequestProcessor rp = new JBRequestProcessor();

When you try to type this line yourself, the JBRequestProcess is actually JRequstProcessorClass. Based on this post I left off the word "class" at the end.
http://stackoverflow.com/questions/2483 ... 02#4553402
For those that really want details, the MSDN article on the subject is here;
https://blogs.msdn.microsoft.com/mshnee ... e-instead/

One thing to point out here is that the example in the JobBoss program doesn't show that you need a SessionID before you can run a query or update. The sample implies you can run the query off the disk and you are good. This is not true! You have to get a SessionID and embed this into your XML.

So let's see what we have done. My XML looks like this:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<JBXML xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="C:\develop\Dev\D5\JB2K\Wrapper\JBXML.xsd">
	<JBXMLRequest  Session="432453535666767688999000">
		<JobListQueryRq>
			<QueryFilter>
				<IDFilter>A2552012</IDFilter>
			</QueryFilter>
		</JobListQueryRq>
	</JBXMLRequest>
</JBXML>
And this is what my c# code looks like;

Code: Select all

namespace JobBoss_SDK_Test
{
    class Program
    {
        static void Main(string[] args)
        {
            XDocument request = XDocument.Load(@"Y:\Secure\JobBoss\SDK\testRequest.xml");
            string errorMsg = "";

            JBRequestProcessorNet.JBRequestProcessor rp = new JBRequestProcessor();
            string sessionID = "123";
            sessionID = rp.CreateSession("AutoUser", "password", ref errorMsg);
            Console.WriteLine("SessionID is '" + sessionID + "'");
            Console.WriteLine("ErrorMsg is '" + errorMsg + "'");

            var element = from e in request.Root.Elements("JBXMLRequest")
                          where e.Attribute("Session").Name == "Session"
                          select e;
            element.First().Attributes().First().SetValue(sessionID);

            Console.WriteLine(request.ToString());
            Console.WriteLine();
            Console.WriteLine();

            string response = rp.ProcessRequest(request.ToString());

            XDocument xResponse = XDocument.Parse(response);
            
            Console.WriteLine(xResponse.ToString());

            Console.WriteLine("App running.");

            rp.CloseSession(sessionID.ToString());

            Console.ReadLine();

        }    // main() ...

        
    }    // class Program ...
}    // namespace JobBoss_SDK_Test ...
All this does is get the details on a Job named "A2552012" and dump that XML to the screen. This code is not optimized in anyway and has plenty of display statements to see what is happening.

So based on this proof of operations, I have a few concerns. The interface is high volume, but low bandwidth. My this I mean that for serial operations it could move a lot of data. I'm going to be using it in a parallel mode where many people could be accessing the web page that uses this connection at the same time. Each user needs a separate connection which will require a separate seat in JobBoss and a unique username for each. That's not really practical so I'm going to have to create some kind semaphore to keep two web pages from trying to login with the singular account at the same time.

If you have any suggestions questions etc, ask away.

Until my next update,
Oso Rojo

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest