0
votes

I want to mock a Webservice for development environment. I have SOAPUI version 5.2.1 and the following WSDL:

<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" 
xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" 
xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" 
xmlns:s="http://www.w3.org/2001/XMLSchema" 
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" 
xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" 
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" 
xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" 
xmlns:tns="http://server.com/SSO" 
targetNamespace="http://server.com/SSO">
    <wsdl:documentation>Web service</wsdl:documentation>
    <wsdl:types>
        <s:schema elementFormDefault="qualified" targetNamespace="http://server.com/SSO">
            <s:element name="GetProfile2">
                <s:complexType>
                    <s:sequence>
                        <s:element maxOccurs="1" minOccurs="0" name="Token" nillable="true" type="s:string"/>
                        <s:element maxOccurs="1" minOccurs="0" name="SiteName" nillable="true" type="s:string"/>
                        <s:element maxOccurs="1" minOccurs="0" name="TimeStamp" nillable="true" type="s:string"/>
                        <s:element maxOccurs="1" minOccurs="0" name="EncodedPwd" nillable="true" type="s:string"/>
                        <s:element maxOccurs="1" minOccurs="0" name="EncodedType" nillable="true" type="s:string"/>
                        <s:element maxOccurs="1" minOccurs="0" name="Filter" nillable="true" type="s:string"/>
                    </s:sequence>
                </s:complexType>
            </s:element>
            <s:element name="GetProfile2Response">
                <s:complexType>
                    <s:sequence>
                        <s:element maxOccurs="1" minOccurs="0" name="GetProfile2Result" type="s:string"/>
                    </s:sequence>
                </s:complexType>
            </s:element>
            <s:element name="GetCache">
                <s:complexType/>
            </s:element>
            <s:element name="GetCacheResponse">
                <s:complexType>
                    <s:sequence>
                        <s:element maxOccurs="1" minOccurs="0" name="GetCacheResult" type="s:string"/>
                    </s:sequence>
                </s:complexType>
            </s:element>
            <s:element name="string" nillable="true" type="s:string"/>
        </s:schema>
    </wsdl:types>
    <wsdl:message name="GetProfile2SoapOut">
        <wsdl:part element="tns:GetProfile2Response" name="parameters">
        </wsdl:part>
    </wsdl:message>  
    <wsdl:message name="GetProfile2SoapIn">
        <wsdl:part element="tns:GetProfile2" name="parameters">
        </wsdl:part>
    </wsdl:message>
    <wsdl:portType name="ServiceSoap">
        <wsdl:operation name="GetProfile2">
            <wsdl:documentation>Returns a user</wsdl:documentation>
            <wsdl:input message="tns:GetProfile2SoapIn">
            </wsdl:input>
            <wsdl:output message="tns:GetProfile2SoapOut">
            </wsdl:output>
        </wsdl:operation>
        <wsdl:operation name="GetCache">
            <wsdl:documentation>Returns the cached abilitations.</wsdl:documentation>
            <wsdl:input message="tns:GetCacheSoapIn">
            </wsdl:input>
            <wsdl:output message="tns:GetCacheSoapOut">
            </wsdl:output>
        </wsdl:operation>
    </wsdl:portType>
    <wsdl:binding name="ServiceSoap" type="tns:ServiceSoap">
        <soap:binding transport="http://schemas.xmlsoap.org/soap/http"/>
        <wsdl:operation name="GetProfile2">
            <soap:operation soapAction="http://server.com/SSO/GetProfile2" style="document"/>
            <wsdl:input>
                <soap:body use="literal"/>
            </wsdl:input>
            <wsdl:output>
                <soap:body use="literal"/>
            </wsdl:output>
        </wsdl:operation>
        <wsdl:operation name="GetCache">
            <soap:operation soapAction="http://server.com/SSO/GetCache" style="document"/>
            <wsdl:input>
                <soap:body use="literal"/>
            </wsdl:input>
            <wsdl:output>
                <soap:body use="literal"/>
            </wsdl:output>
        </wsdl:operation>
    </wsdl:binding> 
    <wsdl:service name="Service">
        <wsdl:documentation>Web service</wsdl:documentation>
        <wsdl:port binding="tns:ServiceSoap" name="ServiceSoap">
            <soap:address location="http://server.com:7001/services/Service.ServiceSoap/"/>
        </wsdl:port>   
    </wsdl:service>
</wsdl:definitions>

I've created in SOAPUI a new soap project, with mock service, I've set the host and the port of the Weblogic server 12c where I have to install the war.

In SOAPUI preferences I have unchecked Logs wire content of all...", in MockService Properties I have set "Require SAOP Action" to false, and I've export as WAR the project and install into Weblogic 12c.

