Web services and arrays in LotusScript
Recently, I was working on an agent that used a web service to export data. Now, I don’t know if you noticed, but for some reason, consuming services is way easier in LotusScript than it is in Java. As far as I know, and I could be wrong, you need to import Axis in Java to do anything with a Web service consumer.
In LotusScript, consuming web services is plain easy. You just import the WSDL, which can be located either on your file system or directly on the web and you are good to go.
Sounds too good to be true? It is. There are couple of limitations, that will make you swear like a gypsy on a bad day.
- Variables and function names must not be longer than 46 characters.
- There is no way in hell your code will know how to process an array, that was passed as a result.
Don’t get me wrong. This is most certainly not a problem when Web service itself is pretty simple. However, it becomes an annoyance when you start using complex 3rd party Web services.
How to get around those?
For 3rd party services, I guess it depends from case to case. For one web service, we actually had to come up with adapter web service written in C#, that would translate interfaces needed to something that could be used in LotusScript. I guess we could have used Java, but that caused some memory leaks.
If you are doing your own service, just make sure, that you don’t return any arrays and that your variables are according to the consensus of LotusScript and youa re good to go.
March 2nd, 2010 at 13:54
What do you send instead of an array? XML?
March 3rd, 2010 at 08:32
Well, that is certainly one option, although it seems like a hell of a workaround. I had no problems returning Variant. This translates to XSD_AnyType.
March 3rd, 2010 at 14:30
Re. importing Axis…
I am using Dom 8.5.1 and consuming a web service provided by a company in UK called ViaPost. I am turning Notes docs into pdfs, then submitting the pdf to ViaPost, who then send it as a letter…very useful.
I ran into the 46 char var name when importing into LS, I then importe WSDL into Java web service, I didn’t need to import anything else, that was it.
May 21st, 2010 at 15:49
What kind of data-type is preferred, as return value (for complex and large mounds of data)? I tried Datasets and Lists. But i ran into your described problem. (I am using Lotus Designer 7…)
May 24th, 2010 at 22:37
What you can do is use a class. Even if you only need a Type. Types cannot be passed, but classes can. So basically, if you want to return complex data, create a class and pass it as a result of a function.