Showing posts with label proxy. Show all posts
Showing posts with label proxy. Show all posts

Tuesday, 3 September 2019

Error response from daemon: Get https://registry-1.docker.io/v2 - docker desktop for windows

Problem Statement : Error response from daemon: Get https://registry-1.docker.io/v2

I faced above mentioned problem, when I first installed docker for desktop windows and tried to run

docker run hello-world

The issue is because of corporate proxy setting


Solution which I tried :

Step1 : Right click on the docker icon(bottom right corner) - select settings option

Step2 : Set http and https proxies as shown in below screen shot


May be if any proper solution, kindly let me know.

Thanks
Kotresh

Wednesday, 17 October 2018

Serving static files from Spring Boot web app via Gateway application using Spring Cloud Zuul Proxy


Loading static files like image, css and js files via Spring Cloud Zuul Proxy is tricky part.

We will place our static resources under src- main – resources – static folder.

If we run our spring boot application, we can able to access the static resources present under src- main – resources – static folder.

But same spring boot application when we are trying to access via Zuul proxy we will get

GET http://<host>/js/welcome.js?v=1539843529723 net::ERR_ABORTED 404 error

In order to resolve this issue, one work around is to place all your static file under application-name/ application context configured in gateway application.

For example, in your gateway application you configured your spring boot application(demo) in application.properties file as follows

zuul.routes.demo.url=http://localhost:8091


But your static resources like img,css and js files are present under


src- main – resources – static folder.

Then create folder named demo under src- main – resources – static and then place all your static files under “demo” folder

So, when configuring zuul proxy we need place all our static resources under src-main-resources-static-<application.name>(folder)


One more alternative approach which I found was

  Creating a mapping in your gateway applications application.yml file as shown below

  zuul:
  routes:
    demo-viewer:
      path: /demo-viewer/**
      url: http://localhost:9099
      strip-prefix: true
    demo-viewer-img:
      path: /demo/**
      url: http://localhost:9099
      strip-prefix: false
    demo-viewer-boot:
      path: /bootstrap*/**
      url: http://localhost:9099
      strip-prefix: false
    demo-viewer-jquery:
      path: /jquery*/**
      url: http://localhost:9099
      strip-prefix: false
server:
  port: 8080
ribbon:
 eureka:
   enabled: false   

As you see, I have mentioned above mapping in my application.yml file. Here I am explicitly mapping route for my static resources like img, jquery and bootstrap



If any one knows better alternative, please suggest in comments.

Hope it helps!

Monday, 11 June 2018

Java Helper class to invoke SOAP web service using proxy in Oracle ADF

Following is the code snippet can be used as a helper class to invoke SOAP web service via proxy in Oracle ADF



 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
import com.oracle.xmlns.apps.xxsrf.soaprovider.plsql.xxsrf_capex_api.XXSRF_CAPEX_API_PortType;
import com.oracle.xmlns.apps.xxsrf.soaprovider.plsql.xxsrf_capex_api.XXSRF_CAPEX_API_Service;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.Map;
import java.util.Properties;
import javax.xml.namespace.QName;
import javax.xml.ws.BindingProvider;
import oracle.adf.share.logging.ADFLogger;
import oracle.wsm.security.util.SecurityConstants;
import weblogic.wsee.jws.jaxws.owsm.SecurityPoliciesFeature;


public class WebserviceHelper {
  private static final ADFLogger LOGGER = ADFLogger.createADFLogger(WebserviceHelper.class);

  public WebserviceHelper() {
    super();
  }

  // Creating instance of Service.java class
  private static XXSRF_CAPEX_API_Service xXSRF_CAPEX_API_Service;
  private static InputStream input = null;
  private static Properties prop = new Properties();

  public XXSRF_CAPEX_API_PortType getWsPort() {
    String url = null;
    URL urlObj;
    try {
      input = new FileInputStream("/app/scripts/SRFConfig.properties");
      prop.load(input);
      url = prop.getProperty("CAPEX_APPROVAL_URL");
      LOGGER.info("WSDL URL " + url);
    } catch (IOException e) {
      e.printStackTrace();
    }

    try {
      urlObj = new URL(url);
      QName qName =
          new QName("http://xmlns.oracle.com/apps/xxsrf/soaprovider/plsql/xxsrf_capex_api/",
              "XXSRF_CAPEX_API_Service");

      LOGGER.info("WSDL URL Object " + urlObj);
      LOGGER.info("qName " + qName);
      xXSRF_CAPEX_API_Service = new XXSRF_CAPEX_API_Service(urlObj, qName);
      SecurityPoliciesFeature securityFeatures =
          new SecurityPoliciesFeature(new String[] {"oracle/wss_username_token_client_policy"});
      XXSRF_CAPEX_API_PortType xXSRF_CAPEX_API_PortType =
          xXSRF_CAPEX_API_Service.getXXSRF_CAPEX_API_Port(securityFeatures);
      // Add your code to call the desired methods.
      BindingProvider bindingProvider = (BindingProvider) xXSRF_CAPEX_API_PortType;
      Map<String, Object> context = bindingProvider.getRequestContext();
      // context.put(WSBindingProvider.USERNAME_PROPERTY, "Test");
      // context.put(WSBindingProvider.PASSWORD_PROPERTY, "Test");
      context.put(SecurityConstants.ClientConstants.WSS_CSF_KEY, "user-key");
      // bindingProvider.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, url);
      return xXSRF_CAPEX_API_PortType;
    } catch (MalformedURLException e) {
      LOGGER.info("Inside the catch block" + e);
      e.printStackTrace();
    }
    return null;
  }
}