当前位置: 首页 > 知识库问答 >
问题:

来自使用Apache CXF的Web服务的响应显示“无绑定操作信息…”

夹谷俊远
2023-03-14

问题描述可能很长。请耐心等待,并提供任何形式的帮助,因为我是新的网络服务。

我所做的:我使用ApacheCXFRI在java中创建了一个web服务。我只是创建了一个类,并使用自下而上的开发方法来生成SEI、WSDL和XML文件。

问题是:现在,如果我请求http://localhost:8084/DeepThoughtWS/services/DeepThoughtPort/whatIsTheAnswer,它会产生输出为No绑定操作信息,同时调用参数未知的未知方法。答复如下:

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <soap:Fault>
      <faultcode>soap:Server</faultcode>
      <faultstring>No binding operation info while invoking unknown
      method with params unknown.</faultstring>
    </soap:Fault>
  </soap:Body>
</soap:Envelope>

生成的WSDL为:

<wsdl:definitions xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:tns="http://ws.service.com/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
name="DeepThoughtService" targetNamespace="http://ws.service.com/">
  <wsdl:types>
    <schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
    xmlns:tns="http://ws.service.com/"
    xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
    xmlns="http://www.w3.org/2001/XMLSchema">
      <import namespace="http://ws.service.com/"
      schemaLocation="http://localhost:8084/DeepThoughtWS/services/DeepThoughtPort?xsd=deepthought_schema1.xsd" />
    </schema>
  </wsdl:types>
  <wsdl:message name="whatIsTheAnswerResponse">
    <wsdl:part element="tns:whatIsTheAnswerResponse"
    name="parameters"></wsdl:part>
  </wsdl:message>
  <wsdl:message name="whatIsTheAnswer">
    <wsdl:part element="tns:whatIsTheAnswer" name="parameters">
    </wsdl:part>
  </wsdl:message>
  <wsdl:portType name="DeepThought">
    <wsdl:operation name="whatIsTheAnswer">
      <wsdl:input message="tns:whatIsTheAnswer"
      name="whatIsTheAnswer"></wsdl:input>
      <wsdl:output message="tns:whatIsTheAnswerResponse"
      name="whatIsTheAnswerResponse"></wsdl:output>
    </wsdl:operation>
  </wsdl:portType>
  <wsdl:binding name="DeepThoughtServiceSoapBinding"
  type="tns:DeepThought">
    <soap:binding style="document"
    transport="http://schemas.xmlsoap.org/soap/http" />
    <wsdl:operation name="whatIsTheAnswer">
      <soap:operation soapAction="" style="document" />
      <wsdl:input name="whatIsTheAnswer">
        <soap:body use="literal" />
      </wsdl:input>
      <wsdl:output name="whatIsTheAnswerResponse">
        <soap:body use="literal" />
      </wsdl:output>
    </wsdl:operation>
  </wsdl:binding>
  <wsdl:service name="DeepThoughtService">
    <wsdl:port binding="tns:DeepThoughtServiceSoapBinding"
    name="DeepThoughtPort">
      <soap:address location="http://localhost:8084/DeepThoughtWS/services/DeepThoughtPort" />
    </wsdl:port>
  </wsdl:service>
</wsdl:definitions>

deepthink课程包括:

@WebService(targetNamespace = "http://ws.service.com/", portName = "DeepThoughtPort", serviceName = "DeepThoughtService")
public class DeepThought {
    public String whatIsTheAnswer(@WebParam(name = "arg0") String interviewer) {
        return ("The answer " + interviewer);
    }
}

请求时的控制台输出也显示了一些错误:

Feb 05, 2013 3:59:14 PM org.apache.cxf.service.invoker.AbstractInvoker invoke
SEVERE: Invocation without a binding operation.
Feb 05, 2013 3:59:14 PM org.apache.cxf.phase.PhaseInterceptorChain doDefaultLogging
WARNING: Interceptor for {http://ws.service.com/}DeepThoughtService has thrown exception, unwinding now
org.apache.cxf.interceptor.Fault: No binding operation info while invoking unknown method with params unknown.
    at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:59)
    at org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:58)
    at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
    at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
    at java.util.concurrent.FutureTask.run(Unknown Source)
    at org.apache.cxf.workqueue.SynchronousExecutor.execute(SynchronousExecutor.java:37)
    at org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:107)
    at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:271)
    at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121)
    at org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:239)
    at org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:218)
    at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:163)
    at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:137)
    at org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpringServlet.java:158)
    at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:243)
    at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doGet(AbstractHTTPServlet.java:168)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
    at org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:219)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:929)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1002)
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:585)
    at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)

