Showing posts with label lotus and java. Show all posts
Showing posts with label lotus and java. Show all posts

Monday, September 08, 2014

Issues when importing WSDL files into Web Service Consumer

Recently I faced up with WSDL which I couldn't import into Web Service Consumer. Our consumer worked well from last 5 years but it is a long period and during that time our Service Provider was updated a lot so we decided to update our Consumer as well. Guess everything went fine?
No WSDL was returned from the URL
I simply created new Consumer in Domino Designer, set URL to our WSDL, picked Java and clicked OK. Oops...
Domino Designer
No WSDL was returned from the URL:
The requested operation failed: no import files
Wow, thought I :) let's try to import WSDL as Lotus Script then (just to see if it is not related to Java)
IBM Domino Designer
The requested operation failed: no import files
Name too long
Hey, what? This WSDL is used by many another applications without any issues, what is going on!? I downloaded WSDL as file to my local PC and tried to import it as Lotus Script again. This time it went fine (except issues with Name too long). Well, great news anyway, at least everything works when WSDL is a local file.

The Web Service implementation code generated from the provided WSDL could not be compiled, so no design element was created
Ok, it worked for Lotus Script, let's set now Java...
IBM Domino Designer
The Web Service implementation code generated from the provided WSDL could not be compiled, so no design element was created.  Please correct the WSDL and try again.  The errors are located in the following file:: C:\Users\dpa\AppData\Local\Temp\notes90C43B\47238811.err
OK, it's time to blame Designer and IBM! Why it is so difficult just to import WSDL? All another application that use WSDL from our server did not have such issues. It's just not fair :). Found a file with error and quite typical line: java.lang.OutOfMemoryError: Java heap space. I knew what to do, I increased HTTPJVMMaxHeapSize and JavaMaxHeapSize to 512M, restarted Designer/Notes and tried again. Worked well! I restored original values to HTTPJVMMaxHeapSize and JavaMaxHeapSize after that.
The system is out of resources.
Consult the following stack trace for details.
java.lang.OutOfMemoryError: Java heap space
at lotus.notes.internal.IDEHelper.compile(Unknown Source)
Simple thing however it costed few hours for me. Hope it will save some time for other people.

Tuesday, July 03, 2012

ViewEntry and Show multiple values as separate entries

When your view has column with option 'Show multiple values as separate entries' and you use ViewEntry to read data from that column you will have a problem. Result of your getColumnValues() can be different, f.x. in 1 case it can be 'Vector' and in another case 'String'. It depends if entry was really split on few entries because of multi-value. I've lookup around and found this issue already reported on IBM ~3 years ago (IBM whats up?)

Full description of problem

Here is a solution I made
Vector v = entry.getColumnValues();
Object o = v.get(0);
String title = "";
if (o.getClass().equals(String.class)) {
 title = (String) o;
else if (o.getClass().equals(Vector.class)) {
 Vector tmp = (Vector)o;
 title = (String) tmp.get(0);

Thursday, February 02, 2012

Hope to see this feature at next version of DDE

That is actually how it should be instead of keeping everything inside of Library. Do you agree? It would solve the problem I described in my previous post which is about working with java libraries in LDD.

Hey, IBM please do that and make our team happy :)

How do you work with Java libraries in LDD?

Hi guys,

We have faced up (actually long time ago) with problem which is related to Java libraries. Back-end of our applications on Domino is written on Java fully. Each Java library has ofc own classes and packages. However LDD allows to work only 1 person with 1 library at same time and it is really painful for us as we have to wait till another developer finish his job. Does anybody know if there is a way (SVN?) which may resolve our problem?
What we really would like to get - possibility to sync java classes with library, so developers would be able to work with same library and just sync changes to it.
We need something like on screen: java library transform into files and each of file represent own class. So we would sync it in both side...

Any help would be appreciated :)

Thursday, June 23, 2011

How to add much more debug information to your Java Project

Links to this post
Go to Run\Configuration manu and switch to tab Arguments and add:,handshake (as I did on screen) and you will get much more debug information that could be useful for you.

Tuesday, November 09, 2010

Very nice SOAP client (java)

Links to this post
Here is link to nice java soap client
I've implement also LS2J approach

here is my example. There are some enhancements need to do, but anywhere this also works fine.

Java library


