WebServices ant WSDLToJava with HTTPProxy user and password

573 Views Asked by At

Using the ant build file am generating the java classes from the WSDL file. As am behind a firewall teh ant task is complaining unknown host exception.

Looking at the docs , i set up the proxy host name and proxy port but not clear on how to set teh proxy username and password.PFB the snipper from my ant task. I also tried

wsdl.home = http://ups1.custhelp.com/cgi-bin/ups1.cfg/services/soap?wsdl axis2.home = D:/softs/axis2-1.6.2

       <target name = "defProxy">
<setproxy proxyhost="proxy.njc.ups.com" proxyport="8080" 
     proxyuser="xxxx" proxypassword="xxxx" />

      <target name="axis2WSDLToJava">
<java classname="org.apache.axis2.wsdl.WSDL2Java" fork="true">
<classpath refid="axis2.classpath"/>
        <arg value="http-proxy-host"/>
        <arg value="proxy.njc.ups.com"/>
        <arg value="http-proxy-port"/>
        <arg value="8080"/>
        <arg value="-uri"/>
        <arg value="${wsdl.home}"/>
        <arg value="-ns2p"/>
        <arg value="urn:wsdl.ws.rightnow.com/v1=com.rightnow.ws.wsdl,urn:objects.ws.rightnow.com/v1=com.rightnow.ws.objects,urn:messages.ws.rightnow.com/v1=com.rightnow.ws.messages,urn:common.ws.rightnow.com/v1=com.rightnow.ws.common"/>
        <arg value="-o"/>
        <arg file="${build.src.dir}"/>
        <arg value="--noBuildXML"/>
        <arg value="-Ejavaversion"/>
        <arg value="1.6"/>
        <arg value="-Eproxy-user"/>
        <arg value="XXXX"/>
        <arg value="-Eproxy-password"/>
        <arg value="xxxx"/>

        <arg value="-u"/>
        <arg value="-uw"/>
        <arg value="-or"/>

I need to generate the java classes from the WSDL. Please help

1

There are 1 best solutions below

0
On

You can use <sysproperty> element within java task.

Since you are using http url, you can use http.proxyHost and http.proxyPort. For more information, see Java guide for proxies.

Example:

<java classname="org.apache.axis2.wsdl.WSDL2Java" fork="true">
    <classpath refid="axis2.classpath"/>
    <sysproperty key="http.proxyHost" value="proxy.njc.ups.com" />
    <sysproperty key="http.proxyPort" value="8080" />
    ...
</java>