47459

How can I get my Spring.net Webservice working?

Question:

I am trying to setup a Spring.net web-service but keep getting an error message that I cannot figure out.

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?

Answer1:

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.

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

the above declaration applies when you have an actual .asmx service

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:

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

Note that your exposed service name (with your current cfg) will be (..)/BoundaryExporter.asmx

Edit: The config statement for standard .asmx web services using the <strong>name, type</strong> attributes seems to be broken, at least for spring version 1.3.0.20349

Recommend

  • DataTriggers in Expression Blend
  • Custom List Box item style
  • ListBoxItem AlternationIndex Trigger overrides IsSelected Trigger
  • Two way animation
  • Checked VisualState is not triggered after RadioButton is re-enabled
  • Add, enable and disable NLog loggers programmatically
  • CredWrite returns Win32 error code 2 (ERROR_INVALID_FUNCTION) “Incorrect function.”
  • Using Dependency object for color animation WP8
  • Why does DataTemplate.LoadContent() not respect template-defined triggers?
  • C# Using CredWrite to Access C$
  • WPF string animation using StringAnimationUsingKeyFrames: last DiscreteStringKeyFrame not executed
  • Silverlight Toolkit Chart: Assign Hyperlink to Axis
  • Get XML Attributes in WPF with a TreeView
  • Populate Dataset with columns from XML
  • Issue Trying To Get Button Border to Animate on Click
  • Biztalk message agnostic orchestration
  • Xml Deserialization - Merging two elements into a single List object
  • Hide or Show stackpanel of ListViewItem with VisualStateManager
  • Is it one-to-one or Component ? Nhibernate Mapping
  • Installing PAR::Packer on Windows, dmake error 255
  • Reading XML into Datatable gives incorrect DateTime when the time has Time Zone info
  • Comparing user's facebook/twitter friends to site's users in Python/Django
  • Specifying virtual keyboard type for EditText in XML
  • Why can't UI components be accessed from a backgroundworker?
  • Firefox Extension - Monitor refresh and change of tab
  • C# - Serializing and deserializing static member
  • javaw.exe and eclipse startup problems
  • JTable with a ScrollPane misbehaving
  • How do I configure my settings file to work with unit tests?
  • How to CLICK on IE download dialog box i.e.(Open, Save, Save As…)
  • Java static initializers and reflection
  • IndexOutOfRangeException on multidimensional array despite using GetLength check
  • How can I remove ASP.NET Designer.cs files?
  • unknown Exception android
  • Binding checkboxes to object values in AngularJs
  • Observable and ngFor in Angular 2
  • failed to connect to specific WiFi in android programmatically
  • Unable to use reactive element in my shiny app
  • java string with new operator and a literal
  • How can I use threading to 'tick' a timer to be accessed by other threads?