Bueno, acá publico un ejemplo simple de un Web Servicess que implementa spring, para levantar servicios virtuales, con una capa de datos también por inyección de código. 공개 웹 Servicess 여기서는 간단한 예를 글쎄, 그 데이터의 레이어와 가상 서비스를 구축하기 위해 봄, 구현은 코드를 주입합니다.
Son mis primeras experiencias, así que las quiero compartir con ustedes, las capas que tengo son: 그들은 내 첫 경험, 나는 당신과 함께 나누고 싶어, 내가 레이어되고있다 :

Ahora les explico, no tiene gran funcionalidad este ejemplo, ya que solo lo hice para compartir… y no es para ningún desarrollo real. 지금 난, 그것이 훌륭한 기능을 공유하기 때문에이 예제가 아니라 그냥 ... 어떠한 실제 개발에 대해 설명합니다.
Tengo el 나

Sería el CommonTypes, el objeto que voy a transferir, para este caso no tiene mucho sentido, pero más adelante voy a mostrar como consumir un WS por spring.Net, y en este caso si es útil para saber que voy a recibir. 내가 전송 CommonTypes 갈건데,이 경우에는 훨씬 이해가되지 않는 개체,하지만 것이 나중에 내가 어떻게 spring.Net WAS를 소비하고, 그렇다면 그것이 내가 그것을받을 것이다 여부를 아는 데 유용합니다 표시됩니다.
Así que es una clase sin nada en particular 그래서, 특히 아무것도없이 수업의

….. ... ..

En el DAO, defino las interfaces, así puedo tener un Sql Implementation, Oracle, Xml, lo que quisiera realmente, no hay ningún secreto por ahora. the 경우 DAO에서, 그래서 구현 Sql, 오라클, XML을, 이젠 정말 더 이상 비밀이 가질 수 있도록 인터페이스를 정의합니다.
Ahora veamos las otras dos capas que nos quedan 이제 우리가 가지고있는 다른 두 레이어 보자

En Entitys, es una interfaz del WebServices… en este caso, es muy simple Entitys 있음 인터페이스 WebServices입니다 ...이 사건은 매우 간단합니다

Y en ServiceImplementation, simplemente hay que implementar y codificarlo. 그리고 그냥 ServiceImplementation 인코딩을 구현하고있다.

Bueno ahora vamos a ver, mas sobre este UserService… 그럼 이제 당신이 ... UserService에 대해 자세히 볼 수있습니다

Generamos estas propiedades, para asignarle por spring, una instancia del DAO, podría ser de sql, oracle, o lo que quisieran, mientras implementaran la interfaz … Eso es lo que ofrece spring.net 동시에 그것은 ... 그것이 바로 spring.net 준다 구현 생성 이러한 속성 봄, DAO에의 인스턴스로, 오라클, 또는 무엇을 그들이 원했던 것은 SQL 될 수도 할당할
En nuestro método, usamos este DAO que asignamos, para traer “x” dato. 우리의 방식에서, 우리는 이것을 DAO "x"로 데이터를 첨부하여 사용합니다.

Ahora, solo nos falta configurar el WebServices. 이제 우리는 그냥 WebServices를 구성해야합니다.

