I generated classes from wsdl using maven in pom.
<plugin>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-codegen-plugin</artifactId>
<version>2.7.18</version>
<executions>
<execution>
<id>generate-sources</id>
<phase>generate-sources</phase>
<configuration>
<sourceRoot>src/main/java</sourceRoot>
<wsdlOptions>
<wsdlOption>
<wsdl>src/main/webapp/WEB-INF/wsdl/getCustCardAccDetail.wsdl
</wsdl>
<wsdlLocation>WEB-INF/wsdl/getCustCardAccDetail.wsdl</wsdlLocation>
<extraargs>
<extraarg>-impl</extraarg>
</extraargs>
</wsdlOption>
</wsdlOptions>
</configuration>
<goals>
<goal>wsdl2java</goal>
</goals>
</execution>
</executions>
</plugin>
- I created a REST resource. In the rest resource class, I am calling soap web service using a function:
@POST
@Path("/v1/getCustomerCardAccDetails")
@Produces({"application/json", "application/xml", "text/plain"})
@Consumes({"application/json", "application/xml"})
public void getCustomerCardAccountDetailsV1(@Suspended final AsyncResponse asyncResponse, @Context SecurityContext sc, RequestObject trans) {
try {
initialiseVariables(trans);
CortexGetCustCardAccDetailTask cortexGetCustCardAccDetailTask = new CortexGetCustCardAccDetailTask(servPrmApplId, servPrmFeId, servPrmServId, servPrmServVer, basicAuthUsrId, basicAuthPswrd, requestHdrMsgUuid, requestHdrRqstHdrVer, requestHdrSrcId, url, customerNumber, instCode, readTimeOut, connectTimeOut, nbmencryptor, encryptionKey);
ExceptionHandler exceptionHandler = new ExceptionHandler(referenceID, asyncResponse);
CreateNBMETSResponse createNBMETSResponse = new CreateNBMETSResponse(referenceID);
SendNBMETSResponse sendNBMETSResponse = new SendNBMETSResponse(asyncResponse);
LogFileWriterFunction logFileWriterFunction = new LogFileWriterFunction(trans, outputFilename, gatewayAppServerTimeStamp);
SuccessfulUpdateCardStatusResponsePredicate successfulUpdateCardStatusResponsePredicate = new SuccessfulUpdateCardStatusResponsePredicate();
RetryPolicy<HttpResponse> rp = new RetryPolicy<HttpResponse>()
.withMaxRetries(1)
.abortIf(successfulUpdateCardStatusResponsePredicate.negate());
Fallback<HttpResponse> fallback = Fallback.<HttpResponse>of(() -> {
throw new IllegalStateException(successfulUpdateCardStatusResponsePredicate.getResponse().getResponseDescription());
}).handleResultIf(successfulUpdateCardStatusResponsePredicate.negate());
CompletableFuture<HttpResponse> response = Failsafe.with(fallback, rp).getAsync(cortexGetCustCardAccDetailTask);
response.thenApplyAsync(createNBMETSResponse)
.thenApplyAsync(sendNBMETSResponse)
.thenApplyAsync(logFileWriterFunction)
.exceptionally(exceptionHandler);
} catch (Exception ex) {
handleGeneralException(ex, trans, outputFilename, transRef, asyncResponse);
}
}
.
.
import net.jodah.failsafe.function.CheckedSupplier;
.
.
public class CortexGetCustCardAccDetailTask implements CheckedSupplier<HttpResponse> {
@Override
public HttpResponse get() throws Throwable {
HttpResponse httpResponse = new HttpResponse();
String msg = "";
String msgCode = "";
String rtnCode = "";
try {
String url = "https://ctx40dev:7002/CRDBASE-WS-NBM/checkCardPin";
CortexService svc = new CortexService();
Cortex port = svc.getCortexSoap11();
BindingProvider bp = (BindingProvider) port;
bp.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, url);
bp.getRequestContext().put("com.sun.xml.ws.request.timeout", readTimeOut);
bp.getRequestContext().put("com.sun.xml.ws.connect.timeout", connectTimeOut);
.
.
.
<Some code removed>
.
.
.
} catch (ServerSOAPFaultException ex) {
rtnCode = "";
SOAPFault fault = ex.getFault();
msg = fault.getFaultReasonText(Locale.ENGLISH);
} catch (Exception ex) {
rtnCode = "";
msg = ex.getMessage();
}
if ("000".equals(rtnCode)) {
httpResponse.setStatus("200");
} else {
httpResponse.setStatus("404");
}
httpResponse.setResponseDescription(msg.concat("|").concat(requestHdrMsgUuid));
return httpResponse;
}
});
-
Code fails here:
Cortex port = svc.getCortexSoap11();
With the exception
[2021-12-14T11:04:21.168+0200] [Payara 5.2021.8] [SEVERE] [] [com.sun.metro.assembler] [tid: _ThreadID=6055 _ThreadName=ForkJoinPool.commonPool-worker-3] [timeMillis: 1639472661168] [levelValue: 1000] [[
MASM0001: Default configuration file [ jaxws-tubes-default.xml ] was not found]]
[2021-12-14T11:04:21.168+0200] [Payara 5.2021.8] [SEVERE] [] [com.sun.metro.assembler] [tid: _ThreadID=6055 _ThreadName=ForkJoinPool.commonPool-worker-3] [timeMillis: 1639472661168] [levelValue: 1000] [[
MASM0010: Unable to unmarshall metro config file from location [ null ]
java.lang.IllegalStateException: MASM0001: Default configuration file [ jaxws-tubes-default.xml ] was not found
at com.sun.xml.ws.assembler.MetroConfigLoader.getConfigInputStream(MetroConfigLoader.java:250)
at com.sun.xml.ws.assembler.MetroConfigLoader.loadMetroConfig(MetroConfigLoader.java:225)
at com.sun.xml.ws.assembler.MetroConfigLoader.init(MetroConfigLoader.java:117)
at com.sun.xml.ws.assembler.MetroConfigLoader.(MetroConfigLoader.java:91)
at com.sun.xml.ws.assembler.TubelineAssemblyController.getTubeCreators(TubelineAssemblyController.java:63)
at com.sun.xml.ws.assembler.MetroTubelineAssembler.createClient(MetroTubelineAssembler.java:88)
at com.sun.xml.ws.client.Stub.createPipeline(Stub.java:313)
at com.sun.xml.ws.client.Stub.(Stub.java:280)
at com.sun.xml.ws.client.Stub.(Stub.java:213)
at com.sun.xml.ws.client.Stub.(Stub.java:228)
at com.sun.xml.ws.client.sei.SEIStub.(SEIStub.java:68)
at com.sun.xml.ws.client.WSServiceDelegate.getStubHandler(WSServiceDelegate.java:791)
at com.sun.xml.ws.client.WSServiceDelegate.createEndpointIFBaseProxy(WSServiceDelegate.java:780)
at com.sun.xml.ws.client.WSServiceDelegate.getPort(WSServiceDelegate.java:422)
at com.sun.xml.ws.client.WSServiceDelegate.getPort(WSServiceDelegate.java:390)
at com.sun.xml.ws.client.WSServiceDelegate.getPort(WSServiceDelegate.java:372)
at javax.xml.ws.Service.getPort(Service.java:139)
at com.fis.cortex.crdbase.getcustcardaccdetails.CortexService.getCortexSoap11(CortexService.java:78)
at mw.co.natbank.cortexportal.cdi.CortexGetCustCardAccDetailTask.get(CortexGetCustCardAccDetailTask.java:239)
at mw.co.natbank.cortexportal.cdi.CortexGetCustCardAccDetailTask.get(CortexGetCustCardAccDetailTask.java:51)
at net.jodah.failsafe.Functions.lambda$toCtxSupplier$15(Functions.java:276)
at net.jodah.failsafe.Functions.lambda$getPromise$1(Functions.java:81)
at net.jodah.failsafe.Functions.lambda$getPromiseAsync$4(Functions.java:100)
at net.jodah.failsafe.RetryPolicyExecutor$1.call(RetryPolicyExecutor.java:101)
at net.jodah.failsafe.internal.util.DelegatingScheduler.lambda$schedule$0(DelegatingScheduler.java:141)
at java.base/java.util.concurrent.ForkJoinTask$AdaptedCallable.exec(ForkJoinTask.java:1448)
at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290)
at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1020)
at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1656)
at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1594)
at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:177)
]]
This is happening with payara 5.2021.8 through to 5.2021.10 and using openjdk 11 through 17.
I am able to get a successful response on lower version of payara e.g. payara-4.1.1.163 and java 1.8