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.

To retrieve the WSDL file 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.

To use the IDE to test the 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.

To deploy to the Sun Java System Application 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 Sun Java System Application 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 Sun Java System Application Server is not started, start it.
  3. Expand Sun Java System Application Server's node, right-click the JVM's node, and choose Properties.
  4. In the JVM's Properties dialog box, click JVMOptions.
  5. Add the following properties:

    -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.

To deploy to 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.

To deploy to 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.

To deploy 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