Here's an example of a simple SoapUI mock service to emulate a data-dictionary running on port 443.
Details about the API can be found in Integration with Data Dictionary.
Supported URIs
This mock service can handle the following queries
URI | Valid Values |
---|---|
commonModelElements/instance~vfModuleNetworkType~1.0/validateInstance | "l3-network", "l3-network-other" |
commonModelElements/attribute~networkType~1.0/validateInstance | "l3-network", "l3-network-other" |
Possible results
Returns | HTTP code | Body | Details |
---|---|---|---|
Success | 200-OK | When the submitted value exists | |
InvalidValue | 404-NotFound | { "VF-Module network type is invalid" } | When the submitted value is not in the list |
NotAcceptable | 406-NotAcceptable | { "instance data missing or invalid" } | When request content is not valid |
SoapUI Project
<?xml version="1.0" encoding="UTF-8"?> <con:soapui-project id="11bcea31-958e-42a2-941c-aae9994035c6" activeEnvironment="Default" name="Data-Dictionary-MockService" resourceRoot="" soapui-version="5.2.1" xmlns:con="http://eviware.com/soapui/config"> <con:settings/> <con:restMockService id="b5abed92-a306-4901-a4d3-08fc8df0f7ce" port="443" path="/commonModelElements" host="dummy-host" name="MockService-commonModelElements" docroot=""> <con:settings/> <con:properties/> <con:restMockAction name="/instance~vfModuleNetworkType~1.0" method="POST" resourcePath="/instance~vfModuleNetworkType~1.0" id="38e636c9-417f-442a-be4d-72a7d9642315"> <con:settings/> <con:defaultResponse>NotAcceptable</con:defaultResponse> <con:dispatchStyle>SCRIPT</con:dispatchStyle> <con:dispatchPath>log.info "request body: ${mockRequest.getRequestContent()}" def requestBody = mockRequest.getRequestContent() if(requestBody == null || requestBody.isEmpty()) { log.error "Request body is missing" return 'NotAcceptable' } def content = new groovy.json.JsonSlurper().parseText(requestBody) if(content == null || content.isEmpty()) { log.error "Content missing" return 'NotAcceptable' } def validTypes = ['[l3-network]', '[l3-network-other]'] def type = content.instance.type.toString() if(!validTypes.contains(type)) { log.error "type value '$type' not in list $validTypes" return 'InvalidValue' } return 'Success'</con:dispatchPath> <con:response name="Success" id="49d480f2-0320-44c8-b20a-272a97e8fa64" httpResponseStatus="200" mediaType="application/json"> <con:settings/> <con:responseContent/> </con:response> <con:response name="InvalidValue" id="e4e045c3-59c4-4674-9dcf-c530d0a126bd" httpResponseStatus="404" mediaType="application/json"> <con:settings/> <con:responseContent>{ "VF-Module network type is invalid" }</con:responseContent> </con:response> <con:response name="NotAcceptable" id="2fb80ca5-7138-4d1b-89e0-23cdd2f22a4d" httpResponseStatus="406" mediaType="application/json"> <con:settings/> <con:responseContent>{ "instance data missing or invalid" }</con:responseContent> </con:response> </con:restMockAction> <con:restMockAction name="/attribute~networkType~1.0" method="POST" resourcePath="/attribute~networkType~1.0" id="fec546e4-2e7d-4f18-bbd3-cc4c7261be88"> <con:settings/> <con:defaultResponse>NotAcceptable</con:defaultResponse> <con:dispatchStyle>SCRIPT</con:dispatchStyle> <con:dispatchPath>log.info "request body: ${mockRequest.getRequestContent()}" def requestBody = mockRequest.getRequestContent() if(requestBody == null || requestBody.isEmpty()) { log.error "Request body is missing" return 'NotAcceptable' } def content = new groovy.json.JsonSlurper().parseText(requestBody) if(content == null || content.isEmpty()) { log.error "Content missing" return 'NotAcceptable' } def validTypes = ['l3-network', 'l3-network-other'] def type = content.instance.toString() if(!validTypes.contains(type)) { log.error "type value '$type' not in list $validTypes" return 'InvalidValue' } return 'Success'</con:dispatchPath> <con:response name="Success" id="f1da00ba-cbec-4e33-acb7-1dc5a3656776" httpResponseStatus="200" mediaType="application/json"> <con:settings/> <con:responseContent/> </con:response> <con:response name="InvalidValue" id="533b2a6f-8cbf-4dd1-954d-d2d67d3bbde2" httpResponseStatus="404" mediaType="application/json"> <con:settings/> <con:responseContent>{ "VF-Module network type is invalid" }</con:responseContent> </con:response> <con:response name="NotAcceptable" id="2f07c34f-b862-4338-b13b-d729f847dc86" httpResponseStatus="406" mediaType="application/json"> <con:settings/> <con:responseContent>{ "instance data missing or invalid" }</con:responseContent> </con:response> </con:restMockAction> </con:restMockService> <con:properties/> <con:wssContainer/> <con:oAuth2ProfileContainer/> <con:sensitiveInformation/> </con:soapui-project>