【问题标题】:SoapUI Mock Service Missing operation errorSoapUI Mock Service 缺少操作错误
【发布时间】:2016-05-26 13:52:58
【问题描述】:

我想为开发环境模拟一个 Web 服务。 我有 SOAPUI 版本 5.2.1 和以下 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>

我在 SOAPUI 中创建了一个带有模拟服务的新肥皂项目,我已经设置了 Weblogic server 12c 的主机和端口安装战争。

SOAPUI 首选项中,我已取消选中 Logs wire content of all...",在 MockService 属性中,我已将“需要 SAOP 操作”设置为 false,并且已将项目导出为 WAR,并且安装到 Weblogic 12c

好的,问题是,第一次调用 web 服务没问题,我得到了预期的响应。

从第二次调用我得到以下错误:

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)

如果我从 wsdl 中删除消息标签,一切正常。请帮帮我!!!

【问题讨论】:

  • war 文件的名称是什么?它与模拟服务名称的名称相同吗?生成的war文件的大小是多少?
  • 我知道的一件事是生成的战争可以部署在 tomcat 下。不确定其他 AppServer。
  • 您是否介意更新问题的详细信息 - 如何实现模拟调度程序?
  • 先生。 Rao 我已经使用 Random 调度程序实现了。直到部署和第一个请求被触发,我已经附上了这个问题的日志。

标签: soapui weblogic12c


【解决方案1】:

我指的是weblogic 12.c

  1. 我的 Soapui 项目来自上述 wsdl,我创建了随机响应和模拟属性的模拟

模拟属性:

  1. 下图是soapui中的模拟服务,所有操作都使用随机模拟响应

注意:从soapui 将项目导出为战争,我已经注意了上下文和 战名相同

  1. 登录到 weblogic--> 部署 --> 安装并指向从 soapui 获得的 war 文件。

  1. 我提供的上下文名称为“mocksoap”

  1. 选择选项是,带我到部署配置屏幕并单击完成
  2. 选择-->控制选项卡-->选择上下文并点击开始和所有服务

  1. 监控下的交叉检查 -->Servlets 它应该列出所有部署的 Servlet

  2. 访问Servelet并选择要测试的WSDL

9. 打开soapui 并测试您部署到weblogic 的模拟服务战争,它将表现为一个全新的可测试服务。 我在下面展示了我是如何得到随机响应的,还要注意它指向我的 weblogic 端点​​

如果你喜欢这个答案,请不要忘记投票!!!

【讨论】:

  • 我已按照您的指示进行操作,我知道问题出在 WSDL 中。因为,如果您尝试测试 GetProfile2 而不是 GetCache,则会收到错误消息。
  • 此外,如果您查看域文件夹下的 soapui.log,我会看到此错误消息。 2016-05-31 08:34:03,683 WARN [SchemaUtils] 错误:zip:/scratch/sgongali/gitlocal/soa-apiplatform/out/domains/drt/servers/api/tmp/_WL_user/mocksoap/ajtj4k/war/WEB -INF/lib/soapui-5.2.1.jar!/com/eviware/soapui/resources/xsds/soapEncoding.xsd:0: 警告: id-idref-idrefs-entity-entities-notation: 为了兼容性,输入'ENTITY ' 只能用于属性(用于元素 'ENTITY@schemas.xmlsoap.org/soap/encoding/')。
  • 也请您回答饶先生
  • 在soapui 中,未选中“启用模拟Http 日志”即可解决问题。 weblogic内部存在问题:(
  • 我还尝试了 weblogic 12.2。它工作正常,但......只有一次!第一次尝试soapui给了我一个回应。对于下一个我(在 weblogic 中)
【解决方案2】:

我在使用 soapUI 时遇到了同样的错误,第一次响应,然后对于后续请求,它变得空白。这似乎是图书馆的问题。使用https://github.com/eveoh/weblogic-soapui-mock-ear 将战争包裹在耳边。这为我解决了问题。我用过 weblogic 12c,soap UI 5.3.0

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-11-16
    • 1970-01-01
    • 2018-07-21
    • 1970-01-01
    • 2013-03-19
    • 1970-01-01
    相关资源
    最近更新 更多