cxfsoap-clientwsdl2javajava-17cxf-codegen-plugin

Lexis Nexis gives Invalid Credentials error on v12


I use the Lexis-Nexis SOAP service. Currently it works on Java 8 and Lexis-Nexis v11.

But then I upgraded the Java to version 17, and generated the Lexis-Nexis SOAP service client under version 12. On Java 17 it does not use the javax name space, but rather jakarta. The jakarta name does appear on the freshly generated SOAP client.

In order to generate the client app from WSDL document, I used the Apache CXF tool.

When I call the service client I ended up with this exception:

https.bridgerinsight_lexisnexis_com.bridgerinsight_web_services_interfaces_12_0.ISearchSearchServiceFaultFaultFaultMessage: The following error occurred while processing your request. Please contact your system administrator.

Invalid Credentials
        at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:77)
        at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:499)
        at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:480)
        at com.sun.xml.ws.fault.SOAPFaultBuilder.createException(SOAPFaultBuilder.java:119)
        at com.sun.xml.ws.client.sei.StubHandler.readResponse(StubHandler.java:225)
        at com.sun.xml.ws.db.DatabindingImpl.deserializeResponse(DatabindingImpl.java:176)
        at com.sun.xml.ws.db.DatabindingImpl.deserializeResponse(DatabindingImpl.java:263)
        at com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:89)
        at com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:62)
        at com.sun.xml.ws.client.sei.SEIStub.invoke(SEIStub.java:132)
        at jdk.proxy2/jdk.proxy2.$Proxy133.search(Unknown Source)
        at co.tulip.object.services.LNService.searchCompany(LNService.java:298)
        at co.tulip.object.controller.TESTController.testMethod(TESTController.java:292)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:568)
        at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:207)
        at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:152)
        at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:117)
        at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:884)
        at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:797)
        at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87)
        at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1081)
        at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:974)
        at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1011)
        at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:903)
        at jakarta.servlet.http.HttpServlet.service(HttpServlet.java:500)
        at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:885)
        at jakarta.servlet.http.HttpServlet.service(HttpServlet.java:587)
        at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:764)
        at org.eclipse.jetty.servlet.ServletHandler$ChainEnd.doFilter(ServletHandler.java:1665)
        at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:110)
        at co.tulip.object.dev.MaintenanceModeFilter.doFilterInternal(MaintenanceModeFilter.java:91)
        at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116)
        at org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:202)
        at org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1635)
        at org.springframework.security.web.FilterChainProxy.lambda$doFilterInternal$3(FilterChainProxy.java:231)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:365)
        at org.springframework.security.web.access.intercept.AuthorizationFilter.doFilter(AuthorizationFilter.java:100)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:374)
        at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:126)
        at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:120)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:374)
        at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:131)
        at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:85)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:374)
        at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:100)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:374)
        at org.springframework.security.web.authentication.rememberme.RememberMeAuthenticationFilter.doFilter(

The live implementation, under version 11 and Java 8, uses the same configuration as does the one freshly generated, under v12, including credentials. But the freshly generated client app returns above error message.

-------------- Edits on 23/03/2023 ----------------

I used to get this error:

enter image description here

But I managed to go it away by including this dependecy:

implementation ('org.glassfish.metro:wssx-impl:4.0.2')

The dependencies that I use to run/access the SOAP service generated client are:

  implementation('jakarta.xml.ws:jakarta.xml.ws-api:4.0.0')

    implementation('jakarta.xml.bind:jakarta.xml.bind-api:4.0.0')
    implementation('com.sun.xml.bind:jaxb-impl:4.0.0')

    implementation ('org.apache.commons:commons-lang3:3.12.0')
    implementation ('org.apache.cxf:cxf-core:4.0.0')
    
    implementation ('org.apache.cxf.xjc-utils:cxf-xjc-runtime:4.0.0')
    implementation ('org.glassfish.metro:wssx-impl:4.0.2')
    implementation "jakarta.annotation:jakarta.annotation-api:2.1.1"
   
    implementation 'org.apache.cxf:cxf-rt-frontend-jaxws:4.0.0'
    compileOnly 'jakarta.servlet:jakarta.servlet-api:5.0.0'//because Apache Tomcat 10, and Jetty 11, support up to v5.0 of servlet standard

The dependecies that I used to generate the SOAP service client are:

    cxfCodegen platform("org.apache.cxf:cxf-bom:4.0.0") 
    cxfCodegen "jakarta.annotation:jakarta.annotation-api:2.1.1"

    cxfCodegen "jakarta.xml.ws:jakarta.xml.ws-api:4.0.0" 
   
    cxfCodegen('jakarta.xml.bind:jakarta.xml.bind-api:4.0.0')
    cxfCodegen('com.sun.xml.bind:jaxb-impl:4.0.0')

    //------------- XJC ------------------
    cxfCodegen 'org.apache.cxf.xjc-utils:cxf-xjc-runtime:4.0.0'
    cxfCodegen 'org.apache.cxf.xjcplugins:cxf-xjc-ts:4.0.0'

    cxfCodegen 'jakarta.servlet:jakarta.servlet-api:5.0.0'//because Apache Tomcat 10, and Jetty 11, support up to v5.0 of servlet standard
    
    //---------- Extra Libs ---------------
    cxfCodegen 'org.apache.cxf:cxf-codegen-plugin:4.0.0'
  
    cxfCodegen 'org.apache.cxf:cxf-tools-common:4.0.0'
    cxfCodegen 'org.apache.cxf:cxf-core:4.0.0'
    
    cxfCodegen 'org.apache.cxf:cxf-tools-wsdlto-core:4.0.0'
    cxfCodegen 'org.apache.cxf:cxf-tools-wsdlto-frontend-jaxws:4.0.0'
   
    cxfCodegen 'org.apache.commons:commons-lang3:3.12.0'
    cxfCodegen 'org.apache.cxf:cxf-rt-wsdl:4.0.0'
    cxfCodegen 'org.apache.cxf:cxf-tools-wsdlto-databinding-jaxb:4.0.0'
    cxfCodegen 'org.apache.ws.xmlschema:xmlschema-core:2.3.0'
    cxfCodegen 'wsdl4j:wsdl4j:1.6.3'
    cxfCodegen 'org.apache.cxf:cxf-rt-bindings-soap:4.0.0'
    cxfCodegen 'org.apache.cxf:cxf-tools-validator:4.0.0'
    cxfCodegen 'org.apache.cxf:cxf-rt-frontend-jaxws:4.0.0'
    
    cxfCodegen ('org.glassfish.metro:wssx-impl:4.0.2')
    cxfCodegen 'org.apache.cxf:cxf-rt-security:4.0.0'
    cxfCodegen 'org.apache.cxf:cxf:4.0.0'

The tool (Apache CXF) that I used to generate the SOAP service client:

import io.mateo.cxf.codegen.wsdl2java.Wsdl2Java 

plugins {
    id "io.mateo.cxf-codegen" version "1.0.3"
}

tasks.register("lexis-nexis-gen-12", Wsdl2Java) {
    toolOptions {
        wsdl.set(layout.projectDirectory.file("src/main/resources/XGServices.wsdl"))//the location of the WSDL document on the file-system
       
        extraArgs.addAll(["-databinding", "jaxb"]) 
        serviceName.set("XGServices")//the name of the service node under the WSDL document
        outputDir.set(file("${buildDir}/../src/main/java"))//that's is the location where the generated files go to
        //xjcArgs.add("-Xts")
        verbose.set(true)
        markGenerated.set(true)
    }
}

xjcArgs.add("-Xts")//Do I need this arg? Made no difference including or excluding it

Similar existing issue comes here:

What might be the problem, in this case?

Best regards


Solution

  • Well, I figured out what the problem was with it.

    For that, I used the SoapUI external desktop application:

    It appears that the service end-point pointed out to the staging URI, which did not accept the credentials that I was passing in.

    That is, something like this, it was:

    So, what I did, I removed the staging prefix, on the service WSDL URI, and regenerated the SOAP service client app.

    That means, from now on, I am using the live service, rather than the testing one.

    Surprisingly, once I understood that I am on the staging set-up, by searching for the staging keyword, under the existing generated SOAP service client, I found none such instances.

    So that, the SoapUI application was really helpful.