private static String rewriteSoapAddress ( SOAPAddressRewriteMetadata sarm , String origAddress , String newAddress , String uriScheme ) { try { URL url = new URL ( newAddress ) ; String path = url . getPath ( ) ; String host = sarm . getWebServiceHost ( ) ; String port = getDotPortNumber ( uriScheme , sarm ) ; StringBuilder sb = new StringBuilder ( uriScheme ) ; sb . append ( "://" ) ; sb . append ( host ) ; sb . append ( port ) ; if ( isPathRewriteRequired ( sarm ) ) { sb . append ( SEDProcessor . newInstance ( sarm . getWebServicePathRewriteRule ( ) ) . processLine ( path ) ) ; } else { sb . append ( path ) ; } final String urlStr = sb . toString ( ) ; ADDRESS_REWRITE_LOGGER . addressRewritten ( origAddress , urlStr ) ; return urlStr ; } catch ( MalformedURLException e ) { ADDRESS_REWRITE_LOGGER . invalidAddressProvidedUseItWithoutRewriting ( newAddress , origAddress ) ; return origAddress ; } }
Rewrite the provided address according to the current server configuration and always using the specified uriScheme .