Ok, the problem is that, the first call to the webservice is ok, and I get the expected response.

From the second call I get the following error:

com.eviware.soapui.impl.wsdl.mock.DispatchException: Missing operation for soapAction [http://server.com/SSO/GetProfile2] and body element [{http://server.com/SSO}GetProfile2] with SOAP Version [SOAP 1.1]
at com.eviware.soapui.impl.wsdl.support.soap.SoapUtils.findOperationForRequest(SoapUtils.java:330)
at com.eviware.soapui.impl.wsdl.mock.WsdlMockDispatcher.dispatchPostRequest(WsdlMockDispatcher.java:191)
at com.eviware.soapui.impl.wsdl.mock.WsdlMockDispatcher.dispatchRequest(WsdlMockDispatcher.java:113)
at com.eviware.soapui.impl.wsdl.mock.WsdlMockRunner.dispatchRequest(WsdlMockRunner.java:142)
at com.eviware.soapui.mockaswar.MockAsWarServlet$MockServletSoapUICore.dispatchRequest(MockAsWarServlet.java:247)
at com.eviware.soapui.mockaswar.MockAsWarServlet.service(MockAsWarServlet.java:182)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:286)
at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:260)
at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:137)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:350)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:247)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3650)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3620)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:326)
at weblogic.security.service.SecurityManager.runAsForUserCode(SecurityManager.java:196)
at weblogic.servlet.provider.WlsSecurityProvider.runAsForUserCode(WlsSecurityProvider.java:203)
at weblogic.servlet.provider.WlsSubjectHandle.run(WlsSubjectHandle.java:71)
at weblogic.servlet.internal.WebAppServletContext.doSecuredExecute(WebAppServletContext.java:2423)
at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2280)
at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2258)
at weblogic.servlet.internal.ServletRequestImpl.runInternal(ServletRequestImpl.java:1626)
at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1586)
at weblogic.servlet.provider.ContainerSupportProviderImpl$WlsRequestExecutor.run(ContainerSupportProviderImpl.java:270)
at weblogic.invocation.ComponentInvocationContextManager._runAs(ComponentInvocationContextManager.java:348)
at weblogic.invocation.ComponentInvocationContextManager.runAs(ComponentInvocationContextManager.java:333)
at weblogic.work.LivePartitionUtility.doRunWorkUnderContext(LivePartitionUtility.java:54)
at weblogic.work.PartitionUtility.runWorkUnderContext(PartitionUtility.java:41)
at weblogic.work.SelfTuningWorkManagerImpl.runWorkUnderContext(SelfTuningWorkManagerImpl.java:617)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:397)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:346)

If i remove the message tags from wsdl everything is ok. Help me Please!!!

2
what is the name of the war file ? is it same as name of the mock service name? and what is the size of the war file that gets generated? - Suman g
one thing I know is that war generated can be deployable under tomcat. Not sure about other AppServers. - Rao
Would you mind to update the question with details of - how mock dispatcher is implemented? - Rao
Mr. Rao I have implemented using Random dispatcher. Till the deployment and first request fired , I have attached the log in this question. - Suman g
I suspect ..please Look at this .. community.smartbear.com/t5/SoapUI-Open-Source/… - Suman g

2 Answers

0
votes

I am referring to weblogic 12.c

  1. My Soapui Project from the above wsdl , I have created mock that responds randomly and mock properties

enter image description here

Mock Properties: enter image description here

  1. Mock Service in soapui below is the pic, all operations uses random mock response

Note: Export project as war from soapui, I have taken care context and war name as same

enter image description here

  1. Login to weblogic--> deployments --> install and point the war file that got from soapui.

enter image description here

  1. I have provided context name as "mocksoap"

enter image description here

  1. Select option Yes, take me to the deployments configuration screen and click finish enter image description here
  2. Select -->control tab--> select the context and click start and all services

enter image description here

  1. Cross check under monitoring -->Servlets it should list all the servlets got deployed enter image description here

  2. Access the Servelet and select WSDL to be tested

enter image description here 9. Open the soapui and Test the mock service war you deployed to weblogic and it will behave as a brand new testable service. I have shown below how i got random responses, Also Notice its pointing to my weblogic endpoint

enter image description here

If you like the answer please don forgot to vote!!!

0
votes

I was getting same error with soapUI, with response coming 1st time and then for subsequent request it was getting blank. It seems like library issue. Use https://github.com/eveoh/weblogic-soapui-mock-ear to wrap the war into ear. This has resolved issue for me. I have used weblogic 12c, soap UI 5.3.0