Author Topic: User Exit call to SOAP web service  (Read 2925 times)

Lars Bencze

  • Full Member
  • ***
  • Posts: 116
  • CMOD Expert at Skandia
    • View Profile
    • INACTIVE - Bezland Consulting
User Exit call to SOAP web service
« on: November 04, 2015, 06:59:21 AM »
Hi,

We need to do a lookup in one of the CMOD User Exits, arsuprep to be precise.
I have customized a User Exit before (arsusec), but that was not nearly as complex.

Has anyone had any experience writing User Exits, preferably in a Windows environment (Unix might do) like ours, and could you in that case tell us how we can call a Web Service via a SOAP call?
We are trying different "intermediate steps", such as a Java module or a DLL acting as the "middle man" here.

Any working examples would be appreciated, as well as pointing out caveats/bewares.

Thanks for reading!
OnDemand for MP expert. #Multiplatforms #Admin #Scripts #Performance #Support #Architecture #PDFIndexing #TSM/SP #DB2 #CustomSolutions #Integration #UserExits #Migrations #Workflow #ECM #Cloud #ODApi

Alessandro Perucchi

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1002
    • View Profile
Re: User Exit call to SOAP web service
« Reply #1 on: November 04, 2015, 07:39:16 AM »
Hello LarsB,

I've done such work with ARSUSEC and a webservice to check if the login was ok.

I've used the project Apache Axis2/C

http://axis.apache.org/axis2/c/core/

it was something like:

Code: [Select]
#define _ARSUSEC_C

#include <stdio.h>
#include <stdio.h>
#include <axiom.h>
#include <axis2_util.h>
#include <axiom_soap.h>
#include "axis2c-client/axis2_stub_OnDemandSpecialService.h"

struct axis2_stub_sample {
        axis2_svc_client_t *svc_client;
        axis2_options_t *options;
} axis2_stub_sample_t;

static axutil_env_t *env;
static axis2_stub_t *stub;


ArcCSXitSecurityRC
ARSCSXIT_EXPORT
ARSCSXIT_API
SECURITY(
#ifdef CMOD9
                ArcChar *act_userid, ArcChar *cur_userid, ArcChar *cur_passwd, ArcChar *new_userid, ArcChar *new_passwd, ArcCSXitSecurityAction action, ArcChar *msg,
                ArcChar *clnt_id, ArcChar *instance, ArcChar *passthru_text, ArcU32 passthru_size, ArcByte *passthru_buf
#endif
#ifdef CMOD8
                char *act_userid, char *cur_userid, char *cur_passwd, char *new_userid, char *new_passwd, ArcCSXitSecurityAction action, char *msg, char *clnt_id,
                char *instance
#endif
) {
        ArcCSXitSecurityRC rc;
        msg[0] = '\0';

        if (action == ARCCSXIT_SECURITY_USER_LOGIN) {
                // ...
                 if (!stub) {
// Create stub
                printDebug("Setting up WS connection");
                if (!endpoint_uri) {
                        // setup_URL();
                        printDebug(endpoint_uri);
                }
                printDebug(client_home);
                env = axutil_env_create_all(axis_log_file, axis_log_level);
                stub = axis2_stub_create_OnDemandSpecialService(env, client_home, endpoint_uri);
             }
            if (stub) {
                // call the WS ...
            } else {
                printError("Problem with the connection to the WS, please check");
            }

                // ...
        } else {
                rc = ARCCSXIT_SECURITY_RC_OKAY;
        }
        return (rc);
}

I hope that helps a little bit how I've done it.
I will never use some JAVA as a middle man, because the java initialization is too slow... after that's ok, since it can be quite fast (near C implementation)... but for login, if possible I would like to avoid...

Hope that helps a little bit...

Alex
Alessandro Perucchi

#Install #Migrations #Conversion #Educate #Repair #Upgrade #Migrate #Enhance #Optimize #AIX #Linux #Multiplatforms #DB2 #Windows #Oracle #TSM #Tivoli #Performance #Audits #Customizing #Availability #HA #DR #JavaApi #ContentNavigator #ICN #WEBi #ODWEK #Services #PDF #AFP #XML

Lars Bencze

  • Full Member
  • ***
  • Posts: 116
  • CMOD Expert at Skandia
    • View Profile
    • INACTIVE - Bezland Consulting
Re: User Exit call to SOAP web service
« Reply #2 on: November 04, 2015, 09:06:51 AM »
Thank you Alex for your speedy reply, I will have a look at it!

Lars
OnDemand for MP expert. #Multiplatforms #Admin #Scripts #Performance #Support #Architecture #PDFIndexing #TSM/SP #DB2 #CustomSolutions #Integration #UserExits #Migrations #Workflow #ECM #Cloud #ODApi

Lars Bencze

  • Full Member
  • ***
  • Posts: 116
  • CMOD Expert at Skandia
    • View Profile
    • INACTIVE - Bezland Consulting
Re: User Exit call to SOAP web service
« Reply #3 on: November 08, 2015, 11:44:11 PM »
Hi Alex,

My programmer colleague reported that we almost immediately ran into problems. To being with, the axis software was no longer available for download - the ftp folder was empty. But after Googling a bit, we were able to find the downloads on a hidden web page. However, when we looked closer at the axis 2 modules, they were very old. Version 1.6.0 (windows binary) was dated 2009. That is not a problem per se, but the problem is that the code appears to be 32-bit, and it is also dependent on a whole array of other 32-bit modules (DLLs), which therefore (according to my colleague) cannot be compiled into a 64-bit DLL, which is what CMOD requires.
If you know of a way around the 32-bit problem, please advice.

I just read an email from my colleague that he has found another way to solve our problem. Apparently it works by using Microsoft's "winhttp" API. I will get back here later to tell about that solution.

Excerpt from the build file, with axis 2:
#############################################################################
### Dependant Binary Locations (Required) ###
#############################################################################
#
# libxml2 binary location ( axis2c is built with libxml2 )
LIBXML2_BIN_DIR = E:\libxml2-2.6.30.win32
#
# iconv binary location
ICONV_BIN_DIR = E:\iconv-1.9.2.win32
#
# zlib binary location
ZLIB_BIN_DIR= E:\zlib-1.2.3.win32
...
OnDemand for MP expert. #Multiplatforms #Admin #Scripts #Performance #Support #Architecture #PDFIndexing #TSM/SP #DB2 #CustomSolutions #Integration #UserExits #Migrations #Workflow #ECM #Cloud #ODApi

Alessandro Perucchi

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1002
    • View Profile
Re: User Exit call to SOAP web service
« Reply #4 on: November 09, 2015, 02:03:42 AM »
As I said, I am not a Windows specialist, so I cannot help you.
And maybe there are other solutions for windows than Axis/C... you might look at your .NET libraries... you might find something for C/C++.

Second, I NEVER use binaries when I have the source code, I prefer ALWAYS to recompile them, and like that I can compile them in 64bits if needed.

I have checked the AXIS project and it seems dead, so I had luck when I used the AXIS. Now I will need to find another C/C++ library for such WS services call  :'(
I found many for Java... but for C/C++ that's not that easy, especially if you want to stay on the open source, without using the GPL... maybe I should take the time and build one for my needs....
Alessandro Perucchi

#Install #Migrations #Conversion #Educate #Repair #Upgrade #Migrate #Enhance #Optimize #AIX #Linux #Multiplatforms #DB2 #Windows #Oracle #TSM #Tivoli #Performance #Audits #Customizing #Availability #HA #DR #JavaApi #ContentNavigator #ICN #WEBi #ODWEK #Services #PDF #AFP #XML