Generen, una carpeta “X”, con un Xml de configuración, en mi caso “Configuration”, y “webServices.xml”. "Xml 구성과 함께, 나의 경우는"구성 "및"webServices.xml 폴더에있는 "X를 만듭니다.
En este mismo, tenemos que hacer todo el mapping 이번에 우리는 매핑을 할 필요가
<? xml <? Xml
version = “ 1.0 “ 버전 = "1.0"
encoding = “ utf-8 “ ?> 인코딩 = "은 UTF - 8"?>
< objects <객체
xmlns = “ http://www.springframework.net “ > xmlns = "http://www.springframework.net">
< description > Servicios Expuestos </ description > <description> 서비스를받으며 </ 설명>
< object <개체
id = “ UserServiceAsmx “ 아이디 = "UserServiceAsmx"
type = “ Synnax.Core.WS.UserAuthentication.ServiceImplementation.UserService, Synnax.Core.WS.UserAuthentication.ServiceImplementation “ > 유형 = "Synnax.Core.WS.UserAuthentication.ServiceImplementation.UserService, Synnax.Core.WS.UserAuthentication.ServiceImplementation">
< property <부동산
name = “ IUser “ 이름 = "IUser"
ref = “ UserDAO “ /> 심판 = "UserDAO"/>
</ object > </ 객체>
< object <개체
id = “ UserDAO “ 아이디 = "UserDAO"
type = “ Synnax.Core.WS.UserAuthentication.DataAccess.SqlImplementation.UserImpl, Synnax.Core.WS.UserAuthentication.DataAccess.SqlImplementation “ /> 유형 = "Synnax.Core.WS.UserAuthentication.DataAccess.SqlImplementation.UserImpl, Synnax.Core.WS.UserAuthentication.DataAccess.SqlImplementation"/>
< object <개체
id = “ UserServices “ 아이디 = "UserServices"
type = “ Spring.Web.Services.WebServiceExporter, Spring.Web “ > 유형 = "Spring.Web.Services.WebServiceExporter, Spring.Web">
< property <부동산
name = “ TargetName “ 이름 = "TargetName"
value = “ UserServiceAsmx “ /> 값 = "UserServiceAsmx"/>
< property <부동산
name = “ Namespace “ 이름 = "네임 스페이스"
value = “ http://synnax/services/ “ /> 값 = "http://synnax/services/"/>
< property <부동산
name = “ Description “ 이름 = "설명"
value = “ Web Service de Usuario “ /> 값 = "웹 서비스를 사용자가"/>
</ object > </ 객체>
</ objects > </ 객체>
En sí, configuramos un objeto UserDAO , que apunta a la implementación del DAO que queremos, en este caso una para SqlServer, generamos un Objeto “ UserServiceAsmx “, que apunta a la implementación del WS, y como verán le asigno la propiedad IUser, que espera una implementación del DAO, en este caso el UserDAO que configuramos. 따라서,이 경우에는 SqlServer 대한 우리를 구성하는 개체 UserDAO, DAO를 우리가 원하는의 구현을 가리키고,, 우리 "의 구현에 WAS를 가리키는 및 목적"UserServiceAsmx 생성 IUser 재산, 그에게 어떤 임무를 맡길 것인가 우리는이 사건의 경우 DAO의 구현 UserDAO 설정 보류 중입니다.
Y por ultimo generamos un “ UserServices ” que como Target tiene nuestro UserServiceAsmx , esto va a levantar un .asmx “virtual”, en este caso sería un UserServices.asmx. 그리고 마지막으로, 그것을 하나 뜰게요 그 대상처럼 UserServiceAsmx있다 "UserServices"를 만듭니다. asmx ""그것은이 사건에 가상 UserServices.asmx.
Bueno, como último paso, hay que configurar el Web.Config. 자, 마지막 단계로, 구성은 Web.config있다.
< configuration > <configuration>
<!– Begin - Necesario para Spring.NET –> <! - 시작 - Spring.NET에 필요한 ->
< configSections > <ConfigSections>
< sectionGroup <SectionGroup
name = “ spring “ > 이름 = "봄">
< section <섹션
name = “ context “ 이름 = "컨텍스트"
type = “ Spring.Context.Support.WebContextHandler, Spring.Web “ /> 유형 = "Spring.Context.Support.WebContextHandler, Spring.Web"/>
</ sectionGroup > </ SectionGroup>
</ configSections > </ ConfigSections>
… ...
</ configuration > </ 구성>
Esto siempre va, dentro de System.Web 이 될 것이라 생각된다 항상 System.Web 시간
< system.web > <system.web>
<!– Begin - Necesario para Spring.NET –> <! - 시작 - Spring.NET에 필요한 ->
< httpHandlers > <httpHandlers>
< add <추가
verb = “ * “ 동사 = "*"
path = “ *.asmx “ 경로 = "*. asmx"
type = “ Spring.Web.Services.WebServiceHandlerFactory, Spring.Web “ /> 유형 = "Spring.Web.Services.WebServiceHandlerFactory, Spring.Web"/>
</ httpHandlers > </ httpHandlers>
< httpModules > <httpModules>
< add <추가
name = “ Spring “ 이름 = "봄"
type = “ Spring.Context.Support.WebSupportModule, Spring.Web “ /> 유형 = "Spring.Context.Support.WebSupportModule, Spring.Web"/>
</ httpModules > </ httpModules>
<!– End - Necesario para Spring.NET –> <! - 끝 - 필요한 Spring.NET ->
… ...
</ system.web > </ system.web>
Es evidente que hace esto, levanta las peticiones que se hacen para los asmx, y el modulo correspondiente para manejar todo esto. 그것은이 asmx 및 모듈에 대한 모든 요청이 처리하기 위해 만들어진 제기 분명하다.
Y como final, después del nodo de system.web … 그리고 마지막으로 system.web 노드 후 ...
</ system.web > </ system.web>
<!– Begin - Necesario para Spring.NET –> <! - 시작 - Spring.NET에 필요한 ->
< spring > <Spring>
< context <상황별
type = “ Spring.Context.Support.WebApplicationContext, Spring.Web “ > 유형 = "Spring.Context.Support.WebApplicationContext, Spring.Web">
< resource <리소스
uri = “ ~/Configuration/webServices.xml “ /> URI는 = "~ / 구성 / webServices.xml"/>
</ context > </ 상황별>
</ spring > </ 봄>
<!– End - Necesario para Spring.NET –> <! - 끝 - 필요한 Spring.NET ->
</ configuration > </ 구성>
Le asignamos el archivo de configuración, al contexto que estamos usando. 우리는 구성 파일에 지정되면, 우리가 사용하고있는 컨텍스트.
Levantan, y si tipean el nombre alias que apuntamos la implementación del WS, va a andar todo correctamente: , 및 해제하는 경우에는 이름 tipean의 구현에 WAS를 가리키는 별칭, 모든 게 순조롭게 진행될 것입니다 :

Bueno, eso fue algo rápido, y que no tenía pensando publicarlo hoy, pero alguien me pidió un ejemplo. 글쎄, 그건 뭔가를 빨리하고 오늘은 마음을하지 못했지만, 누군가가 나에게 한 가지 예를 물었다.
Saludos. 인사말.
PD: No se olviden de meter todas las dependencias de spring.net, sino no va a andar nada! 추신 : 모든 단위 spring.net을 잊지 마세요하지만 아무것도 탈 수 없어! Obvie esos pasos, porque son lógicos. 왜냐하면 그들은 논리적으로,이 단계를 우회.
Share and Enjoy: 공유하고 즐기십시오 :