简体   繁体   English

如何让我的Spring.net Web服务工作?

[英]How can I get my Spring.net Webservice working?

I am trying to setup a Spring.net web-service but keep getting an error message that I cannot figure out. 我正在尝试设置Spring.net Web服务,但不断收到一条我无法弄清楚的错误消息。

Error: 错误:

System.NotSupportedException: Target 'target' of type 'Spring.Objects.Factory.Support.RootWebObjectDefinition' does not support methods of 'StudentRegistration.Services.IBoundaryService'.
   at Spring.Util.AssertUtils.Understands(Object target, String targetName, Type requiredType)
   at HelloWorldExporter.GetAllBounds()

Code: 码:

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;
        }
    }

Configuration: 组态:

  <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>

What should I try to clear this up? 我该怎么做才能解决这个问题?

The Spring.NET reference is wrong on the xml declaration (i had the same issue a few days ago), or should i say its not crystal clear. Spring.NET引用在xml声明上是错误的(几天前我有同样的问题),或者我应该说它不是很清楚。

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

the above declaration applies when you have an actual .asmx service 当您拥有实际的.asmx服务时,以上声明适用

WHen you have a PONO which you export as a WebService using Spring.Web.Services.WebServiceExporter the object that will be exported must be declared as: 当你有一个使用Spring.Web.Services.WebServiceExporter导出为WebService的PONO时,必须将导出的对象声明为:

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

the target property of the WebServiceExporter applies to the id of a declared object, the abstract part is not required as Spring.NET takes the role generating the webservice. WebServiceExporter的target属性适用于声明对象的id ,因为Spring.NET承担生成webservice的角色,所以不需要抽象部分。

Note that your exposed service name (with your current cfg) will be (..)/BoundaryExporter.asmx 请注意,您公开的服务名称(使用当前的cfg)将是(..)/BoundaryExporter.asmx

Edit: The config statement for standard .asmx web services using the name, type attributes seems to be broken, at least for spring version 1.3.0.20349 编辑:使用名称,类型属性的标准.asmx Web服务的配置语句似乎被破坏,至少对于Spring版本1.3.0.20349

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM