Setting a Proxy for Web Services and Clients

See Also 

If you want to access a remote web service, but your system is behind a firewall or you use a proxy server, you need to configure the IDE with your proxy settings. For working with remote web services, setting a proxy can be important in one or more of the following areas:

The proxy settings for each of the situations above are described below.

Setting Proxy When Retrieving WSDL Files in the Web Service Client Wizard

Typically, an error such as the following is displayed in the Web Service Client wizard when the proxy settings for retrieving a WSDL file have not been set correctly:

Download failed. I/O exception: (Check the proxy settings.)

Do the following to check and set the proxy:

  1. Click Proxy Settings in the Web Service Client wizard.
  2. In the HTTP Proxy Settings window, set the proxy host and port number.

The changes take effect when you click OK.

Setting Proxy When Testing a Web Service

Typically, an error such as the following is returned when the proxy settings for testing a web service from the IDE have not been set correctly:

org.netbeans.modules.websvc.registry.ui.ReflectionHelper.callMethodWithParams(ReflectionHelper.java:449)

Do the following to check and set the proxy:

  1. Choose Tools > Options.
  2. In the Options window, set the proxy host and port number.

The changes take effect when you exit the Options window.

Setting a Proxy on the GlassFish Server

Typically, an error such as the following is returned when the proxy settings for a web service or web service client deployed to the GlassFish Server have not been set correctly:

java.rmi.RemoteException: HTTP transport error: java.net.UnknownHostException:

Do the following to check and set the proxy:

  1. Open the Services window (Ctrl-5).
  2. If the GlassFish Server is not started, start it.
  3. Right-click the GlassFish Server node and select View Admin Console. The Administration Console opens in a browser.
  4. In the left side tree menu, go to Configurations > server-config > JVM settings. The JVM General Settings page opens.
  5. Click Add JVM Option. An empty field appears in the top of the list of JVM options.
  6. Type in the following property:

    -Dhttp.proxyHost=your.proxy.host

  7. Click Add JVM Option again and type in the following property:
    -Dhttp.proxyPort=your.proxy.port.number
  8. Click Save.

Stop and restart the server for the new proxy settings to take effect.

Setting a Proxy on the WebLogic Server

Typically, an error such as the following is returned when the proxy settings for a web service or web service client deployed to the WebLogic Server have not been set correctly:

java.rmi.RemoteException: HTTP transport error: java.net.UnknownHostException:

Do the following to check and set the proxy:

  1. Open the Services window (Ctrl-5).
  2. If the WebLogic Server is not started, start it.
  3. Right-click the WebLogic Server node and select View Admin Console. The Administration Console opens in a browser.
  4. Log in. The main page of the Admin Console opens.
  5. Go to Environment > Servers. A table of servers appears.
  6. In the table of servers, click the name of the server for which you want to set a proxy. The Settings page for that server appears.
  7. Select the Configuration tab and the Server Start sub-tab. A page opens for configuring Node Manager startup settings.
  8. In the Arguments field, type or paste in the following two arguments, separated by a space:
    -Dhttp.proxyHost=your.proxy.host -Dhttp.proxyPort=your.proxy.port.number
  9. Click Save.

Setting a Proxy on the JBoss Server

Typically, nothing is displayed in the browser when the proxy settings for a web service or web service client deployed to JBoss have not been set correctly.

Do the following to check and set the proxy:

  1. In your filesystem, go to jboss_install_dir\bin\run.bat.
  2. Add this line: set JAVA_OPTS=-Dhttp.proxyHost=your.proxy.host -Dhttp.proxyPort=your.proxy.port.number

Stop and then restart the server for the new proxy settings to take effect.

Setting a Proxy on the Tomcat Web Server

Typically, nothing is displayed in the browser when the proxy settings for a web service or web service client deployed to JBoss have not been set correctly.

Do the following to check and set the proxy:

  1. Open the Services window (Ctrl-5).
  2. If the Tomcat Web Server is started, stop it.
  3. Right-click the Tomcat node and choose Properties.
  4. In the Platform tab, add the following properties in the VM Options text box:

    -Dhttp.proxyHost=your.proxy.host
    -Dhttp.proxyPort=your.proxy.port

Start the server for the new proxy settings to take effect.

Setting a Proxy When Deploying a Web Service Client in a Java Application

Typically, an error such as the following is returned when the proxy settings for a web service or web service client deployed from a Java application have not been set correctly:

java.rmi.RemoteException: HTTP transport error: java.net.UnknownHostException:

Do the following to check and set the proxy:

  1. Right-click the Java application project node in the Projects window and choose Properties.
  2. In the Project Properties dialog box, click Run.
  3. Add the following properties to the VM Options field:

    -Dhttp.proxyHost=your.proxy.host -Dhttp.proxyPort=your.proxy.port

The changes take effect when you click OK.

Note that for client deployment from Java applications, you must set the proxy for each project, because each Java application runs as a stand-alone JVM process and each can provide different JVM parameters. For web applications sharing the same instance of a server, you need set the proxy only once -- on the server itself, as described above.

See Also
About Web Services

Legal Notices