2010-11-19 33 views
0

我想設置一個Spring.net的Web服務,但不斷收到一個我找不到的錯誤消息。如何讓我的Spring.net Webservice工作?

錯誤:

​​

代碼:

public interface IBoundaryService { 
     XmlDocument GetAllBounds(); 
    } 

    public class BoundaryService :IBoundaryService 
    { 
     public virtual IBoundaryDao BoundaryDao { get; set; } 

     public virtual XmlDocument GetAllBounds() 
     { 
      XmlDocument xmlDoc = new XmlDocument(); 
      xmlDoc.LoadXml("<test>ok</test>"); 
      return xmlDoc; 
     } 
    } 

配置:

<object name="BoundaryService" type="StudentRegistration.Services.BoundaryService, StudentRegistration" 
     abstract="true"> 
    </object> 

    <object id="BoundaryExporter" type="Spring.Web.Services.WebServiceExporter, Spring.Web"> 
    <property name="TargetName" value="BoundaryService"/> 
    <property name="Namespace" value="http://fake/services"/> 
    <property name="Description" value="something"/> 
    <property name="MemberAttributes"> 
     <dictionary> 
     <entry key="GetAllBounds"> 
      <object type="System.Web.Services.WebMethodAttribute, System.Web.Services"> 
      <property name="Description" value="something."/> 
      <property name="MessageName" value="GetAllBounds"/> 
      </object> 
     </entry> 
     </dictionary> 
    </property> 
    </object> 

我應該嘗試清除這個嗎?

回答

2

Spring.NET引用在xml聲明(我幾天前有同樣的問題)上是錯誤的,或者我應該說它不是很清楚。

<object name="BoundaryService" 
     type="StudentRegistration.Services.BoundaryService, StudentRegistration" 
     abstract="true" /> 

,當你有一個實際的.asmx服務

,當你有你導出爲使用Spring.Web.Services.WebServiceExporter一個WebService一個PONO將導出的對象必須聲明上述聲明適用於如:

<object id="BoundaryService" 
     type="StudentRegistration.Services.BoundaryService, StudentRegistration" 
/> 

target WebServiceExporter的屬性適用於已聲明對象的id,抽象部分不是必需的,因爲Spring.NET採用角色生成網絡服務。

注意,你暴露的服務名(與您當前的CFG)將(..)/BoundaryExporter.asmx

編輯: 使用名稱,類型屬性標準的.asmx Web服務的配置聲明似乎被打破,至少for spring version 1.3.0.20349