SoapUI没有找到我的网络服务

时间:2012-02-07 09:10:33

标签: java tomcat soap soapui

所以我现在已经在网络服务上苦苦挣扎了几天,似乎我终于有了突破。

我跟着this教程写了这封信,我的网络服务已经启动并运行了。唯一的问题是,我似乎无法通过soapUI测试它。

如果我转到http://localhost:8084/soapwebservices它会显示有关我的网络服务的数据,例如wsdl的位置,等等。由此判断,链接是正确的。

但是当我尝试将此请求发送给它时:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soap="soapwebservices.jdevelop.eu">
   <soapenv:Header/>
   <soapenv:Body>
      <soap:calculateValues>
         <value1>10</value1>
         <value2>3.21</value2>
      </soap:calculateValues>
   </soapenv:Body>
</soapenv:Envelope>

我收到404错误:

<head><title>Not Found (404)</title></head>
<body><h1>Not Found (404)</h1>
<b>Original request:</b> http://localhost:8084/soapwebservices<br><br>
<b>Not found request:</b> http://localhost:8084/soapwebservices</body>

这是我的WSDL:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<definitions xmlns:ns1="soapwebservices.jdevelop.eu" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:ns="http://schemas.xmlsoap.org/soap/encoding/" name="SOAPWebServices" targetNamespace="soapwebservices.jdevelop.eu">
    <types>
        <xsd:schema>
            <xsd:import namespace="soapwebservices.jdevelop.eu" schemaLocation="webservices.xsd"/>
        </xsd:schema>
    </types>
    <message name="calculateValues">
        <part name="calculateValues" element="ns1:calculateValues"/>
    </message>
    <message name="calculateValuesResponse">
        <part name="calculateValuesResponse" element="ns1:calculateValuesResponse"/>
    </message>
    <portType name="SOAPWebServices">
        <operation name="getCalculateValues">
            <input message="ns1:calculateValues"/>
            <output message="ns1:calculateValuesResponse"/>
        </operation>
    </portType>
    <binding name="SOAPWebServicesPortBinding" type="ns1:SOAPWebServices">
        <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
        <operation name="getCalculateValues">
            <soap:operation soapAction="urn:http://blog.jdevelop.eu/services/getCalculateValues"/>
            <input>
                <soap:body use="literal"/>
            </input>
            <output>
                <soap:body use="literal"/>
            </output>
        </operation>
    </binding>
    <service name="SOAPService">
        <port name="WebServices" binding="ns1:SOAPWebServicesPortBinding">
            <soap:address location="http://blog.jdevelop.eu:80/services"/>
        </port>
    </service>
</definitions>

这可能是什么问题?

我正在使用Netbeans 6.0.1,Apache Tomcat 6.0和Java SDK 1.7 谢谢!

2 个答案:

答案 0 :(得分:2)

观察结果:

  1. 在您的SOAP消息中,您发送的操作名称是 calculateValues <soap:calculateValues>),而WSDL中提到的操作名称是 getCalculateValues <operation name="getCalculateValues">)。这可能是404错误背后的原因,因为未定义 calculateValues 操作。

  2. 我假设您没有在WSDL(<soap:address location="http://blog.jdevelop.eu:80/services"/>)中提到的服务URL上发布SOAP消息。

答案 1 :(得分:0)

检查端点类和模式中的命名空间,两者应该相同