<!-- actual objects 'calculatorService' and 'simpleCalculatorService' are defined elsewhere -->
<!-- Define the component for exporting 'calculatorService' -->
<object id="calculatorComponent" type="Spring.EnterpriseServices.ServicedComponentExporter,
Spring.Services">
<property name="TargetName" value="calculatorService" />
<property name="TypeAttributes">
<list>
<object type="System.EnterpriseServices.TransactionAttribute, System.EnterpriseServices" />
</list>
</property>
<property name="MemberAttributes">
<dictionary>
<entry key="*">
<list>
<object type="System.EnterpriseServices.AutoCompleteAttribute, System.EnterpriseServices" />
</list>
</entry>
</dictionary>
</property>
</object>
<!-- Define the component for exporting 'simpleCalculatorService' -->
<object id="simpleCalculatorComponent" type="Spring.EnterpriseServices.ServicedComponentExporter,
Spring.Services">
<property name="TargetName" value="simpleCalculatorService" />
</object>
<!-- Export components into assembly and autoregister with COM+ -->
<object type="Spring.EnterpriseServices.EnterpriseServicesExporter, Spring.Services">
<!-- assembly name to generated - will generate 'Spring.Calculator.EnterpriseServices.dll' -->
<property name="Assembly" value="Spring.Calculator.EnterpriseServices" />
<!--
use Spring's ContextRegistry for managing services. If true, requires a file
'Spring.Calculator.EnterpriseServices.dll.spring-context.xml' containing a
<spring/context /> section placed next to the generated assembly.
-->
<property name="UseSpring" value="true" />
<property name="ApplicationName" value="Spring Calculator Application" />
<property name="ActivationMode" value="Library" />
<property name="Description" value="Spring Calculator application" />
<property name="Components">
<list>
<ref object="calculatorComponent" />
<ref object="simpleCalculatorComponent" />
</list>
</property>
</object>
<-- -->
<spring>
<context>
<resource uri="Config/services.xml" />
</context>
</spring>
This file should point to the service object definitions you exported using
internal class SpringServicedComponent: BaseType
{
protected delegate object GetObjectHandler(ServicedComponent servicedComponent, string targetName);
protected static readonly GetObjectHandler getObjectRef;
static SpringServicedComponent()
{
// first look for a local copy
System.Reflection.Assembly servicesAssembly;
string servicesAssemblyPath = Path.Combine(
new FileInfo(System.Reflection.Assembly.GetExecutingAssembly().Location).DirectoryName
, "Spring.Services.dll" );
servicesAssembly = System.Reflection.Assembly.LoadFrom(servicesAssemblyPath);
if (servicesAssembly == null)
{
// then let the normal loader handle the typeload
servicesAssembly = System.Reflection.Assembly.Load("Spring.Services, culture=neutral, version=x.x.x.x, publicKey=xxxxxxxx");
}
Type componentHelperType = servicesAssembly.GetType("Spring.EnterpriseServices.ServicedComponentHelper");
getObjectRef = (GetObjectHandler) Delegate.CreateDelegate(typeof(GetObjectHandler)
, componentHelperType.GetMethod("GetObject"));
}
}
class MyServicedComponent {
void MethodX() {
ContextRegistry.GetContext().GetObject("TargetName").MethodX();
}
}
class MyServicedComponent {
TargetType target = new TargetType();
void MethodX() {
target.MethodX();
}
}
This factory object should be used to instantiate and configure
serviced components created by
<property> tag.
Remoting exporters uses this class as a base proxy class in order to support lifecycle configuration when exporting a remote object.
This method uses property values to configure
It is very much inspired by Ingo Rammer's example in Chapter 6 of "Advanced .NET Remoting", but is modified slightly to make it more "Spring-friendly". Basically, the main difference is that instead of pulling lease configuration from the .NET config file, this implementation relies on Spring DI to get appropriate values injected, which makes it much more flexible.
Provides a well known location for clients to retrieve references to CAO references.
Normally this call will be used to initialize the object.
Invoked after population of normal object properties but before an
init callback such as
Invoked after population of normal object properties but before an init
callback like
<wcf:channelFactory> tag.
This method is never invoked if the parser is namespace aware and was called to process the root node.
Invoked after population of normal object properties but before an init
callback like
Invoked after population of normal object properties but before an init
callback like
This factory object should be used to obtain reference to a web service that can be safely cast to a service interface, which allows client code to code against interface, and not directly against the web service.
The WSDL contract needs to conform to WS-I Basic Profiles.
This only applies when using an
The default is to use the system proxy setting.
This only applies when using an
As the proxy type does not implement the interface, we try to find matching methods.