Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » EGL Development Tools » Java generation error when calling service.
Java generation error when calling service. [message #893555] Wed, 04 July 2012 14:33 Go to next message
Steve Doody is currently offline Steve DoodyFriend
Messages: 4
Registered: June 2012
Junior Member
Hi,

I'm experimenting with EGL and making calls to IBM i commands.

I would like to separate the actual implementation of the EGL calls to the IBM i commands from any client programs.

I've created a project called EGLCommon which contains 2 packages; libraries and services.

The libraries package contains an EGL library which is made up of one function that calls QCMDEXC:

package libraries;

library iLibrary

	function QCMDEXC(input string in, length decimal(15,5) in)	
	  {
	    @Resource{ uri = "binding:IBMi" },
		@IBMiProgram {
			programName = "QCMDEXC",
			libraryName = "/QSYS.LIB",
			parameterAnnotations = [
				@StructText {length = 80},
				@StructPackedDecimal {}
			]
		}
	  }
	end
end


The services package contains an EGL service which is a function called runCmd which calls iLibrary.QCMDEXC:

package services;

import libraries.*;

service iService
	
	function runCmd(command string in)
		iLibrary.QCMDEXC(command, characterLen(clip(command)));
	end

end


The deployment descriptor in this project contains an IBM i binding pointing to our i5.

I've then created another project called EGLClient. This contains a program called TestClient which calls runCmd. The EGLCommon project is in the EGL build path and I've created a REST binding to iService.

The code for TestClient is:

package client;

import services.*;

program TestClient
 
	function main()
		iServicesSvc IHttp?{@Resource {uri="binding:iService"}};
		command string = "SNDMSG MSG(HELLO) TOUSR(TOMYUSR)";
		call iService.runCmd(command) using iServicesSvc;
	end
	
end


The EGLCommon project has generated OK but I'm getting java generation errors on the EGLClient project. The errors I get are:



    com.ibm.javart cannot be resolved to a type
    ezeProgram cannot be resolved
    ezeProgram cannot be resolved to a variable
    iService cannot be resolved to a variable
    Type mismatch: cannot convert from String to JavartSerializable


So, is it not possible to have this level of separation, or am I missing something from the EGLClient project?

I'm using EDT milestone 3 (Version: 0.8.1.v201206280959-1Ds7rFmiVCcYWyaY3NTPd8hSh)

Thanks
Steve
Re: Java generation error when calling service. [message #893785 is a reply to message #893555] Thu, 05 July 2012 13:56 Go to previous messageGo to next message
Joseph Vincens is currently offline Joseph VincensFriend
Messages: 31
Registered: December 2011
Location: Prospect CT
Member
Hi Steve,

An EGLClient project is a Web 2.0 client project. Programs are not supported in JavaScript generation (Web 2.0).

You could move the program to the service package, but service invocation is not supported from Java Gen.

I'd suggest moving the program to the service package and then make the following change:
program TestClient
 
	function main()
		command string = "SNDMSG MSG(HELLO) TOUSR(TOMYUSR)";
		iLibrary.QCMDEXC(command, characterLen(clip(command)));
	end
	
end


You can then Run the program as an EGL Java Application.

regards,
Joe
Re: Java generation error when calling service. [message #893833 is a reply to message #893785] Thu, 05 July 2012 15:48 Go to previous messageGo to next message
Steve Doody is currently offline Steve DoodyFriend
Messages: 4
Registered: June 2012
Junior Member
Hi Joe,

Thanks for your help, I've got this working how I want now. Just to clarify and maybe help someone else if they stumble across a similar problem.

I can create a project (Common) that contains a library of functions and wrap these functions in a service (dedicated or rest). The DD for this project doesn't need to specify a binding to the IBM i or any resource bindings for the services.

I can then create an RUI client project. The client can access the library function via the service (import services.*). The RUI client must specify the IBM i connection in the DD, a resource binding to the service and include the Common project on the EGL build path. This project will only generate to Javascript.

I can also create a Basic client project that contains an EGL program. The EGL program can only access the library functions directly and cannot access them via a service of any type (import libraries.*). The DD for this project must have a binding to the IBM i and include the common project on the EGL build path. This project will only generate to Java.

Is that about right?

Thanks
Steve


Re: Java generation error when calling service. [message #893871 is a reply to message #893833] Thu, 05 July 2012 18:44 Go to previous message
Joseph Vincens is currently offline Joseph VincensFriend
Messages: 31
Registered: December 2011
Location: Prospect CT
Member
Hi Steve,

What you said will work, however, I would make 1 change to make it more modular. I would put the IBMi resource bindings in the DD, in the project that contains the library. Then the bindings only reside in 1 place and as you said you can create multiple client projects. This way there is no need for the client to have any IBMi information.

regards,
Joe
Previous Topic:EDT 0.8.1 Milestone 3 (of 3) is available
Next Topic:JavascriptGen error in Handler when ref server
Goto Forum:
  


Current Time: Thu Apr 25 13:01:41 GMT 2024

Powered by FUDForum. Page generated in 0.02707 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top