繁体   English   中英

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

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

我正在尝试设置Spring.net Web服务,但不断收到一条我无法弄清楚的错误消息。

错误:

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

码:

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>

我该怎么做才能解决这个问题?

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

WebServiceExporter的target属性适用于声明对象的id ,因为Spring.NET承担生成webservice的角色,所以不需要抽象部分。

请注意,您公开的服务名称(使用当前的cfg)将是(..)/BoundaryExporter.asmx

编辑:使用名称,类型属性的标准.asmx Web服务的配置语句似乎被破坏,至少对于Spring版本1.3.0.20349

暂无
暂无

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

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