Reputation: 41
I want to create SoapUI mock service for the endpoint: "/product/123456/details/". Here 123456 is path variable. I have created a soap ui mock service with path as "/product/" and in response I'm just giving back the path(Just for testing). When I run this mock service in SoapUI on port 8210, and hitting "http://localhost:8210/product/123456/details" works perfect. I get the below response.
"/product/123456/details"
But when I deploy this as mymockwar war in tomcat running on port 8080, If I hit "http://localhost:8080/mymockwar/product/123456/details/", Then I get the response as below.
<html>
<head>
<title>soapUI MockServices Log for project [MyNewMock]</title>
</head>
<body>
<h3>Log is disabled.</h3>
</body>
</html>
Now if I hit "http://localhost:8080/mymockwar/product/" it works and gives me the response as
"/product/"
How can I make this working with path variable when deployed in tomcat? Tomcat version: 7.0.22 SoapUI version: 4.5.2
Mock service xml below.
<?xml version="1.0" encoding="UTF-8"?>
<con:soapui-project xmlns:con="http://eviware.com/soapui/config" activeEnvironment="Default" name="MyNewMock" resourceRoot="" soapui-version="4.5.2" abortOnError="false" runType="SEQUENTIAL">
<con:settings />
<con:mockService port="8210" path="/product/" host="localhost" name="testSoapMock" bindToHostOnly="false" docroot="">
<con:settings>
<con:setting id="com.eviware.soapui.impl.wsdl.mock.WsdlMockService@require-soap-action">false</con:setting>
</con:settings>
<con:properties />
<con:onRequestScript>def method = mockRequest.method;
def path = mockRequest.path;
log.info path
def response = mockRequest.getHttpResponse()
response.setContentType("application/json")
def writer = response.getWriter();
writer.write(path)
writer.close()</con:onRequestScript>
</con:mockService>
<con:properties />
<con:wssContainer />
</con:soapui-project>
Upvotes: 1
Views: 1948
Reputation: 1
I faced same exception and solution is the name in url and the name in xml request they should be the same or name conflict
Ex:
URL: http://localhost:8088/mocks/queryBalance
Request :<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<ns3:queryBalanceRequestMsg xmlns:ns2="http://www.huawei.com/bme/cbsinterface/cbscommon" xmlns:ns3="http://www.huawei.com/bme/cbsinterface/arservices" xmlns:ns4="http://cbs.huawei.com/ar/wsservice/arcommon">
<requestHeader>
<ns2:ownershipInfo>
<ns2:beId>101</ns2:beId>
</ns2:ownershipInfo>
<ns2:accessSecurity>
<ns2:loginSystemCode>ecare01</ns2:loginSystemCode>
<ns2:password>Admin123!</ns2:password>
</ns2:accessSecurity>
<ns2:operatorInfo>
<ns2:operatorId>9001</ns2:operatorId>
</ns2:operatorInfo>
</requestHeader>
<queryBalanceRequest>
<ns3:serviceNumber>1511661998</ns3:serviceNumber>
</queryBalanceRequest>
</ns3:queryBalanceRequestMsg>
</soap:Body>
</soap:Envelope>
when URL was queryBalance it was return your exception
Upvotes: 0