Forum Discussion
PaulDonny
11 years agoRegular Contributor
Sadly I do not have any Java code that would build this currently. The beautiful parts of this script is that it essentially uses all of the functions from SoapUI itself so I will set up a basic script that will set it up really quick.
I set this up using SoapUI's groovy scripts so it might need some adjusting to go into Java (I tried to make that as friendly as possible).
I am not sure how well this works since I don't use mockservices. If you use it, please let me know how it works out for you. Just an FYI, this will only build the project file to be ran within SoapUI. If you want to run it externally, you will have to just use the commands from SoapUI's API to run the mockservice and then remove the System.exit(0); portion at the end.
I set this up using SoapUI's groovy scripts so it might need some adjusting to go into Java (I tried to make that as friendly as possible).
import com.eviware.soapui.model.mock.*;
import com.eviware.soapui.model.iface.*;
import com.eviware.soapui.impl.wsdl.mock.*;
//Below line required for SoapUI groovy step. If you use the above code the project variable is already declared
//def project = testRunner.testCase.testSuite.project;
WsdlMockService ms = project.addNewMockService(project.getName());
for (Interface inf:project.getInterfaceList()) {
for (Operation ops:inf.getAllOperations()) {
WsdlMockOperation mo = ms.addNewMockOperation(ops);
WsdlMockResponse mr = mo.addNewMockResponse(ops.getName(),true);
}
}
I am not sure how well this works since I don't use mockservices. If you use it, please let me know how it works out for you. Just an FYI, this will only build the project file to be ran within SoapUI. If you want to run it externally, you will have to just use the commands from SoapUI's API to run the mockservice and then remove the System.exit(0); portion at the end.
Related Content
- 6 years ago
- 8 years ago
- 5 years ago
Recent Discussions
- 15 years ago