public class ECWebservice {
String cResponse;
String wsurl;
String msg;
String contentType;

public ECWebservice(String init_url) throws IOException {
wsurl = init_url;
msg = "";
contentType = "text/xml; charset=utf-8";
cResponse = "";

public String GetResponce() {
return cResponse;

public void SetContentType(String init_contenttype) {
contentType = init_contenttype;

public boolean Send(String init_msg) {
boolean result = true;
try {
msg = init_msg;

// Create the connection where we're going to send the file.
URL url = new URL(wsurl);
URLConnection connection = url.openConnection();
HttpURLConnection httpConn = (HttpURLConnection) connection;

String SOAPAction = msg;

byte[] b = SOAPAction.getBytes();

// Set the appropriate HTTP parameters.
httpConn.setRequestProperty( "Content-Length", String.valueOf(SOAPAction.length()));
httpConn.setRequestProperty("Content-Type", contentType);
httpConn.setRequestProperty("SOAPAction", SOAPAction);

// Everything's set up; send the XML that was read in to b.
OutputStream out = httpConn.getOutputStream();

// Read the response and write it to standard out.
InputStreamReader isr = new InputStreamReader(httpConn.getInputStream(), "utf-8");
BufferedReader in = new BufferedReader(isr);

String inputLine;
while ((inputLine = in.readLine()) != null) {
cResponse += inputLine;
} catch(Exception e) {
cResponse = "Main: Exception occured - check Java Debug Console";
result = false;

return result;

LS2J library

Option Public
Option Declare

Use "webservice.core"
UseLSX "*javacon"
Class ECWebservice
responce As string
connection As string
contentType As string

Sub New(connection_url As string)
connection = connection_url
contentType = "text/xml; charset=utf-8"
End Sub

Public Property Get GetResponce As string
GetResponce = responce
End Property

public Property Set SetConnection
connection = SetConnection
End Property

Public Property Set SetContentType
contentType = SetContentType
End Property

Function SendXMLRequest(xmldata) As Boolean
On Error Goto errorproc

'** everything we'll need to access our Java classes
Dim jSession As New JavaSession
Dim jClass As JavaClass
Dim jObject As JavaObject

'** get the IGWebservice class and instantiate an instance of it
Set jClass = jSession.GetClass("ECWebservice")

'** version of CreateObject and init with path to WSDL)
Set jObject = jClass.CreateObject("(Ljava/lang/String;)V", connection)
'** send message and get result: true/false, if true then we got result
If jObject.send(xmldata) Then
me.responce = jObject.GetResponce()
End If

SendXMLRequest = True

Exit Function
MsgBox "Error #" & Err & " on line " & Erl & " in function " & Lsi_info(2) & " : " & Error, 48, "Runtime error"
Resume endofsub
End Function

End Class

Friday, September 10, 2010

Need to zip file with password in Lotus Notes?

Links to this post
I've task where we need to compress and protect attachments and some log files.
I did not look in Lotus Script area at all (as I'm sure it would be not possible or to difficult to do such thing). So I started to look for free RAR/ZIP Java libraries that will have what I need (compress and password).
I was surprised a bit, RAR does not have such API at all, but ZIP has already built in Domino library that allow us to zip files but... not to set password (at least I did not find).
So after couple minutes in google I've found only one free Java library that could zip files with password:
There were no problems during implementation, library is well described.
Java, Java and Java :)

Saturday, January 09, 2010

iText announced new version of their product 5

Links to this post
I use iText library in some of my LN applications, so I check their site sometimes for updates. Today I found that they announced new version - iText 5 (last one was 2.1.7).
I tried to update my code with that library, but I had to do some changes before, because new library has some changes in naming.

Anywhere it is really good that iText did not stop and moving forward, that's cool. Good job

Monday, October 05, 2009

process image in LN (JPEG and PNG)

Links to this post
I was facing with problem when I got task to process image *.jpg and *.png (get their size and resize big image).

So let me put some code here to show my approach (it is only first version and it means that there are still many issues).

I used LS2J approach.

So here is my Java Library (core):

Option Public
Option Declare

Use "ImageLib"


import java.awt.AlphaComposite;
import java.awt.Graphics2D;
import java.awt.RenderingHints;
import java.awt.image.BufferedImage;
import javax.imageio.ImageIO;

public class JpgImage {
BufferedImage originalImage = null;
String fileName = "";
int type = 0;

public JpgImage (String m_fileName) throws IOException {

fileName = m_fileName;

originalImage = File(fileName));
type = originalImage.getType() == 0? BufferedImage.TYPE_INT_ARGB : originalImage.getType();

}catch(IOException e){

public int ImgResize (int w, int h)
String newFileName = "";
String imgFormat = "";
newFileName = fileName.replace(".", "-thumb.");

if(type == 5) {
imgFormat = "jpg";
else {
imgFormat = "png";

BufferedImage resizeImage = resizeImage(originalImage, type, w, h);
ImageIO.write(resizeImage, imgFormat, new File(newFileName));

}catch(IOException e){
return 0;

public int getWidth (){
return originalImage.getWidth();

public int getHeight () {
return originalImage.getHeight();

private static BufferedImage resizeImage(BufferedImage originalImage, int type, int w, int h){
BufferedImage resizedImage = new BufferedImage(w, h, type);
Graphics2D g = resizedImage.createGraphics();
g.drawImage(originalImage, 0, 0, w, h, null);

return resizedImage;

LS code.

Option Public
Option Declare

Use "ImageTest "

Uselsx "*javacon"

function add/change image (it creates Thumbnail version of original image with max size 120x120)
add image to Body and BodyThumbnail fields
On Error Goto processError

Dim jpgClass As JavaClass
Dim jpgImage As JavaObject
Dim jpgImageThumbnail As JavaObject
Dim jError As JavaError

Dim w As New NotesUIWorkspace
Dim uidoc As NotesUIDocument
Dim uidocnew As NotesUIDocument
Dim doc As NotesDocument
Dim body As NotesRichTextItem
Dim bodyThumbnail As NotesRichTextItem
Dim filepath As Variant
Dim vFileNameThumbnail As Variant
Dim tmp As String
Dim filename As String
Dim filenameThumbnail As String
Dim picH As Integer, picW As Integer
Dim picHT As Integer, picWT As Integer
Dim debug As Boolean

debug = True
If debug Then Print Lsi_info(2) & " starts at: " & Now

Set uidoc = w.CurrentDocument
Set doc = uidoc.Document

filepath = w.OpenFileDialog(False, "Please select iamge", "JPG|*.jpg|GIF|*.gif|PNG|*.png|", "", "")

If Not Isarray(filepath) Then Exit Sub

filename = filepath(0)

'** everything we'll need to access our Java classes
Dim jSession As New JavaSession

'** get the JpgImage class and instantiate an instance of it
Set jpgClass = jSession.GetClass("JpgImage")
Set jpgImage = jpgClass.CreateObject("(Ljava/lang/String;)V", fileName)

'get width and height of images
picH = jpgImage.getHeight()
picW = jpgImage.getWidth()
Call doc.ReplaceItemValue("picH", picH)
Call doc.ReplaceItemValue("picW", picW)

'attach image to as it is to body field
Call doc.RemoveItem("Body")
Set body = New NotesRichTextItem(doc, "Body")
Call body.EmbedObject (EMBED_ATTACHMENT, "", filename)

' new image
If picH > 120 Then
picHT = 120
picHT = picH
End If

If picW > 120 Then
picWT = 120
picWT = picW
End If

Call jpgImage.imgResize(picWT, picHT) '** shrink to 50% of the original size

If Instr(filename, ".gif") Then
Dim original_name As String
original_name = Replace(filename, ".", "-thumb.")
fileNameThumbnail = Replace(filename, ".gif", "-thumb.png")
Name original_name As fileNameThumbnail
fileNameThumbnail = Replace(filename, ".", "-thumb.")
End If

Call doc.ReplaceItemValue("picHT", picHT)
Call doc.ReplaceItemValue("picWT", picWT)

'attach thumbnail version of image
Call doc.RemoveItem("bodyThumbnail")
Set body = New NotesRichTextItem(doc, "bodyThumbnail")
Call body.EmbedObject (EMBED_ATTACHMENT, "", fileNameThumbnail)
Kill fileNameThumbnail

doc.SaveOptions = "0"
Call uidoc.Close(True)

Set uidocNew = w.EditDocument(True, doc, , , , True)
Delete uidoc
Call uidocNew.Document.RemoveItem("SaveOptions")

Call uidocnew.Refresh

If debug Then Print Lsi_info(2) & " starts at: " & Now

Exit Sub
'** report any errors we get and keep on going
Set jError = jSession.getLastJavaError()
If (jError.errorMsg = "") Then
Print "Notes Error at line " & Erl & ": " & Error$
Print "Error at line " & Erl & ": " & jError.errorMsg
End If

Msgbox Error$

Resume basta

End Sub

btw, then I found more interesting solution (at least I think so :-D) on

Tuesday, January 20, 2009

Transfer file to WebService and Encode/Decode base64 string

Links to this post
I had a task where I should give opportunity to user send file to WebService written on Java. File always should come as decode base64 string, and in WebService I should decode string to normal (it should be DXL content as result) and then import it in a special database, so I had small problem with decode/encod (dont know why but it was happen). So here this simple exmplae how to do it

public class Base64Test {
public static void main(String[] args) throws IOException {
String str = "my string";

String s = new BASE64Encoder().encode(str.getBytes("UTF-8"));
byte[] bytes = new BASE64Decoder().decodeBuffer(s);
String result = new String(bytes, "UTF-8");

Friday, April 18, 2008

View applet - ext. problem.

Links to this post
Nothing news to be honest, but for me it happened first time. I had a task with View's applet, it didn't work correctly in several users and on my PC. It was simple applet, you can see it below my text.

the problem was in cab ext. I found that I have to switch off JRE support in my browser, or just to modify the ext. to jar.

Sunday, February 18, 2007

Difference between “garbage collector” in Lotus Notes/Domino and Java

Links to this post
As you know, when you work with Lotus Notes/Domino as developer, you never think about deleting objects. I mean, when you create a new NotesDocument you never delete it because Lotus Notes/Domino do it automatically. It’s really good feature if you work with Lotus Script, but when you write on Java, for example, Agent on java, you must always use method recycle() for memory release. I want admit, when you call method recycle() for object_A, then method recycle() automatically call for any objects that are created from object_A. It means that calling recycle() on a database object will also do recycle() for all objects obtained through this database.

It is important to remember that only one reason for calling recycle() is to release memory when you write an on java.

Wednesday, February 14, 2007

Notes.jar and Eclipse

Links to this post
Yesterday I tried to connect Notes.jar (java library in Lotus Notes) to my simple Java application in Eclipse 3.2. I had some problems with it. When I added Notes.jar and tried to compile my project, debugger gave me an error. I began to search information about it and found interesting article. A problem was very simple, I didn’t think about “Environmental variables”, so when I added them, my application was compiled!