Feb 05, 2013 3:59:14 PM org.apache.cxf.services.DeepThoughtService.DeepThoughtPort.DeepThought
INFO: Outbound Message
---------------------------
ID: 5
Response-Code: 500
Encoding: UTF-8
Content-Type: text/xml
Headers: {}
Payload: <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><soap:Fault><faultcode>soap:Server</faultcode><faultstring>No binding operation info while invoking unknown method with params unknown.</faultstring></soap:Fault></soap:Body></soap:Envelope>

共有3个答案

卢黎明
2023-03-14

有人用GET请求调用您的SOAP-WebService,但SOAP-WebServices无法接收GET请求。你应该告诉他/她不要像这里描述的那样用GET请求调用我的SOAP web服务,或者用GET请求调用我的web服务。

朱季
2023-03-14

我也有同样的问题。使用cxf 2.6 2.7,chrome或firefox等网络浏览器的这一请求根本不起作用。我试着在cxf中使用一个客户机,效果很好!您的web服务正在工作,但您无法通过web浏览器执行请求,您需要一个客户机,因为客户机知道XML的要求。

高玮
2023-03-14

通常,如果传入的soap方法与WSDL不正确匹配,就会发生这种异常。在这种情况下,soap消息无法映射到服务上的适当方法。CXF就是不知道该怎么办。仔细检查传入的soap消息。

上述解释的来源。

可能的解决方案

@WebService(targetNamespace = "http://ws.service.com/",
        portName = "DeepThoughtPort",
        serviceName = "DeepThoughtService",
        endpointInterface = "your.pck.DeepThoughtService",
        wsdlLocation = "WEB-INF/wsdl/DeepThoughtService.wsdl")
public class DeepThought {

    @WebMethod(action = "whatIsTheAnswer")
    public String whatIsTheAnswer(@WebParam(name = "arg0") String interviewer) {
        return ("The answer " + interviewer);
    }
}

我要做的是在@WebService中添加WSDL位置和endpoint接口。此外,您使用的是Java优先的方法,因此您的方法应该使用@WebMethod(action=“whatIsTheAnswer”)进行注释。因此,如果该方法没有注释CXF“理解”您的web服务根本不包含任何方法,并在调用参数未知的未知方法时说:无绑定操作信息

另见:

  • 使用JAX-WS开发服务

 类似资料:
  • 生成的是: 类包括: 请求时的控制台输出也显示一些错误:

  • 我想知道如何缓存来自Web服务器(返回json数据)的okHTTP响应? 你知道如果应用程序只需要在第一次运行时下载数据--然后只有在数据发生变化时才下载数据该怎么办吗?

  • 我将symfony 3迁移到symfony 4.3,并且我的自定义包移动到:src/Bundles/FooBundle。 structure FooBundle:-依赖注入-配置。php-FooExtension。php-Event-Model-Resources-config-services。yml-Service-Twig-Exception-FooBundle。php 和文件bundle/

  • 这是完整的: 无法显示应用程序bundleID的自动强密码:com.ckbusiness.由于错误的愿望列表:无法识别调用应用程序的进程。在应用程序的应用程序标识符权限中检查teamID和bundleID 我在这里错过了什么??

  • 我需要一种在java中记录这个XML响应的方法。当我从我的java发送请求时,这是返回的。我需要一种打印出响应描述的方法。 下面是我的java代码:

  • 抱歉,你问的太长了! 我有一个测试,使用带有GET谓词和JSON的服务,该服务使用SOAP服务和XML。并且我需要翻译JSON以便使用XML的SOAP服务。 我的Rest控制器 现在我有了一个服务接口: 和实现... SOAP服务URL为:http://localhost:8080/WebServiceImplService/WebServiceImpl?WSDL 生成的类 接口 实现。 完整的,