Web服务“没有这样的操作:HTTP GET PATH_INFO”

时间:2013-01-21 19:06:21

标签: web-services apache-camel endpoint

我目前有一个SOAP Web服务,我正在尝试访问它的端点,但我一直收到这个错误:

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <soap:Fault>
      <faultcode>soap:Server</faultcode>
        <faultstring>
 No such operation: (HTTP GET PATH_INFO: /camel-example-reportincident/webservices/incident)
        </faultstring>
       </soap:Fault>
    </soap:Body>
 </soap:Envelope>

UNIT TEST

package org.apache.camel.example.reportincident;

import junit.framework.TestCase;

import org.apache.camel.CamelContext;
import org.apache.camel.impl.DefaultCamelContext;
import org.apache.cxf.jaxws.JaxWsProxyFactoryBean;
import org.jvnet.mock_javamail.Mailbox;

/**
 * Unit test of our routes
 */
public class ReportIncidentRoutesTest extends TestCase {

private CamelContext camel;

// should be the same address as we have in our route
private static String ADDRESS = "cxf://http://localhost:8080/camel-example-reportincident/webservices/incident"
            + "?serviceClass=org.apache.camel.example.reportincident.ReportIncidentEndpoint"
            + "&wsdlURL=report_incident.wsdl";

protected void startCamel() throws Exception {
    camel = new DefaultCamelContext();
    camel.addRoutes(new ReportIncidentRoutes());
    camel.start();
}

protected static ReportIncidentEndpoint createCXFClient() {
    // we use CXF to create a client for us as its easier than JAXWS and works
    JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
    factory.setServiceClass(ReportIncidentEndpoint.class);
    factory.setAddress(ADDRESS);
    return (ReportIncidentEndpoint) factory.create();
}

public void testRendportIncident() throws Exception {
    // start camel
    startCamel();

    // assert mailbox is empty before starting
    Mailbox inbox = Mailbox.get("incident@mycompany.com");
    assertEquals("Should not have mails", 0, inbox.size());

    // create input parameter
    InputReportIncident input = new InputReportIncident();
    input.setIncidentId("123");
    input.setIncidentDate("2008-08-18");
    input.setGivenName("Claus");
    input.setFamilyName("Ibsen");
    input.setSummary("Bla");
    input.setDetails("Bla bla");
    input.setEmail("davsclaus@apache.org");
    input.setPhone("0045 2962 7576");

    // create the webservice client and send the request
    ReportIncidentEndpoint client = createCXFClient();
    OutputReportIncident out = client.reportIncident(input);

    // assert we got a OK back
    assertEquals("0", out.getCode());

    // let some time pass to allow Camel to pickup the file and send it as an email
    Thread.sleep(3000);
    // assert mail box
    assertEquals("Should have got 1 mail", 1, inbox.size());

    // stop camel
    camel.stop();
}

}

我正在尝试使用CFX端点和我的骆驼路由,当我将端点地址放在路由中然后对其进行单元测试时,我得到一个“无端点可以找到:// path / to / endpoint ”

我假设当我尝试访问端点网址时出现错误这一事实是问题,但我甚至不知道从哪里开始弄清楚如何修复它。

当我在SOAP UI上点击我的web服务时,它运行正常。任何帮助将不胜感激,我可以提供所需的任何信息。

1 个答案:

答案 0 :(得分:0)

@grep 我认为这篇文章有点陈旧,但如果其他有类似问题的人能够做到,我仍会尝试回答。嗯,我有同样的问题,并想知道背后的原因是什么。这是我尝试并解决问题的两个步骤。确保您能够在浏览器中访问wsdl。

  1. 关闭SOAPUI,删除在C:/ users下的用户文件夹中创建的soapui_workspace.xml。
  2. 重新启动Soap_ui并打开首选项&gt;代理设置。
  3. 从自动更改为无。
  4. 创建新项目。 这确实解决了我的问题,并从SOAPUI中的webservice获得了响应。
相关问题