O$5.2 - Omnis Web Services - debugging
Rudolf Bargholz
rudolf at bargholz.ch
Tue Aug 12 02:38:43 EDT 2014
Hi Paul,
Ok, so it seems you are using the Java interface to communicate with a web service. We did this as well, but it was never really stable, was not that easy to develop and distribute to the clients and we found a more flexible workaround.
The following takes it for granted that you are accessing a soap web service. The basis for a solution would be to first install SoapUI
http://www.soapui.org/
http://sourceforge.net/projects/soapui/files/
SoapUI is a tool which you can use to test web services. Once you get your web service working in SoapUI there is an option to display the RAW data that is the request sent to the web service server. In essence you can take this HTTP POST data/text, use Omnis text methods to build the soap XML that you send to the server, and then we use the WebWin component of Omnis to send the request to the web service. You could even use the native Omnis TCP commands to do this, but we found the WebWin stuff sufficient for our needs and allows us to access https services.
The above took away the need to use Java to communicate with web services. Some web services however have really complex authorization mechanisms where you might be forced to use Java, but most can easily be called using the above mechanism.
Regarding Brian's post regarding the trace log: sys(193) will return the contents of the trace log on the client. Perhaps the trace log on the client will give you more information why the Java stuff is failing.
If you are interested I can post you our web service object in a library (Studio 4.3 non-unicode). Not pretty, but it works.
Regards
Rudolf
-----Ursprüngliche Nachricht-----
Von: omnisdev-en-bounces at lists.omnis-dev.com [mailto:omnisdev-en-bounces at lists.omnis-dev.com] Im Auftrag von Paul Mulroney
Gesendet: Dienstag, 12. August 2014 01:44
An: omnisdev-en at lists.omnis-dev.com
Betreff: Re: omnisdev-en Digest, Vol 76, Issue 10
Hi Rudolph
We purchased the Omnis Web Services component, and used the wizard to create a Web Services object that had the API calls to the web service we wanted to use. It created this object with methods like $item() which was one of the calls we could make to the web service.
Below is a chunk of the code that we used. Note that iJavaObj is an object reference that is created in the $construct by the wizard, and we use the test "iJavaObj.$iswebservice" to determine if it initialised properly. iJavaObj is instantiated in the $construct of the object to point to the Java Jar file that the wizard compiled automatically. In the $construct $iswebservice is set to kTrue. If when we go to call it, that the value is not kTrue, then that means that the Java object didn't initialise properly, and all calls from that point onwards fails.
> Calculate vbIsWebService as iJavaObj.$iswebservice If
> isnull(vbIsWebService)
> Calculate vsResult as "The java object failed to initialise properly."
>
> Else If vbIsWebService<>kTrue
> Calculate vsResult as "The java object failed to initialise properly."
>
> Else
> Do $cinst.$item(vrThisItem) Returns vlResponse
> Do $cinst.$getlasterror Returns vsError
> If vsError<>'' ;; An error occurred, log it!
> Calculate vsResult as con('$item(pickup) returned ',vsError)
> Else ;; No error, test the returned result.
> Calculate vlMethodResponse as vlResponse.1.C1
> Calculate vlReturnPickupItemList as vlMethodResponse.1.C1
> Do ilPickupItemList.$merge(vlReturnPickupItemList)
> If vlReturnPickupItemList.$linecount=0 ;; Returned list was empty. Maybe a comms error? Error at their end?
> Calculate vsResult as '$item(pickup) returned an empty result.'
> Else ;; The returned pickup list wasn't empty. All good!
> Calculate vbDone as kTrue ;; We're done
> End If ;; test returned pickup list
> End If ;; Call to Add to pickup item list
> End if
Hope this helps!
Regards,
Paul.
On 12/08/2014, at 12:00 AM, omnisdev-en-request at lists.omnis-dev.com wrote:
> Message: 4
> Date: Mon, 11 Aug 2014 12:12:57 +0000
> From: Rudolf Bargholz <rudolf at bargholz.ch>
> Subject: AW: O$5.2 - Omnis Web Services - debugging
> To: OmnisDev List - English <omnisdev-en at lists.omnis-dev.com>
> Message-ID:
>
> <4fe4e9bd46d64cb394f8c02da32e3ffe at AMSPR06MB056.eurprd06.prod.outlook.c
> om>
>
> Content-Type: text/plain; charset="iso-8859-1"
>
> Hi Paul,
>
> How are you calling the web service? We call web service methods either directly on the client by opening the web service library on the client and then calling the remote task instace, or issue a HTTP POST/GET, but have also implemented the Studio Java interface to call web services. Of all methods the HTTP POST/GET works best with respect to the stability of the Omnis Server, but from your explanation below I was not able to determine what exactly your communication flow is.
>
> Regards
>
> Rudolf
>
> -----Ursprüngliche Nachricht-----
> Von: omnisdev-en-bounces at lists.omnis-dev.com
> [mailto:omnisdev-en-bounces at lists.omnis-dev.com] Im Auftrag von Paul
> Mulroney
> Gesendet: Montag, 11. August 2014 10:06
> An: omnisdev-en at lists.omnis-dev.com
> Betreff: O$5.2 - Omnis Web Services - debugging
>
> Hi $All,
>
> Has anyone used Omnis Web Services as a client? Have you had any problems with it?
>
> We're using a Web Service to queue courier jobs, and it seems to run fine for a while, and then suddenly the object class that was created with the Web Services wizard doesn't seem to initialise properly, and all the calls to the web service return an empty list.
>
> Our client has recently switched to a server setup, and all the users are running on the server with multiple copies of Omnis. It seems that once it starts failing, it fails for all instances of Omnis.
>
> I figured out how to enable java logging by creating a "log4j.properties" file, and putting it in the right place and restarting Omnis. However, it doesn't seem to log any crashes or failures to initialise - it only seems to log data when the thing is actually working, and nothing when it doesn't! As you can imagine, that's not very helpful.
>
> If Java fails to initialise inside Omnis, does it get logged anywhere? If so, can anyone tell me where?
>
> Setup is Windows Server 2008R2 standard (64 bit), SP1. Java 7 update 67 (32 bit version). Studio 5.2.2.
>
> All advice gratefully received!
>
> Regards,
> Paul.
>
>
"Expecting the unexpected makes the unexpected expected and the expected unexpected" (anonymous).
--
Paul W. Mulroney We Don't Do Simple Pty Ltd
pmulroney at logicaldevelopments.com.au Trading as Logical Developments
www.logicaldevelopments.com.au ACN 161 009 374
Ph: +61 8 9458 3889 86 Coolgardie Street
Fax: +61 8 9458 2169 BENTLEY WA 6102
_____________________________________________________________
Manage your list subscriptions at http://lists.omnis-dev.com
More information about the omnisdev-en
mailing list