• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

howto connect a webservice via a proxy server ?

 
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi,
i cannot connect a webservice via a proxy.
i tried this:


i don't know what's wrong, i get an exception "Unauthorized" in the last line of this code. without a proxy and the direct input of the URL in the last line it works fine !
thanks for help
heiner
[ January 02, 2003: Message edited by: heiner weilandt ]
 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
SOAP v1.2 gives a way to set the proxy.That should work for u.Try it out..
 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Or, Delete the properties stuff in the code and simply execute like this,
java -Dhttp.proxyHost=proxy.com -Dhttp.proxyPort=port classname.
 
heiner weilandt
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks, the way with the parameters should work, but how can i set USER and PASSWORD ?
and:
how can i set the soap 1.2 - proxy ?
can you give me an simple example ?
thanks a lot
[ January 14, 2003: Message edited by: heiner weilandt ]
 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You forget to set the properties back to System before you instantiate URL
java.util.Properties prop = System.getProperties(); prop.put("proxySet","true"); prop.put("http.proxyHost","proxy.mycompany.com"); prop.put("http.proxyPort","8080");

System.setProperties(prop);

URL url = new URL("http://myService/services/myServicePort"); URLConnection conn = url.openConnection(); String password = "user ass"; String auth = "Basic " + new sun.misc.BASE64Encoder().encode(password.getBytes()); conn.setRequestProperty( "Proxy-Authorization", auth); System.out.println( "Url Connection opened"); conn.connect(); WsEmployeeServicePortType ws = new WsEmployeeServiceLocator().getWsEmployeeServicePort(conn.getURL());
 
heiner weilandt
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi,
now i can use a proxy, but i don't check it out to authentificate. i always get the error "Unauthorized".
what's wrong.
the source is up !
thanks heiner
 
The moth suit and wings road is much more exciting than taxes. Or this tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic