2012-02-07 16 views
0

所以我一直在網絡服務掙扎了好幾天,看來我終於有了突破。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 謝謝!

+0

我認爲你必須提供完整的鏈接,包括WSDL ---_的http://本地主機:8084/soapwebservices /?wsdl – tartak 2012-02-07 09:12:52

+0

在某些特定的地方,或者一般? – 2012-02-07 09:18:54

+0

當你在SoapUI中創建一個新項目時,你提供了一個名字(第一個文本框)和服務地址(這是應該以/?wsdl結尾的那個) – tartak 2012-02-07 09:19:52

回答

2

情侶觀察:

  1. 在您的SOAP消息,您發送的操作名稱是calculateValues<soap:calculateValues>),而在WSDL中提到的操作名稱是getCalculateValues<operation name="getCalculateValues">)。這可能是404錯誤背後的原因,因爲計算值操作未定義。

  2. 我假定您沒有在WSDL中提到的服務URL(<soap:address location="http://blog.jdevelop.eu:80/services"/>)上發佈SOAP消息。

+0

我的確是。呃,這樣的菜鳥錯誤。 – 2012-02-13 08:17:05

0

入住你的端點類和架構的namespce,都應該是相同的