Java SOAP web service over SSL with basic authentication, connection refused -


i trying send soap request on ssl own little java client , fails "java.net.connectexception: connection refused". same request sent soapui not fail, valid response server.

this code trying run:

public static void main(string[] args) throws malformedurlexception {

    system.setproperty("sun.security.ssl.allowunsaferenegotiation", "true");     sslutilities.trustallhttpscertificates();      url wsdlurl = new url(my_wsdl_location);     qname servicename = new qname(my_qname, name_of_service);     service service = service.create(wsdlurl, servicename);     order myorder  = service.getport(order.class);     bindingprovider portbp = (bindingprovider) myorder;     string urlused = (string) portbp.getrequestcontext().            get(bindingprovider.endpoint_address_property);        system.out.println("using url: " + urlused);       ((bindingprovider)myorder).getrequestcontext().put(            bindingprovider.username_property, correct_username);        ((bindingprovider)myorder).getrequestcontext().put(            bindingprovider.password_property, correct_password);           aliverequest aliverequest = new aliverequest();         merchantinfo merchinfo = new merchantinfo();         merchinfo.setmerchantid(correct_merchant_id);         aliverequest.setmerchantinfo(merchinfo);        aliveresponse aliveresponse = myorder.alive(aliverequest);  } 

it fails "java.net.connectexception: connection refused" exception. when build request same wsdl using soapui, populate same fields same values , enter same basic authentication credentials, valid response returned.

the problem fact java client didn't send request through proxy, own company's firewall blocking it. unlike own java client, soapui detects proxy settings of system (probably reads system environment variables) when soapui's proxy settings set "auto" (default). solution set following system properties:

-dhttps.proxyset=true -dhttps.proxyhost=my_proxy_host -dhttps.proxyport=my_proxy_port 

Comments

Popular posts from this blog

html - Sizing a high-res image (~8MB) to display entirely in a small div (circular, diameter 100px) -

java - IntelliJ - No such instance method -

identifier - Is it possible for an html5 document to have two ids? -