There was no endpoint listening at (url) that could accept the message error

Viewed 118

I am trying to create develop a .net core application which needs to call a java webservice. On Visual Studio, when I directly run the application, It connects and gets the results from the webservice as expected. But when I run it through Docker, The line on which the service call called is, throws exception - 'One or more errors occurred. (There was no endpoint listening at (URI) that could accept the message. This is often caused by an incorrect address or SOAP action.)

Does anyone have any idea what could be the issue?

1 Answers

There are two separate networks. Inside docker is a separate network. Outside docker, on the host machine, it's a different network. If you are accessing it by localhost or IP address it won't work as you are expecting it.

`docker network ls' will show you a similar output like below:

NETWORK ID          NAME                DRIVER              SCOPE
58a4dd9893e9        133_default         bridge              local
424817227b42        bridge              bridge              local
739297b8107e        host                host                local
b9c4fb3ed4ba        none                null                local

You need to add the host for Java service locally. Try running like a below command:

docker run --add-host javaservice:<ip address of java service> <your image>

Hopefully, this will fix it.

More here: https://docs.docker.com/engine/reference/run/#managing-etchosts

Related