How to solve my problem with kubernetes and soap. Client cannot reach server

6/25/2020

i have a client and a server on a kubernetes cluster in the same namespace. I try to access the server with this code:

    public GetDataResponse getData() throws JsonProcessingException {
        GetDataResponseXML response = (GetDataResponseXML) getWebServiceTemplate()
                .marshalSendAndReceive(REQUEST_PARAMETER, new SoapActionCallback(""));
        log.info("Get response data: " + Mapper.objectMapper.writeValueAsString(response));
        return mapper.dataResponseXMLToJPAEntity(response);
    }

I connect to the endpoint with the DNS

http://<serviceOfServer>.<namespace>.svc.cluster.local/data

But i get always this output:

2020-06-25 07:44:36.128 ERROR 7 --- [   scheduling-1] o.s.s.s.TaskUtils$LoggingErrorHandler    : Unexpected error occurred in scheduled task
java.lang.NullPointerException: null
at org.springframework.ws.transport.http.AbstractHttpWebServiceMessageSender.supports(AbstractHttpWebServiceMessageSender.java:63) ~[spring-ws-core-3.0.7.RELEASE.jar!/:na]
at org.springframework.ws.client.support.WebServiceAccessor.createConnection(WebServiceAccessor.java:107) ~[spring-ws-core-3.0.7.RELEASE.jar!/:na]
at org.springframework.ws.client.core.WebServiceTemplate.sendAndReceive(WebServiceTemplate.java:551) ~[spring-ws-core-3.0.7.RELEASE.jar!/:na]
at org.springframework.ws.client.core.WebServiceTemplate.marshalSendAndReceive(WebServiceTemplate.java:390) ~[spring-ws-core-3.0.7.RELEASE.jar!/:na]
at org.springframework.ws.client.core.WebServiceTemplate.marshalSendAndReceive(WebServiceTemplate.java:383) ~[spring-ws-core-3.0.7.RELEASE.jar!/:na]
at com.my.adapter.client.SOAPClient.getData(SOAPClient.java:40) ~[classes!/:0.0.1-SNAPSHOT]
at com.my.adapter.scheduler.Scheduler.consumeScheduler(Scheduler.java:33) ~[classes!/:0.0.1-SNAPSHOT]
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:na]
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
at java.base/java.lang.reflect.Method.invoke(Method.java:566) ~[na:na]
at org.springframework.scheduling.support.ScheduledMethodRunnable.run(ScheduledMethodRunnable.java:84) ~[spring-context-5.2.0.RELEASE.jar!/:5.2.0.RELEASE]
at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:54) ~[spring-context-5.2.0.RELEASE.jar!/:5.2.0.RELEASE]
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) ~[na:na]
at java.base/java.util.concurrent.FutureTask.runAndReset(FutureTask.java:305) ~[na:na]
at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:305) ~[na:na]
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) ~[na:na]
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) ~[na:na]
at java.base/java.lang.Thread.run(Thread.java:834) ~[na:na]

I have this networkpolicy, so the np cannot be the reason

apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
  name: allow-all-egress
spec:
  podSelector: {}
  egress:
    - {}
  ingress:
    - {}
  policyTypes:
    - Egress
    - Ingress

If i do port-forwarding to the server or service, i can access it with my local client. So it should be ok.

I have absolut not a clue why i get a nullpointer exception.

Have anyone an idea?

Thanks a lot for any help!

-- goku736
debugging
endpoint
java
kubernetes
soap

1 Answer

6/25/2020

I have the solution. I dont know why my DNS didn't work, but when i call it only with the service

http://<serviceOfServer>:<port>

It works.....

-- goku736
Source: StackOverflow