If you want to create a Web Service control that accesses an external web service and you are working form behind a proxy server such as a firewall, you first need to configure WebLogic Workshop to work with the proxy server. This configuration involves two separate steps. First, you need to configure the Weblogic Workshop IDE to recognize the proxy server. Second, you need to configure the WebLogic Workshop runtime.
To Configure the WebLogic Workshop IDE
At this point you can design a web service control for an external web service in the IDE.
To Configure the WebLogic Workshop RunTime
To configure the WebLogic Workshop runtime, you must first create a JAR containing a SoapProxyAuthenticator class, and then configure WebLogic Workshop server to include the JAR.
To build the JAR, you need to create a Java project. For more information on working with a Java project, see How Do I: Reuse Existing Java Code?
To build the JAR:
package webservices;
public class SoapProxyAuthenticator implements
weblogic.common.ProxyAuthenticator
{
public final static String PROXY_USER =
"http.proxyUser";
public final static String PROXY_PASSWORD =
"http.proxyPassword";
public SoapProxyAuthenticator() {}
public String[] getLoginAndPassword()
{
String proxyUser =
System.getProperty(PROXY_USER);
String proxyPassword =
System.getProperty(PROXY_PASSWORD);
if (proxyUser == null ||
proxyPassword == null) return null;
return
new String[]{ proxyUser, proxyPassword };
}
public void init(String httpProxyHost, int
httpProxyPort, String authenticationType,String loginPrompt)
{
this.httpProxyHost =
httpProxyHost;
this.httpProxyPort =
httpProxyPort;
this.authenticationType =
authenticationType;
this.loginPrompt =
loginPrompt;
if (DEBUG)
{
System.out.println("[SoapProxyAuthenticator.init(String,int,String,String)]
httpProxyHost="
+ httpProxyHost);
System.out.println("[SoapProxyAuthenticator.init(String,int,String,String)]
httpProxyPort="
+ httpProxyPort);
System.out.println("[SoapProxyAuthenticator.init(String,int,String,String)]
authenticationType="
+ authenticationType);
System.out.println("[SoapProxyAuthenticator.init(String,int,String,String)]
loginPrompt="
+ loginPrompt);
}
}
//private:
private final static boolean DEBUG = true;
private String httpProxyHost;
private int httpProxyPort;
private String authenticationType;
private String loginPrompt;
}
set
PROXY_PROPERTIES=-Dweblogic.net.proxyAuthenticatorClassName=webservices.SoapProxyAuthenticator
-Dhttp.proxyHost=Your proxy server's address -Dhttp.proxyPort=Your
proxy server's port -Dhttp.proxyUser=Your proxy server's username
-Dhttp.proxyPassword=Your proxy server's password
-Dhttp.nonProxyHosts=localhost
REM
REM SET UP CLASSPATHS
REM
set
PRE_CLASSPATH=%WL_HOME%\common\lib\log4j.jar;%ARDIR%\ojdbc14.jar;%ARDIR%\debugging.jar;%ARDIR%\knex.jar;%ARDIR%\javelin.jar;%ARDIR%\wlw-lang.jar;%ARDIR%\webservice-proxy-auth.jar;
@REM STUFF DONE ONLY BY US
@set JAVA_OPTIONS=%JAVA_OPTIONS% %JAVA_PROPERTIES% %PROXY_PROPERTIES%
-Dweblogic.Name=%SERVER_NAME%
-Dweblogic.security.SSL.ignoreHostnameVerify=false -
Dwlw.iterativeDev=%iterativeDevFlag% -Dwlw.testConsole=%testConsoleFlag%
-XX:MaxPermSize=128m –ea
Related Topics