GX Technology : Axis 6 - Testing APIs Locally

Proceed to these steps after you have set up your development environment.


When going through the information below, be sure to replace all instances of DISID with your DISID username.

Step-by-step guide

  1. Edit the hosts file
    1. Edit hosts file (C:\windows\system32\drivers\etc\hosts on Windows, /etc/hosts on Linux and OSX)
    2. Add localhost-axis.disney.network to the 127.0.0.1 line (line #3 below)

      #AXIS GAE Setup
      127.0.0.1   localhost localhost-axis.disney.network localhost-gae-axis.disney.network direct-access-localhost-gae-axis.disney.network
  2. Install Postman in Chrome
  3. Install NGINX as a HTTPS reverse proxy
    1. Windows (Nginx)
      1. Download Nginx https://nginx.org/en/download.html
      2. Install to C:\nginx
      3. edit the conf.ini file with the following config:


        1. 	server {
          		charset utf-8;
          		root  home/localhost-gae-axis.disney.network/public_html;
          		listen 127.0.0.1:443;
          		server_tokens off;
          		server_name localhost-gae-axis.disney.network direct-access-localhost-gae-axis.disney.network;
          
          
          
          		ssl on;
          		#ssl_certificate     c:/winginx/conf/server.crt;
          		#ssl_certificate_key c:/winginx/conf/server.key;
          
          		ssl_certificate     c:/winginx/certs/authority/localhost-gae-axis.disney.network.crt;
          		ssl_certificate_key c:/winginx/certs/authority/localhost-gae-axis.disney.network.key;
          
          		ssl_protocols TLSv1.3;
          
          
          		#location /6 {
          		#    alias home/localhost-axis.disney.network/public_html/axis6-client;
          		#}
          		
          		location ~* ^/axis/(.*) {
          			proxy_http_version    1.1;
          			proxy_cookie_path     ~* /;
          			proxy_connect_timeout 2;
          			proxy_send_timeout    55;
          			proxy_read_timeout    55;
          			send_timeout          55;
          			proxy_set_header Host localhost-gae-axis.disney.network;
          			proxy_set_header X-Forwarded-For    $proxy_add_x_forwarded_for;
          			proxy_set_header X-Forwarded-Host   $host:$server_port;
          			proxy_set_header X-Forwarded-Server $host;
          			proxy_pass http://localhost:8080/axis/$1$is_args$args;
          		}
          		
          		#location /axis {
          		#    proxy_pass http://localhost:8080$request_uri;
          		#}
          		
          		
          
          		location /dam {
          			proxy_pass http://localhost:8080$request_uri;
          		}
          		
          		location /_ah {
          			proxy_http_version    1.1;
          			proxy_cookie_domain   localhost-gae-axis.disney.network localhost;
          			proxy_cookie_path     ~* /;
          			proxy_connect_timeout 30;
          			proxy_send_timeout    30;
          			proxy_read_timeout    30;
          			send_timeout          30;
          			proxy_set_header Host localhost:8080;
          			proxy_set_header X-Forwarded-For    $proxy_add_x_forwarded_for;
          			proxy_set_header X-Forwarded-Host   $host:$server_port;
          			proxy_set_header X-Forwarded-Server $host;
          			proxy_pass http://localhost:8080/_ah;        
          		}
          		
          			location /oidc {
          			proxy_http_version    1.1;
          			proxy_cookie_path     ~* /;
          			proxy_connect_timeout 50;
          			proxy_send_timeout    50;
          			proxy_read_timeout    50;
          			send_timeout          50;
          			proxy_set_header Host localhost-gae-axis.disney.network;
          			proxy_set_header X-Forwarded-For    $proxy_add_x_forwarded_for;
          			proxy_set_header X-Forwarded-Host   $host:$server_port;
          			proxy_set_header X-Forwarded-Server $host;
          			proxy_pass http://localhost:8080/axis/oidc;
          		}
          		
          		location /6/ {
          			proxy_pass https://dev1-axis.disney.network/6/;    
          		}
          		location /6/css {
          			proxy_pass https://dev1-axis.disney.network/6/css/;    
          		}
          		location /6/scripts {
          			proxy_pass https://dev1-axis.disney.network/6/scripts/;    
          		}
          	}
      4. run in command window by 
      5. cd c:\nginx
        
        nginx.exe
        
        
      6. Create a self signed certificate

        1. Install cygwin

        2. Install OpenSSL from cygwin

        3. Make sure C:\cygwin64\bin is in the variables path

        4. Create a "certs" folder in C:/Users/DISID/Documents/ and run the following in command line.

        5. Run the following in a new terminal

          cd users/DISID/documents/certs
          openssl req -new -x509 -nodes -days 3650 -newkey rsa:2048 -keyout localhost-dev.key -out localhost-dev.crt
          openssl rsa -in localhost-dev.key -text > localhost-dev.pem
          openssl x509 -inform PEM -in localhost-dev.crt > localhost-dev.pem
    2. Windows (nginx with Windows Subsystem for Linux)

      1. Disable services on port 80 - http://www.devside.net/wamp-server/opening-up-port-80-for-apache-to-use-on-windows
      2. Run sudo apt-get install nginx-extras
      3. Create file /etc/nginx/sites-available/localhost-axis.disney.network with the following contents

        upstream devserver {
        	server 127.0.0.1:8080;
        	keepalive 32;
        }
        
        server {
        	listen 127.0.0.1:80;
        	server_name localhost-axis.disney.network;
        	location / {
        		return 302 https://localhost-axis.disney.network/;
        	}
        }
        
        server {
        	listen 127.0.0.1:443 ssl;
        	server_name localhost-axis.disney.network;
        	server_tokens off;
        
        	root /var/www/localhost-axis/html/axis6-site;
        	index index.html;
        
        	ssl on;
        	ssl_certificate certs/localhost-axis.pem;
        	ssl_certificate_key certs/localhost-axis.key;
        
            log_not_found off;
        	access_log logs/localhost-axis.disney.network-access.log;
        	error_log logs/localhost-axis.disney.network-error.log;
        
        	location /6 {
        		alias /var/www/localhost-axis/html/axis6-client;
        	}
        	location ~* ^/axis/(.*) {
        		proxy_pass http://devserver/axis/$1$is_args$args;
        		proxy_http_version 1.1;
        		proxy_set_header Connection "";
        	}
        	location /_ah {
        		proxy_pass http://devserver/_ah;
        	}
        }

        You must use the upstream configuration to define a pool of servers (a single server, in this case) otherwise the second and subsequent proxied calls will fail with an HTTP 502 (Bad Gateway) error.

        Tested with Ubuntu 16.04 and nginx 1.10.3-0ubuntu0.16.04.2

      4. Create a self signed certificate

        1. Install cygwin

        2. Install OpenSSL from cygwin

        3. Make sure C:\cygwin64\bin is in the variables path

        4. Create a "certs" folder in /etc/nginx/ and run the following in command line.

        5. Run the following in a new terminal

          cd /etc/nginx/certs
          openssl req -new -x509 -nodes -days 3650 -newkey rsa:2048 -keyout localhost-axis.key -out localhost-axis.crt
          openssl rsa -in localhost-axis.key -text > localhost-axis.pem
          openssl x509 -inform PEM -in localhost-axis.crt > localhost-axis.pem
    3. Nginx for a Mac
      1. Install Homebrew

        $ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
      2. install nginx

        $ brew install nginx
      3. Run nginx

        $ sudo nginx

        After installation, go to http://localhost:8080 in a browser. if you see a “Welcome to nginx” message it was a successful install.

      4. Create a self signed certificate

        openssl req -new -x509 -nodes -days 3650 -newkey rsa:2048 -keyout /usr/local/certs/localhost-dev.key -out /usr/local/certs/localhost-dev.crt
         
        Country Name (2 letter code) [AU]:CA
        State or Province Name (full name) [Some-State]:BC
        Locality Name (eg, city) []:Kelowna
        Organization Name (eg, company) [Internet Widgits Pty Ltd]:DI
        Organizational Unit Name (eg, section) []:DI
        Common Name (e.g. server FQDN or YOUR name) []:localhost-axis.disney.network
         
        Email Address []:jacquie.armstrong@disney.com
      5. Configure NGINX
        1. Comment out default server blocks in nginx.conf

        2. Edit /usr/local/etc/nginx/nginx.conf so that there are two server blocks as follows

          server_names_hash_bucket_size 64;
          
          
          server {
          	listen       127.0.0.1:80;
          	location / {
          		return 302 https://localhost-axis.disney.network/;
          	}
          }
          
          server {
          	root    home/localhost-axis.disney.network/public_html;
          	listen       127.0.0.1:443 ssl;
              server_tokens off;
          	server_name  localhost-axis.disney.network;
          
          	ssl on;
          	ssl_certificate      /usr/local/certs/localhost-dev.pem;
          	ssl_certificate_key  /usr/local/certs/localhost-dev.key;
          
              log_not_found off;
          	access_log logs/localhost-axis.disney.network-access.log;
          	error_log logs/localhost-axis.disney.network-error.log;
          
          	location /6{
                  alias /usr/local/public_html/axis6-client;
          	}
          	location ~* ^/axis/(.*) {
          		proxy_pass http://localhost:8080/axis/$1$is_args$args;
                  proxy_connect_timeout 25;
                  proxy_send_timeout    25;
                  proxy_read_timeout    25;
                  send_timeout          25;
          	}
          	location /_ah {
          		proxy_pass http://localhost:8080/_ah;
          	}
          }
  1. Once axis server is running, and nginx is configured and running, you can load Axis locally by going to
    http://localhost-gae-axis.disney.network/axis/oidc
    This will have the front end being loaded by dev, but the back end referencing your local Axis server.
  2. Configure Axis
    1. Copy configs off dev1 ( /etc/disney/cstools/ )
  3. Using Postman
    1. Install Postman App
    2. Install Postman Interceptor extension
    3. Import some sample postman environments and calls in axis-server/postman
  4. Using Charles
    1. install charles
    2. add the following 3 lines to   /etc/disney/cstools/ client.properties
      #abstractclient.proxy_host=localhost

      #abstractclient.proxy_port=8888

      #abstractclient.allow_invalid_certs=true

Error rendering macro 'contentbylabel'

parameters should not be empty