1

I have created client code of an https web service using soapUI and apache-cxf-2.7.2. There is a class named MYService_BasicEndpoint_Client.java which contains this method:

public static void main(String args[]) throws java.lang.Exception {
URL wsdlURL = MYServiceWcf.WSDL_LOCATION;
if (args.length > 0 && args[0] != null && !"".equals(args[0])) { 
    File wsdlFile = new File(args[0]);
    try {
        if (wsdlFile.exists()) {
            wsdlURL = wsdlFile.toURI().toURL();
        } else {
            wsdlURL = new URL(args[0]);
        }
    } catch (MalformedURLException e) {
        e.printStackTrace();
    }
}    MYServiceWcf ss = new MYServiceWcf(wsdlURL, SERVICE_NAME);
IMYService port = ss.getBasicEndpoint();
port.webserviceMethod();
}

But when I run it the result is http response 401 (Unauthorized) because there isn't any option to set username and password of https web service. But I can run test case of this service within soapUI because there is an option to set username and password for endpoint. how can I set them within the code above which created by soapUI and apache-cxf-2.7.2?

John Saunders
  • 160,644
  • 26
  • 247
  • 397
nazila
  • 93
  • 1
  • 1
  • 10
  • this has nothing to do with https, but with http basic authentication, please post your configuration – guido Mar 06 '13 at 01:57
  • I don't have any configuration! just the classes that generated by soapUI using aache cxf. what do you mean by configuration? – nazila Mar 06 '13 at 02:14
  • 1
    ah I see; this will help you http://stackoverflow.com/questions/705728/how-do-i-consume-a-web-service-protected-with-http-basic-authentication-using-th – guido Mar 06 '13 at 02:18

0 Answers0