Forum Discussion

kumartin's avatar
kumartin
New Contributor
14 years ago

Programmically setting the basic authentication credentials

I'm using soapUI version 4.0.1 apis to import a WSDL in a WSDL Wizard that I developed and was wondering if it's possible to set the basic authentication credentials username and password similiar to how the proxy username and password on a WsdlProject? I have a need for this since the some WSDL can only be reached through https.

WsdlProject project = new WsdlProject();
project.getSettings().setString(com.eviware.soapui.settings.ProxySettings.USERNAME, proxyUsername);
project.getSettings().setString(com.eviware.soapui.settings.ProxySettings.PASSWORD, proxyPassword);

I don't see anything is the com.eviware.soapui.settings classes that will allow me to do this? Am I missing something?

When importing this WSDL into the actual SoapUI, it pops up a seperate window to specify the basic authentication credentials username and password. Could I somehow get the SoapUI basic authentication credentials window to pop up in my Wizard UI to allow the user to enter the credentials?

Thanks
  • kumartin's avatar
    kumartin
    New Contributor
    I have tried the both the suggestions from topic http://www.eviware.com/forum/viewtopic.php?t=4562. Both do not seem to work in version 4.0.1, it this something that is only avaliable in the Pro Version or should it work? Below is the snippet of code I'm using:

    System.setProperty("soapui.loader.username","admin");
    System.setProperty("soapui.loader.password","aexxxx");

    WsdlInterface[] ifaceArray = WsdlInterfaceFactory.importWsdl(project, wsdl.toString(), true);


    Any ideas would be greatly appreciated. Thanks


    Re: Update wsdl definition via API (Basic Authentication)
    by SmartBear Support » 29 Sep 2010 01:45

    Hello,

    You should be able to use the [protocol]://[user]:[pass]@[path] format, which version of soapUI are you using? Could you try updating to the latest nightly build?

    You can also use the System Properties "soapui.loader.username" and "soapui.loader.password" to programatically provide the credentials.

    Regards,
    Dain
    eviware.comSmartBear Support
    Administrator


    Posts: 5161
    Joined: 16 Feb 2009 01:53