Hi,
I created the simpliest web service ever made in Java… here’s the code :
public class ComplexDataType {
public String s;
}
import lotus.domino.*;
import lotus.domino.types.*;
public class test {
public double returnDouble1() {
double d = 45.667;
return d;
}
public double returnDouble2(double d) {
return d;
}
public String returnString1() {
String s = "Hello World!";
return s;
}
public String returnString2(String s) {
return s;
}
public ComplexDataType returnString3() {
ComplexDataType c = new ComplexDataType();
c.s = "Good Night!";
return c;
}
}
I then created a LotusScript script library to consume this web service… here’s the code :
%INCLUDE “lsxsd.lss”
Class ComplexDataType As XSD_ANYTYPE
Public s As XSD_STRING
Sub NEW
End Sub
End Class
Class Test As PortTypeBase
Sub NEW
Call Service.Initialize ("UrnDefaultNamespacetestService", _
"testService.Domino", "http://intranet11-db2.canammanac.com:80/IntraWeb/GPS.nsf/test?OpenWebService", _
"Test")
End Sub
Function returnDouble1() As Double
Let returnDouble1 = Service.Invoke("returnDouble1")
End Function
Function returnDouble2(d As Double) As Double
Let returnDouble2 = Service.Invoke("returnDouble2", d)
End Function
Function returnString1() As String
Let returnString1 = Service.Invoke("returnString1")
End Function
Function returnString2(s As String) As String
Let returnString2 = Service.Invoke("returnString2", s)
End Function
Function returnString3() As ComplexDataType
Set returnString3 = Service.Invoke("returnString3")
End Function
End Class
Notice that all String from Java are set as String in LotusScript except for my String in my ComplexDataType class.
All double from Java are set as double in LotusScript as well.
Now here is the code of five simple agents and their result.
Agent 1…
Sub Initialize
Dim ws As New test()
Dim d As Double
d = ws.returnDouble1()
Print Str(d)
End Sub
… returns :
“…Invalid double value passed to web service Test…”
Agent 2 …
Sub Initialize
Dim ws As New test()
Dim d As Double
d = ws.returnDouble2(-70.333)
Print Str(d)
End Sub
… returns :
“The web service test method returnDouble2 has returned a fault”
(return same error as Agent 1 is -70.333 is specified)
Agent 3 …
Sub Initialize
Dim ws As New test()
Dim s As String
s = ws.returnString1()
Print s
End Sub
… returns “Hello World!” which is correct.
Agent 4 …
Sub Initialize
Dim ws As New test()
Dim s As String
s = ws.returnString2("Good Morning")
Print s
End Sub
… returns “Goog Morning” which is correct.
Agent 5 …
Sub Initialize
Dim ws As New test()
Dim c As ComplexDataType
Dim s As String
Set c = ws.returnString3()
s = c.s.getValueAsString()
Print s
End Sub
… returns “Good Night!” which is correct… but I had to use “getValueAsString”.
So I’m a bit confused.
I don’t know why Domino is sometimes using a XSD:STRING type instead of a plain String.
But the most important thing is that I don’t know why double are causing this error.
I just wanted to share my tests… in the hope that someone might have a solution to this ![]()
In my specific application, my web service function need to return a class containing some String and some double.
Thanks