【问题标题】:SoapUI not finding my web-serviceSoapUI 找不到我的网络服务
【发布时间】:2012-02-07 09:10:32
【问题描述】:

所以我这两天在web-service上苦苦挣扎,看来我终于有了突破。

我完全按照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 谢谢!

【问题讨论】:

  • 我认为你必须提供完整的链接,包括 wsdl---_http://localhost:8084/soapwebservices/?wsdl
  • 在某个特定的地方,还是在一般情况下?
  • 当你在 SoapUI 中创建一个新项目时,你提供一个名称(第一个文本框)和服务的地址(这是应该以 /?wsdl 结尾的那个)

标签: java tomcat soap soapui


【解决方案1】:

几个观察:

  1. 在您的 SOAP 消息中,您发送的操作名称是 calculateValues (&lt;soap:calculateValues&gt;),而 WSDL 中提到的操作名称是 getCalculateValues (@ 987654322@)。这可能是 404 错误背后的原因,因为 calculateValues 操作未定义。

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

【讨论】:

  • 我确实是。嗯,这样的菜鸟错误。
【解决方案2】:

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

【讨论】:

    最近更新 更多