test case data config xml
<?xml version="1.0" encoding="UTF-8"?> <webservices> <version number="1"> <service name="AuthenticateService"> <wsdlFileName>AuthenticateService.wsdl</wsdlFileName> <servicePath>/mockrgtServicesV1</servicePath> <operation name="authenticate"> <!-- Binding the response whose name is equal to this mock request's UniqueId to this request --> <!-- If the operation has only one test case, set a defaultResponse is OK, no need to add xpath expression --> <xpathExpression>declare namespace ser='http://com.test.wagerlink/services'; //ser:authenticate[1]/ser:UniqueId/.</xpathExpression> <defaultResponse>testplayer1</defaultResponse> <testcase name="SUCCESS" SkinCode="GEN1" ChannelCode="INT" IntegrationModeCode="XFR"> <request name="request1"> <UniqueId>testplayer1</UniqueId> <SecureToken>this is securitytoken for testplayer</SecureToken> </request> <response name="testplayer1"> <Status> <StatusCode>101</StatusCode> <Message>no</Message> <Status>Complete</Status> </Status> <UniqueID>testplayer1</UniqueID> <Balance>12.0</Balance> <Currency>GBP</Currency> <Country>GB</Country> <StakeLimit>100</StakeLimit> <LossLimit>5</LossLimit> <SessionTimeout>30</SessionTimeout> </response> </testcase> <testcase name="SUCCESS2" SkinCode="GEN1" ChannelCode="INT" IntegrationModeCode="XFR"> <request name="request2"> <UniqueId>testplayer2</UniqueId> <SecureToken>this is securitytoken for testplayer</SecureToken> </request> <response name="testplayer2"> <Status> <StatusCode>101</StatusCode> <Message>no</Message> <Status>Complete</Status> </Status> <UniqueID>testplayer2</UniqueID> <Balance>12.0</Balance> <Currency>GBP22</Currency> <Country>GB</Country> <StakeLimit>100</StakeLimit> <LossLimit>5</LossLimit> <SessionTimeout>30</SessionTimeout> </response> </testcase> </operation> </service> <service name="PlayerBalanceService"> <wsdlFileName>PlayerBalanceService.wsdl</wsdlFileName> <servicePath>/mockrgtServicesV1_playerBalance</servicePath> <operation name="GetBalance"> <!-- Binding the response whose name is equal to this mock request's UniqueId to this request --> <!-- If the operation has only one test case, set a defaultResponse is OK, no need to add xpath expression --> <defaultResponse>testGetBalance1</defaultResponse> <testcase name="SUCCESS" SkinCode="GEN1" ChannelCode="INT" IntegrationModeCode="XFR"> <request name="request1"> <UniqueId>testGetBalance1</UniqueId> <SecureToken>test secure token</SecureToken> </request> <response name="testGetBalance1"> <Status> <StatusCode>101</StatusCode> <Message>no</Message> <Status>completed</Status> </Status> <UniqueID>testGetBalance1</UniqueID> <CurrencyCode>GBP</CurrencyCode> <Balance>11</Balance> </response> </testcase> </operation> </service> <service name="GenerateTicketService"> <wsdlFileName>GenerateTicket.wsdl</wsdlFileName> <servicePath>/mockrgtServicesV1_generateTicket</servicePath> <operation name="generateTicket"> <!-- Binding the response whose name is equal to this mock request's UniqueId to this request --> <!-- If the operation has only one test case, set a defaultResponse is OK, no need to add xpath expression --> <defaultResponse>testGenerateTicket1</defaultResponse> <testcase name="SUCCESS" SkinCode="GEN1" ChannelCode="INT" IntegrationModeCode="XFR"> <request name="request1"> <SkinCode>GEN1</SkinCode> <UniqueID>testUniqueId</UniqueID> <Password>123456</Password> </request> <response name="testGenerateTicket1"> <return>sucessfully generated ticket</return> </response> </testcase> </operation> </service> <service name="ReceiveGameTxnService"> <wsdlFileName>ReceiveGameTxnService.wsdl</wsdlFileName> <servicePath>/mockrgtServicesV1_ReceiveGameTxn</servicePath> <operation name="ReceiveGameTxnMessage"> <!-- Binding the response whose name is equal to this mock request's UniqueId to this request --> <!-- If the operation has only one test case, set a defaultResponse is OK, no need to add xpath expression --> <defaultResponse>testReceiveGameTxnMessage1</defaultResponse> <testcase name="SUCCESS" SkinCode="GEN1" ChannelCode="INT" IntegrationModeCode="XFR"> <request name="request1"> <UniqueId>testUniqueId</UniqueId> <CasinoSkinCode>GEN1</CasinoSkinCode> <GameTxnId>2011</GameTxnId> <TxnSequence>2001</TxnSequence> <Currency>GB</Currency> <SoftwareId>2007-001</SoftwareId> <TxnStartTime>2007</TxnStartTime> <TxnEndTime>2008</TxnEndTime> <TransactionStatus>testTxnStatus</TransactionStatus> <MinimumBetAmount>1.3</MinimumBetAmount> <WagerAmountHandle>22.2</WagerAmountHandle> <PayoutAmount>33.3</PayoutAmount> <Mode>tstMode</Mode> <SecureToken>tstSecureToken</SecureToken> </request> <response name="testReceiveGameTxnMessage1"> <Status> <StatusCode>101</StatusCode> <Message>no message</Message> <Status>completed</Status> </Status> <NsGameTxnId>26</NsGameTxnId> <Timestamp>123456</Timestamp> </response> </testcase> </operation> </service> <service name="rgtHeartBeatService"> <wsdlFileName>rgtHeartBeatService.wsdl</wsdlFileName> <servicePath>/mockrgtServicesV1_rgtHeartBeat</servicePath> <operation name="heartbeat"> <!-- Binding the response whose name is equal to this mock request's UniqueId to this request --> <!-- If the operation has only one test case, set a defaultResponse is OK, no need to add xpath expression --> <defaultResponse>testheartbeat1</defaultResponse> <testcase name="SUCCESS" SkinCode="GEN1" ChannelCode="INT" IntegrationModeCode="XFR"> <request name="request1"> <Timestamp>201101</Timestamp> </request> <response name="testheartbeat1"> <heartbeatinfo>12345</heartbeatinfo> </response> </testcase> </operation> </service> </version> </webservices>
transit test case to soapui mock service config xml
<?xml version="1.0" encoding="ISO-8859-1"?> <!-- Edited by XMLSpy?--> <xsl:stylesheet version="1.0" xmlns:v1DefaultNs="http://schemas.xmlsoap.org/wsdl/" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:con="http://eviware.com/soapui/config" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ser="http://com.test.wagertest/services" xmlns:java="java:com.test.webservices.casino.services.rgt" xmlns:javaTxn="java:com.test.webservices.casino.services.rgt.receivegametxn" > <xsl:param name="wsdlFileDir"/> <xsl:param name="serviceHost"/> <xsl:param name="servicePort"/> <xsl:output method="xml" version="1.0" indent="yes"/> <xsl:template match="/"> <xsl:apply-templates select="/webservices/version[@number='1']"/> </xsl:template> <xsl:template match="version"> <xsl:variable name="ser">http://com.test.wagertest/services</xsl:variable> <xsl:variable name="java">java:com.test.webservices.casino.services.rgt</xsl:variable> <xsl:variable name="javaTxn">java:com.test.webservices.casino.services.rgt.receivegametxn</xsl:variable> <!-- <con:soapui-project name="testV1">--> <xsl:element name="con:soapui-project"> <xsl:attribute name="name">testV1</xsl:attribute> <con:settings/> <xsl:for-each select="service"> <xsl:variable name="mockServiceName"><xsl:value-of select="@name"/></xsl:variable> <xsl:variable name="wsdlFilePath"><xsl:value-of select="$wsdlFileDir"/></xsl:variable> <xsl:variable name="wsdlFileName"><xsl:value-of select="./wsdlFileName/."/></xsl:variable> <xsl:variable name="wsdlURI"><xsl:value-of select="$wsdlFilePath"/>/<xsl:value-of select="$wsdlFileName"></xsl:value-of></xsl:variable> <xsl:variable name="interfaceName"><xsl:value-of select="document($wsdlURI)//v1DefaultNs:binding/@name"/></xsl:variable> <xsl:variable name="portTypeName"><xsl:value-of select="document($wsdlURI)//v1DefaultNs:portType/@name"/></xsl:variable> <xsl:variable name="servicePath"><xsl:value-of select="./servicePath/."/></xsl:variable> <xsl:variable name="targetNamespace"><xsl:value-of select="document($wsdlURI)//@targetNamespace"/></xsl:variable> <xsl:variable name="bindingName">{<xsl:value-of select="$targetNamespace"/>}<xsl:value-of select="$interfaceName"/></xsl:variable> <xsl:element name="con:interface"> <xsl:attribute name="xsi:type">con:WsdlInterface</xsl:attribute> <xsl:attribute name="wsaVersion">NONE</xsl:attribute> <xsl:attribute name="name"><xsl:value-of select="$interfaceName"/></xsl:attribute> <xsl:attribute name="type">wsdl</xsl:attribute> <xsl:attribute name="bindingName"><xsl:value-of select="$bindingName"/></xsl:attribute> <xsl:attribute name="soapVersion">1_1</xsl:attribute> <xsl:attribute name="anonymous">optional</xsl:attribute> <xsl:attribute name="definition"><xsl:value-of select="$wsdlURI"/></xsl:attribute> <con:settings/> <xsl:element name="con:definitionCache"> <xsl:attribute name="type">TEXT</xsl:attribute> <xsl:attribute name="rootPart"><xsl:value-of select="$wsdlURI"/></xsl:attribute> <xsl:element name="con:part"> <con:url><xsl:value-of select="$wsdlURI"></xsl:value-of></con:url> <xsl:text disable-output-escaping= "yes"><con:content></xsl:text> <xsl:text disable-output-escaping= "yes"><![CDATA[</xsl:text> <xsl:copy-of select="document($wsdlURI)"/> <xsl:text disable-output-escaping= "yes">]]></xsl:text> <xsl:text disable-output-escaping= "yes"></con:content></xsl:text> <con:type>http://schemas.xmlsoap.org/wsdl/</con:type> </xsl:element> </xsl:element> <con:endpoints> <con:endpoint>https://bossk:443/CasinoWS/Authenticate</con:endpoint> </con:endpoints> <xsl:for-each select="./operation"> <xsl:element name="con:operation"> <xsl:attribute name="isOneWay">false</xsl:attribute> <xsl:attribute name="action"></xsl:attribute> <xsl:attribute name="name"><xsl:value-of select="@name"/></xsl:attribute> <xsl:attribute name="bindingOperationName"><xsl:value-of select="@name"/></xsl:attribute> <xsl:attribute name="type">Request-Response</xsl:attribute> <xsl:attribute name="inputName"></xsl:attribute> <xsl:attribute name="receivesAttachments">false</xsl:attribute> <xsl:attribute name="sendsAttachments">false</xsl:attribute> <xsl:attribute name="anonymous">optional</xsl:attribute> <con:settings></con:settings> <xsl:variable name="operationName"><xsl:value-of select="@name"/></xsl:variable> <xsl:for-each select="testcase"> <xsl:element name="con:call"><xsl:attribute name="name"><xsl:value-of select="request/@name"/></xsl:attribute> <con:settings> <con:setting id="com.eviware.soapui.impl.wsdl.WsdlRequest@request-headers"><xml-fragment<xsl:text disable-output-escaping= "yes">/></xsl:text></con:setting> </con:settings> <con:encoding>UTF-8</con:encoding> <con:endpoint>http://<xsl:value-of select="$serviceHost"/>:<xsl:value-of select="$servicePort"/><xsl:value-of select="$servicePath"/> </con:endpoint> <xsl:for-each select="request"> <xsl:element name="con:request"> <xsl:text disable-output-escaping= "yes"><![CDATA[</xsl:text> <xsl:text disable-output-escaping= "yes"><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ser="</xsl:text> <xsl:value-of select="$targetNamespace"/><xsl:text disable-output-escaping= "yes">"></xsl:text> <soapenv:Header/> <soapenv:Body> <xsl:element name="ser:{$operationName}"> <xsl:for-each select="./*"> <xsl:element name="ser:{name()}" ><xsl:value-of select="."/></xsl:element> </xsl:for-each> </xsl:element> </soapenv:Body> <xsl:text disable-output-escaping= "yes"></soapenv:Envelope>]]></xsl:text> </xsl:element> </xsl:for-each> <con:jmsConfig JMSDeliveryMode="PERSISTENT"/><con:jmsPropertyConfig/> <xsl:element name="con:wsaConfig"> <xsl:attribute name="mustUnderstand">NONE</xsl:attribute> <xsl:attribute name="version">200508</xsl:attribute> <xsl:attribute name="action"><xsl:value-of select="$targetNamespace"/>/<xsl:value-of select="$portTypeName"/>/<xsl:value-of select="$operationName"/>Request</xsl:attribute> </xsl:element> <con:wsrmConfig version="1.2"/> </xsl:element> <!-- /con:call --> </xsl:for-each> </xsl:element> <!-- /con:operation --> </xsl:for-each> </xsl:element> <!-- /con:interface --> <!-- end of webService configuration --> <!-- *** mock service configuration *** --> <xsl:element name="con:mockService"><xsl:attribute name="port"><xsl:value-of select="$servicePort"/></xsl:attribute><xsl:attribute name="path"><xsl:value-of select="$servicePath"/></xsl:attribute><xsl:attribute name="host"><xsl:value-of select="$serviceHost"/></xsl:attribute><xsl:attribute name="name"><xsl:value-of select="$mockServiceName"/></xsl:attribute> <con:settings> <con:setting id="com.eviware.soapui.impl.wsdl.mock.WsdlMockService@require-soap-action">false</con:setting> </con:settings> <xsl:for-each select="./operation"> <xsl:variable name="operationName"><xsl:value-of select="@name"/></xsl:variable> <xsl:element name="con:mockOperation"> <xsl:attribute name="name"><xsl:value-of select="@name"/> </xsl:attribute> <xsl:attribute name="interface"><xsl:value-of select="$interfaceName"/> </xsl:attribute> <xsl:attribute name="operation"><xsl:value-of select="@name"/> </xsl:attribute> <con:settings/> <xsl:choose> <xsl:when test="./xpathExpression"> <con:dispatchPath><xsl:value-of select="./xpathExpression/."/></con:dispatchPath> <con:dispatchStyle>XPATH</con:dispatchStyle> </xsl:when> <xsl:otherwise> <con:dispatchStyle>SEQUENCE</con:dispatchStyle> </xsl:otherwise> </xsl:choose> <con:defaultResponse><xsl:value-of select="defaultResponse/."/> </con:defaultResponse> <xsl:for-each select="testcase"> <xsl:for-each select="response"> <xsl:element name="con:response"> <xsl:attribute name="name"><xsl:value-of select="./@name"/></xsl:attribute> <xsl:attribute name="encoding">UTF-8</xsl:attribute> <con:settings/> <con:responseContent> <xsl:text disable-output-escaping= "yes"><![CDATA[</xsl:text> <xsl:choose> <xsl:when test="$operationName='authenticate'"> <xsl:text disable-output-escaping= "yes"><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ser="</xsl:text><xsl:value-of select="$ser"/> <xsl:text disable-output-escaping= "yes">" xmlns:java="</xsl:text><xsl:value-of select="$java"/> <xsl:text disable-output-escaping= "yes">"></xsl:text> <soapenv:Header/> <soapenv:Body> <ser:authenticateResponse> <ser:return> <xsl:call-template name="copyBlock"> <xsl:with-param name="childNodes" select="./*"/> <xsl:with-param name="prefix">java</xsl:with-param> </xsl:call-template> </ser:return> </ser:authenticateResponse> </soapenv:Body> </xsl:when> <xsl:when test="$operationName='GetBalance'"> <xsl:text disable-output-escaping= "yes"><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ser="</xsl:text><xsl:value-of select="$ser"/> <xsl:text disable-output-escaping= "yes">" xmlns:java="</xsl:text><xsl:value-of select="$java"/> <xsl:text disable-output-escaping= "yes">"></xsl:text> <soapenv:Header/> <soapenv:Body> <ser:GetBalanceResponse> <ser:return> <xsl:call-template name="copyBlock"> <xsl:with-param name="childNodes" select="./*"/> <xsl:with-param name="prefix">java</xsl:with-param> </xsl:call-template> </ser:return> </ser:GetBalanceResponse> </soapenv:Body> </xsl:when> <xsl:when test="$operationName='generateTicket'"> <xsl:text disable-output-escaping= "yes"><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ser="</xsl:text><xsl:value-of select="$ser"/> <xsl:text disable-output-escaping= "yes">"></xsl:text> <soapenv:Header/> <soapenv:Body> <ser:generateTicketResponse> <xsl:call-template name="copyBlock"> <xsl:with-param name="childNodes" select="./*"/> <xsl:with-param name="prefix">ser</xsl:with-param> </xsl:call-template> </ser:generateTicketResponse> </soapenv:Body> </xsl:when> <xsl:when test="$operationName='ReceiveGameTxnMessage'"> <xsl:text disable-output-escaping= "yes"><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ser="</xsl:text><xsl:value-of select="$ser"/> <xsl:text disable-output-escaping= "yes">" xmlns:javaTxn="</xsl:text><xsl:value-of select="$javaTxn"/> <xsl:text disable-output-escaping= "yes">" xmlns:java="</xsl:text><xsl:value-of select="$java"/> <xsl:text disable-output-escaping= "yes">"></xsl:text> <soapenv:Header/> <soapenv:Body> <ser:ReceiveGameTxnMessageResponse> <ser:Response> <xsl:call-template name="copyBlock"> <xsl:with-param name="childNodes" select="./*"/> <xsl:with-param name="prefix">javaTxn</xsl:with-param> <xsl:with-param name="operationName">ReceiveGameTxnMessage</xsl:with-param> </xsl:call-template> </ser:Response> </ser:ReceiveGameTxnMessageResponse> </soapenv:Body> </xsl:when> <xsl:when test="$operationName='heartbeat'"> <xsl:text disable-output-escaping= "yes"><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ser="</xsl:text><xsl:value-of select="$ser"/> <xsl:text disable-output-escaping= "yes">"></xsl:text> <soapenv:Header/> <soapenv:Body> <ser:heartbeatResponse> <xsl:call-template name="copyBlock"> <xsl:with-param name="childNodes" select="./*"/> <xsl:with-param name="prefix">ser</xsl:with-param> </xsl:call-template> </ser:heartbeatResponse> </soapenv:Body> </xsl:when> </xsl:choose> <xsl:text disable-output-escaping= "yes"></soapenv:Envelope>]]></xsl:text> </con:responseContent> <con:wsaConfig mustUnderstand="NONE" version="200508" action="{$targetNamespace}/{$portTypeName}/{$operationName}Response"/> </xsl:element> </xsl:for-each> </xsl:for-each> <xsl:element name="con:dispatchConfig"> </xsl:element> </xsl:element> </xsl:for-each> </xsl:element> </xsl:for-each> <!-- for each service --> <con:properties/> <con:wssContainer/> </xsl:element> <!-- /soapui-project --> </xsl:template> <xsl:template name="copyBlock"> <xsl:param name="childNodes" select="*"/> <xsl:param name="prefix">java</xsl:param> <xsl:param name="operationName">test</xsl:param> <xsl:for-each select="$childNodes"> <xsl:choose> <xsl:when test="* and name()='Status' and $operationName='ReceiveGameTxnMessage'"> <xsl:element name="{$prefix}:{name()}"> <xsl:call-template name="copyBlock"> <xsl:with-param name="childNodes" select="child::*"/> <xsl:with-param name="prefix">java</xsl:with-param> </xsl:call-template> </xsl:element> </xsl:when> <xsl:when test="*"> <xsl:element name="{$prefix}:{name()}"> <xsl:call-template name="copyBlock"> <xsl:with-param name="childNodes" select="child::*"/> </xsl:call-template> </xsl:element> </xsl:when> <xsl:otherwise> <xsl:element name="{$prefix}:{name()}"><xsl:value-of select="."/></xsl:element> </xsl:otherwise> </xsl:choose> </xsl:for-each> </xsl:template> </xsl:stylesheet>
start the mock service with soapUI mock runner.