Ask a Question

How to create object of EnvironmentEndpointConfig

SOLVED
UhsBat
Occasional Contributor

How to create object of EnvironmentEndpointConfig

I have a readyAPI project  and it has only default environemnt. I want to create a new environment(DEV) and add all the services using groovy. I searched some code, but it fails to cast url to EnvironmentEndpointConfig. 

 

import com.eviware.soapui.model.environment.ServiceImpl
def wsdl = testRunner.testCase.testSuite.project.getInterfaceAt(0)
def newEnv = testRunner.testCase.testSuite.project.addNewEnvironment("ABC")

def nameofService =  testRunner.testCase.testSuite.project.getInterfaceAt(0).name

ServiceImpl soapService = newEnv.addNewService(nameofService, com.eviware.soapui.config.ServiceConfig.Type.SOAP)
URL url = new URL(wsdl.getDefinition());
com.eviware.soapui.config.EnvironmentEndpointConfig epConfig = com.eviware.soapui.config.EnvironmentEndpointConfig.Factory.parse(url);
EndpointImpl epImpl = new EndpointImpl(epConfig, soapService);
soapService.setEndpoint(epImpl);

Please guide me 

4 REPLIES 4
HimanshuTayal
Community Hero

@UhsBat :

 

What error you are facing while implementing.


Click "Accept as Solution" if my answer has helped,
Remember to give "Kudos" 🙂 ↓↓↓↓↓



Thanks and Regards,
Himanshu Tayal
UhsBat
Occasional Contributor

Hi @

 

I am trying to create object of EnvironmentEndpointConfig, but not sure if this is correct way. I am getting 'Connection refused' error.

 

I was trying to implement as given in

https://community.smartbear.com/t5/SoapUI-Pro/how-to-set-SOAP-and-REST-Service-Endpoint-into-Environ...

 

UhsBat_0-1593520846493.png

 

UhsBat
Occasional Contributor

Finally it worked, I just created a string and converted into  EnvironmentEndpointConfig 

 

def str = '<xml-fragment authProfile="No Authorization" username="" password="" domain="" incomingWss="" outgoingWss="" wssTimeToLive="" wssType="" proxyHost="" proxyPort="" proxyUsername="" proxyPassword="" xmlns:con="http://eviware.com/soapui/config">' + NewUrl+ '</xml-fragment>'
com.eviware.soapui.config.EnvironmentEndpointConfig epConfig = com.eviware.soapui.config.EnvironmentEndpointConfig.Factory.parse(str);
EndpointImpl epImpl = new EndpointImpl(epConfig, soapService);
soapService.setEndpoint(epImpl);

 

sonya_m
SmartBear Alumni (Retired)

I am glad to hear you managed to find a solution! Great job, thanks for sharing @UhsBat 


Sonya Mihaljova
Community and Education Specialist

cancel
Showing results for 
Search instead for 
Did you mean: