protected URL buildURL(Map<String,String> headers, String instanceHostPort) throws MalformedURLException {
        String origUrl = headers.get(Listener.METAINFO_REQUEST_URL);
        if (origUrl == null || !origUrl.startsWith("http")) {
            // other protocol: forward to standard services url
            return new URL("http://" + instanceHostPort + "/" + getServicesRoot() + "/Services");
        }
        else {
            URL origHttpUrl = new URL(origUrl);
            String path = origHttpUrl.getPath();
            // Re-route from SOAP to REST since MDW only cares about message Payload, plus we no longer have the SOAP Envelope in the request
            if (path != null && (path.contains("/SOAP") || path.contains("/MDWWebService")))
                path = "/" + getServicesRoot() + "/Services";

            String destUrl = origHttpUrl.getProtocol() + "://" + instanceHostPort + path;
            if (!StringHelper.isEmpty(headers.get(Listener.METAINFO_REQUEST_QUERY_STRING)))
                destUrl += "?" + headers.get(Listener.METAINFO_REQUEST_QUERY_STRING);
            return new URL(destUrl);
        }
    }
protected URL buildURL ( Map < String , String > headers , String instanceHostPort ) throws MalformedURLException { String origUrl = headers . get ( Listener . METAINFO_REQUEST_URL ) ; if ( origUrl == null || ! origUrl . startsWith ( "http" ) ) { return new URL ( "http://" + instanceHostPort + "/" + getServicesRoot ( ) + "/Services" ) ; } else { URL origHttpUrl = new URL ( origUrl ) ; String path = origHttpUrl . getPath ( ) ; if ( path != null && ( path . contains ( "/SOAP" ) || path . contains ( "/MDWWebService" ) ) ) path = "/" + getServicesRoot ( ) + "/Services" ; String destUrl = origHttpUrl . getProtocol ( ) + "://" + instanceHostPort + path ; if ( ! StringHelper . isEmpty ( headers . get ( Listener . METAINFO_REQUEST_QUERY_STRING ) ) ) destUrl += "?" + headers . get ( Listener . METAINFO_REQUEST_QUERY_STRING ) ; return new URL ( destUrl ) ; } }
Override this to build the destination URL differently.