Consumir Web Services con Spring.net Nuttigen van Web Services met Spring.net
Bueno, el ejemplo que arme anteriormente, lo publique con el IIS en un directorio virtual llamado WSUserAuthentication Nou, de arm bovenstaande voorbeeld, met de publicatie in een virtuele IIS-map WSUserAuthentication

Ahora, vamos a armar un cliente que consuma este WS, sin una Web Refence , sino por spring.net. Laten we nu eens een client die verbruikt dit was zonder het web Refence, maar door spring.net.
Generamos un nuevo proyecto web, tenemos que refenciar a las librerías de Spring, como también a la interfaz de nuestro Web Services y la capa que genere como “TransferObjects”, que tiene el objeto que va a recibir el cliente. Maak een nieuw web project, moeten we refenciar de voorjaarsbijeenkomst van de bibliotheken, maar ook de interface van onze Web Services en de laag die genereert als TransferObjects ", dat is het doel dat de klant zal ontvangen.

Habría que pensar cómo vamos a hacer, para versiones posteriores, el control de las versiones de los asemblys, en caso de hacer modificaciones en nuestro WS, una alternativa seria colocarlos en la GAC, para olvidarnos de tener que copiar en todos los desarrollos que llamen al WS, la última versión en caso de necesitarla. Zou zijn om na te denken hoe we dat zullen doen later, de controle van de versies van de asemblys, als we wijzigingen aanbrengen in WAS, een alternatief zou ze in de GAC te vergeten met het kopiëren van alle ontwikkelingen die oproep WAS andalousië, de nieuwste versie indien nodig.

En mi caso, genero una carpeta de Configuración, con un Xml de los objetos que consumo en spring, en este caso In mijn geval heb ik een setup-pakket, met een van de objecten die Xml consumptie in het voorjaar, in dit geval
<? xml <? Xml
version = “ 1.0 “ version = "1.0"
encoding = “ utf-8 “ ?> encoding = "utf-8"?>
< objects <Objects
xmlns = “ http://www.springframework.net “ > xmlns = "http://www.springframework.net">
< description > An example that demonstrates simple IoC features. </ description > <description> Een voorbeeld dat aantoont eenvoudige IOC functies. </ Description>
<!– Web Services –> <! - Web Services ->
< object <Object
id = “ UsuarioWS “ id = "UsuarioWS"
type = “ Spring.Web.Services.WebServiceProxyFactory, Spring.Services “ > type = "Spring.Web.Services.WebServiceProxyFactory, Spring.Services">
< property <Makelaar
name = “ ServiceUri “ naam = "ServiceUri"
value = “ http://localhost/WSUserAuthentication/UserServices.asmx “ value = "http://localhost/WSUserAuthentication/UserServices.asmx"
/> />
< property <Makelaar
name = “ ServiceInterface “ naam = "ServiceInterface"
value = “ Synnax.Core.WS.UserAuthentication.Entitys.IUserService, Synnax.Core.WS.UserAuthentication.Entitys ” value = "Synnax.Core.WS.UserAuthentication.Entitys.IUserService, Synnax.Core.WS.UserAuthentication.Entitys"
/> />
</ object > </ Object>
</ objects > </ Voorwerpen>
Genero un objeto, llamado “UsuarioWS”, que es del tiplo del WebServiceProxyFactory, que especificamos la ServiceUri que es donde tenemos corriendo nuestro WS, con el servicio que insumimos, y la interfaz que implementa. Geslacht van een object genaamd "UsuarioWS", dat is een verdrievoudiging van de WebServiceProxyFactory, die de ServiceUri waar we onze liep was, met de dienst-ingangen en implementeert de interface.
Definimos el contexto del spring, y la configuracion de los objetos. We definiëren de context van de lente, en de configuratie van de voorwerpen.
< configuration > <Configuration>
< configSections > <ConfigSections>
< sectionGroup <SectionGroup
name = “ spring “ > naam = "lente">
< section <Afdeling
name = “ context “ naam = "context"
type = “ Spring.Context.Support.ContextHandler, Spring.Core “ /> type = "Spring.Context.Support.ContextHandler, Spring.Core" />
</ sectionGroup > </ SectionGroup>
</ configSections > </ ConfigSections>
< appSettings /> <AppSettings />
< connectionStrings /> <ConnectionStrings />
< system.web > <system.web>
< compilation <Compilatie
debug = “ false “ > debug = "false">
< assemblies > <Assemblies>
< add <Toevoegen
assembly = “ Spring.Core, Version=1.1.2.20125, Culture=neutral, PublicKeyToken=65E474D141E25E07 “ /> assemblage = "Spring.Core, Version = 1.1.2.20125, Culture = neutraal, PublicKeyToken = 65E474D141E25E07" />
< add <Toevoegen
assembly = “ Spring.Services, Version=1.1.2.20125, Culture=neutral, PublicKeyToken=65E474D141E25E07 “ /> assemblage = "Spring.Services, Version = 1.1.2.20125, Culture = neutraal, PublicKeyToken = 65E474D141E25E07" />
< add <Toevoegen
assembly = “ Spring.Web, Version=1.1.2.20125, Culture=neutral, PublicKeyToken=65E474D141E25E07 “ /></ assemblies ></ compilation > assemblage = "Spring.Web, Version = 1.1.2.20125, Culture = neutraal, PublicKeyToken = 65E474D141E25E07" /> </ samenstellingen> </ compilatie>
< authentication <Authenticatie
mode = “ Windows “ /> mode = "Windows" />
</ system.web > </ System.web>
< spring > <Spring>
< context > <Context>
< resource <Resource
uri = “ ~/Configuration/Objects.xml “ /> uri = "~ / Configuratie / Objects.xml" />
</ context > </ Context>
</ spring > </ Lente>
</ configuration > </ Configuration>
Y desde la aplicación En sinds de tenuitvoerlegging
IUserService _ws = ( IUserService ) ContextRegistry .GetContext().GetObject( “UsuarioWS” ); IUserService _ws = (IUserService) ContextRegistry. GetContext (). GetObject ( "UsuarioWS");
lblMessage.Text = _ws.Test(); lblMessage.Text = _ws.Test ();
Con nuestro metodo, Test, como devuelve un string, no hay que castearlo, encambio en el otro metodo tendriamos que estar usando, los objetos de Transfer Objects. Met onze methode, Test-, geretourneerd als een string, geen kaste, encambio in de andere methode zou moeten worden met behulp van de voorwerpen van Overdracht Objecten.
Les dejo, el ejemplo para que lo vean: Ik laat u bijvoorbeeld zien dat:
Consumiendo Web Services con Spring Nuttigen van Web Services met Spring
Sepan disculpar, los horrores de ortografía, ya que lo hice rapidito a este post, Saludos! Excuses weet de verschrikkingen van de spelling, zoals ik heb dit bericht snel, Groeten!
























