Quantcast
Channel: New board topics in SmartBear Community
Viewing all articles
Browse latest Browse all 20073

Setting the Authentication type for WsdlRequest programmatically

$
0
0

Hi,

 

I need to set the authentication type for WsdlRequest programmatically through groovy script. I am using the below code

 

File projectFile =new File("D:\\TestProjectA-soapui-project.xml");

 

WsdlProject project=new WsdlProject("GroovyGeneratedProject");

WsdlInterface[] wsdls;

wsdls = WsdlImporter.importWsdl(project, "C:\\WSDL\\UserDetails.wsdl");

WsdlInterface wsdl

int operationCount;

def WssC;

for(int j=0;j<wsdls.length;j++)

{

wsdl = wsdls[j];

operationCount=wsdl.getOperationCount();

}

WssC=project.getWssContainer();

if(!WssC.getOutgoingWssList().contains("testing")){

                def owss = WssC.addOutgoingWss("testing");

   owss.setActor("Test");

   owss.setPassword("Test");

   owss.setUsername("Test");

   owss.setMustUnderstand(true);

}

for(int i=0;i<operationCount;i++)

{

WsdlOperation op = wsdl.getOperationByName("deleteUser");

String opName = op.getName();

WsdlRequest req = op.addNewRequest("Req_"+opName);

req.setRequestContent("somexmlformat");

req.setEndpoint("EndpointUrl");

req.setOutgoingWss("testing");

req.addBasicAuthenticationProfile("Basic");

break;

}

project.saveIn(projectFile);

 

 

With this code, I am able to set the outgoingWss config and BasicAuthentication Profile for WsdlRequest. Still I need to set the settings, Authtype and SelectedAuthProfile for WsdlRequest. I tried using setSettings() method. But it is throwing error like only getSettings() method can be used.

 

Please suggest me which methods should be used.


Viewing all articles
Browse latest Browse all 20073

Trending Articles