Consumir Web Services con Spring.net Работа с Web Services Spring.net
Bueno, el ejemplo que arme anteriormente, lo publique con el IIS en un directorio virtual llamado WSUserAuthentication Ну, руки выше примере, при публикации в IIS виртуальный каталог называется WSUserAuthentication

Ahora, vamos a armar un cliente que consuma este WS, sin una Web Refence , sino por spring.net. Теперь, давайте строить клиента, что занимает это без Web Refence но 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. Создать новый веб-проект, мы должны refenciar Весна библиотек, а также интерфейс нашего Web Services и слой, который генерирует как TransferObjects ", которое является объектом, который клиент получит.

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. Придется думать, как мы будем делать это позже, контроль версий asemblys, если мы внесем изменения в WAS, альтернативные бы поместить их в GAC, чтобы забыть о том, чтобы скопировать все события, которые требуют WAS Андалузия, последняя версия, если это необходимо.

En mi caso, genero una carpeta de Configuración, con un Xml de los objetos que consumo en spring, en este caso В моем случае, я генерировать настройки пакета, с одним из объектов, которые Xml потребления весной, в данном случае
<? xml <? Xml
version = “ 1.0 “ Версия = "1.0"
encoding = “ utf-8 “ ?> кодировка = "UTF-8"?>
< objects <Объекты
xmlns = “ http://www.springframework.net “ > xmlns = "http://www.springframework.net">
< description > An example that demonstrates simple IoC features. </ description > <description> Пример, который демонстрирует простой МОК особенностей. </ Описание>
<!– Web Services –> <! - Web Services ->
< object <Объект
id = “ UsuarioWS “ ID = "UsuarioWS"
type = “ Spring.Web.Services.WebServiceProxyFactory, Spring.Services “ > Тип = "Spring.Web.Services.WebServiceProxyFactory, Spring.Services">
< property <Недвижимость
name = “ ServiceUri “ Имя = "ServiceUri"
value = “ http://localhost/WSUserAuthentication/UserServices.asmx “ Значение = "http://localhost/WSUserAuthentication/UserServices.asmx"
/> />
< property <Недвижимость
name = “ ServiceInterface “ Имя = "ServiceInterface"
value = “ Synnax.Core.WS.UserAuthentication.Entitys.IUserService, Synnax.Core.WS.UserAuthentication.Entitys ” Значение = "Synnax.Core.WS.UserAuthentication.Entitys.IUserService, Synnax.Core.WS.UserAuthentication.Entitys"
/> />
</ object > </ OBJECT>
</ objects > </ Объекты>
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. Пол объект называется "UsuarioWS", которая в тройном WebServiceProxyFactory, в котором указать ServiceUri, где мы провели наш был с услугой входы и реализует интерфейс.
Definimos el contexto del spring, y la configuracion de los objetos. Мы определяем контекст весной и конфигурации объектов.
< configuration > <Configuration>
< configSections > <ConfigSections>
< sectionGroup <SectionGroup
name = “ spring “ > NAME = "Весна">
< section <Раздел
name = “ context “ NAME = "контекст"
type = “ Spring.Context.Support.ContextHandler, Spring.Core “ /> Тип = "Spring.Context.Support.ContextHandler, Spring.Core" />
</ sectionGroup > </ SectionGroup>
</ configSections > </ ConfigSections>
< appSettings /> <AppSettings />
< connectionStrings /> <ConnectionStrings />
< system.web > <System.web>
< compilation <Компиляция
debug = “ false “ > отладочной = "ложные">
< assemblies > <Assemblies>
< add <Добавить
assembly = “ Spring.Core, Version=1.1.2.20125, Culture=neutral, PublicKeyToken=65E474D141E25E07 “ /> Ассамблея = "Spring.Core версии = 1.1.2.20125, культура = нейтрально, PublicKeyToken = 65E474D141E25E07" />
< add <Добавить
assembly = “ Spring.Services, Version=1.1.2.20125, Culture=neutral, PublicKeyToken=65E474D141E25E07 “ /> Ассамблея = "Spring.Services версии = 1.1.2.20125, культура = нейтрально, PublicKeyToken = 65E474D141E25E07" />
< add <Добавить
assembly = “ Spring.Web, Version=1.1.2.20125, Culture=neutral, PublicKeyToken=65E474D141E25E07 “ /></ assemblies ></ compilation > Ассамблея = "Spring.Web версии = 1.1.2.20125, культура = нейтрально, PublicKeyToken = 65E474D141E25E07" /> </ сборки> </ компиляции>
< authentication <Аутентификация
mode = “ Windows “ /> Режим = "Windows" />
</ system.web > </ System.web>
< spring > <Spring>
< context > <Context>
< resource <Ресурсах
uri = “ ~/Configuration/Objects.xml “ /> URI = "~ / Настройка / Objects.xml" />
</ context > </ Контекст>
</ spring > </ Весна>
</ configuration > </ Настройка>
Y desde la aplicación И поскольку выполнение
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. В нашем методе испытаний, возвращается в виде строки, ни касты, encambio в другой метод, необходимо будет использовать объекты Передача объектов.
Les dejo, el ejemplo para que lo vean: Я оставляю вам, например, см.:
Consumiendo Web Services con Spring Работа для веб-служб с весны
Sepan disculpar, los horrores de ortografía, ya que lo hice rapidito a este post, Saludos! Apologize знать ужасов написание, как я сделал эту должность быстро, Привет!
























