How to create object of EnvironmentEndpointConfig
SOLVED- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
Solved! Go to Solution.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@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
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @HimanshuTayal
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
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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);
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am glad to hear you managed to find a solution! Great job, thanks for sharing @UhsBat
Sonya Mihaljova
Community and Education Specialist
