PDA

View Full Version : WebServiceProxyFactory Enhancements


Aleks Seovic
01-20-2006, 10:45 AM
I finally found some time to go over Bruno's implementation of client-side web service proxy factory that doesn't need WSDL-generated proxy class. All I can say is: "Impressive and very, very cool" :-)

I refactored base proxy builder classes (long overdue) and then refactored Bruno's SoapHttpClientProxyTypeBuilder a bit to inherit from the CompositionProxyTypeBuilder in order to remove duplicate code. There are few other minor changes, but none of them are really worth mentioning.

Finally, I replaced my old WebServiceProxyFactory with Bruno's implementation and committed everything.

That means that all you need to do now to get a reference to a web service on the client side is something like this:


<object id="WebCalculatorService" type="Spring.Web.Services.WebServiceProxyFactory, Spring.Services">
<property name="ServiceUrl" value="http://localhost/SpringWS/Calculator.asmx"/>
<property name="ServiceInterface" value="TestServices.ICalculator, TestServices"/>
</object>


BTW, I changed all of the other client-side proxy factories in Spring.Services to use 'ServiceUrl' as a property name instead of 'ServiceUri', so you might need to update your configuration files to reflect that.

Another thing that is important is that Spring.Services now has a dependency on WSE, which means that you need to put Microsoft.Web.Services2.dll in your lib/Net/1.1 directory. I didn't add it to CVS for licensing reasons, so you will have to download WSE2 SP3 and add this assembly to your local lib directory manually in order to be able to build.

Enjoy,

Aleks

smhinsey
01-20-2006, 04:27 PM
Nice. I look forward to playing with this soon.

Bruno Baia
01-31-2006, 10:43 PM
Hi,

I removed the WSE dependency for now.
To use WSE, you still can do it using the ClientProtocolType property :


<object id="WebCalculatorService" type="Spring.Web.Services.WebServiceProxyFactory, Spring.Services">
<property name="ClientProtocolType" value="Microsoft.Web.Services2.WebServicesClientProtocol, Microsoft.Web.Services2"/>
<property name="ServiceUrl" value="http://localhost/SpringWS/Calculator.asmx"/>
<property name="ServiceInterface" value="TestServices.ICalculator, TestServices"/>
</object>


Bruno

Bruno Baia
03-08-2006, 12:25 AM
Revert to old implementation of WebServiceProxyFactory [SPRNET-284 (http://opensource2.atlassian.com/projects/spring/browse/SPRNET-284)].

So now we have 2 classes :
The old WebServiceProxyFactory implementation which targets the proxy generated by VS/wsdl.exe.
The new WebServiceClientFactory implementation which targets directly the web service using an url and a contract interface without the need of an extra generated proxy.

-Bruno

Desaltsand
07-19-2006, 10:28 AM
1. my conifg file ie :

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<sectionGroup name="spring">
<section name="context" type="Spring.Context.Support.ContextHandler, Spring.Core" />
<section name="objects" type="Spring.Context.Support.DefaultSectionHandler, Spring.Core" />
</sectionGroup>
</configSections>
<spring>
<context>
<resource uri="config://spring/objects" />
</context>
<objects xmlns="http://www.springframework.net">
<object id="WebCalculatorService" type="Spring.Web.Services.WebServiceProxyFactory, Spring.Services">
<!--change Spring.Web.Services.WebServiceClientFactory is correct -->
<property name="ServiceUrl" value="http://localhost:4301/WebSite1/HelloWorldExporter.asmx" />
<property name="ServiceInterface" value="ClassLibrary1.IHelloWorld1, ClassLibrary1" />
</object>
</objects>
</spring>
</configuration>

2. when i call:

IApplicationContext context = ContextRegistry.GetContext();

the exception is :
"'ServiceUrl' node cannot be resolved for the specified root context."

3.my env is VS2005,dotnetframework 2.0,spring.net version is 2.1.0.2

4.i got correct solution .i try it two days.but i am very joy ,now .

spring is very great.

sand.