cancel
Showing results for 
Search instead for 
Did you mean: 

How to create object of EnvironmentEndpointConfig

SOLVED
Highlighted
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 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Occasional Contributor

Re: How to create object of EnvironmentEndpointConfig

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);

 

View solution in original post

4 REPLIES 4
Highlighted
Community Leader

Re: How to create object of EnvironmentEndpointConfig

@UhsBat :

 

What error you are facing while implementing.


Click "Accept as Solution" if my answer has helped, and remember to give "kudos" 🙂 ↓↓↓↓↓



Thanks and Regards,
Himanshu Tayal
Highlighted
Occasional Contributor

Re: How to create object of EnvironmentEndpointConfig

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

 

Highlighted
Occasional Contributor

Re: How to create object of EnvironmentEndpointConfig

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);

 

View solution in original post

Highlighted
Community Manager

Re: How to create object of EnvironmentEndpointConfig

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


Sonya Mihaljova
Community and Education Specialist
Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
New Here?
Join us and watch the welcome video:
Announcements
Script Wanted
Let's start July with new challenges!

Create a script to change request body before sending it to the server for the TechCorner tag!


Scripts created in June:
- A script to generate a request body based on data from Datasource
- A script to go through all response nodes and check the value of the required field
- A Dispatching script to get responses based on the values in Request Body
- A script to add a new tag and assign it to all TestCases in a TestSuite
Top Kudoed Authors