锘??xml version="1.0" encoding="utf-8" standalone="yes"?> 棣栧厛灝唓uartz.jar,浠ュ強(qiáng)lib鐩綍涓嬮潰core鍜宱ptional涓や釜鐩綍涓殑鎵鏈塲ar鍏ㄩ兘鏀懼叆欏圭洰WEB-INF\lib鐩綍涓?/p>
job灝辨槸涓涓畝鍗曠殑java綾伙紝榪欓噷鐨勫姛鑳藉氨鏄緭鍑哄綋鍓嶇殑鏃墮棿浜嗐?/p>
import java.util.Date; import org.apache.commons.logging.Log; public class Helloworld implements Job{ 聽private static Log _log = LogFactory 聽public void execute(JobExecutionContext context) 鐒跺悗緙栧啓quartz.properties鏂囦歡錛岃繖涓枃浠剁殑榛樿鍚嶇О灝辨槸quartz.properties錛屽鏋滃惎鍔ㄩ」鐩殑鏃跺欙紝Quartz娌℃湁鍦ㄥ伐紼嬩腑鎵懼埌璇ユ枃浠訛紝灝變細(xì)浠庤嚜宸辯殑jar鍖呬笅闈㈣鍙栧叾榛樿鐨刾roperties鏂囦歡錛屽叾鍐呭濡備笅錛?/p>
org.quartz.scheduler.instanceName = TestScheduler org.quartz.threadPool.class = org.quartz.simpl.SimpleThreadPool org.quartz.plugin.triggHistory.class = org.quartz.plugins.history.LoggingTriggerHistoryPlugin org.quartz.plugin.jobInitializer.class = org.quartz.plugins.xml.JobInitializationPlugin 涓婇潰鐨?/p>
org.quartz.plugin.jobInitializer.fileName = quartz_job.xml 鏄敤鏉ラ厤緗畾涔塲ob鏂囦歡鐨勫悕縐般?/p>
鐒跺悗緙栧啓quartz_job.xml錛?/p>
鍙互鐪嬪埌錛屽湪閰嶇疆鏂囦歡涓妸jobdetail鍜宼rigger閮戒綔浜嗗畬鏁寸殑瀹氫箟錛屽茍緇勫悎鎴愪竴涓猨ob銆備笅闈紝鎴戜滑鎶婁笂闈袱涓枃浠墮兘鏀懼叆/WEB-INF/classes鐩綍涓嬶紝鐒跺悗鎸夌収api涓殑璇存槑淇敼涓涓媤eb.xml銆?/p>
榪欐牱錛屽湪鍚姩Tomcat鐨勬椂鍊欙紝QuartzInitializerServlet榪欎釜Servlet灝變細(xì)鑷姩璇誨彇quartz.properties榪欎釜閰嶇疆鏂囦歡錛屽茍鍒濆鍖栬皟搴︿俊鎭紝鍚姩Scheduler銆?br />鎴戝湪榪欓噷鐢ㄧ殑鏄疩uartz1.5.0錛屽湪1.5.1涓柊澧炲姞浜哘uartzInitializerListener錛屼絾鏄技涔庢湁浜涢棶棰橈紝濮嬬粓鍚姩涓嶈搗鏉ワ紝鑰屼笖鏇磋繃鍒嗙殑鏄紝瀹冪殑api灞呯劧鍐欓敊浜嗭紝鍦?lt;listener-class>榪欎釜鏍囪涓紝鐢ㄤ簡 QuartzInitializerServletListener錛屽氨綆楁妸鏈哄櫒鐮鎬簡錛屽畠涔熸壘涓嶅埌榪欎釜綾誨晩錛?/p>
鐜板湪灝卞ぇ鍔熷憡鎴愪簡 涓嶈繃鐪嬭搗鏉ョ畝鍗曪紝瑙e喅鐨勮繃紼嬪嵈寰堥儊闂鳳紝鍗曞崟鏄冭檻濡備綍鍦ㄥ悗鍙拌繘紼嬩腑榪愯Servlet灝辮姳浜嗗ソ闀挎椂闂達(dá)紝鍚庢潵鏌ヨ祫鏂欎互鍚庢墠鐭ラ亾鍙互鐢↙istener鎴栬呮槸鍚姩鏃惰繍琛岀殑Servlet鏉ュ畬鎴愶紝鐪嬫潵鑷繁鐨勫簳瀛愯繕鏄笉鎵庡疄鐨? 鍙﹀灝辨槸鍦═omcat鍑虹幇闂鐨勬椂鍊欙紝灞呯劧蹇樹簡鍒發(fā)ogs涓嬮潰鍘葷湅鏃ュ織錛岃繖涓枏蹇芥槸涓嶅彲鍘熻皡鐨勶紒浠ュ悗瑕佺墷鐗㈣浣忥紒
聽聽 xmlns:isd="http://xml.apache.org/xml-soap/deployment"
聽聽 id="urn:service" checkMustUnderstands="true">
聽聽聽聽聽 <isd:provider type="java" scope="Request" methods="setAlarm">
聽聽聽聽聽 <isd:java class="work.Service" static="false"/>
聽聽 </isd:provider>
</isd:service>
涓婇潰鐨剋ork.Service鏄被鐨勫叏鍚嶏紝setAlarm鏄彁渚涚殑鏈嶅姟鍚?urn:service鏄疷RI銆傚啀鍐欎竴涓剼鏈潵璋冪敤閰嶇疆鏂囦歡閮ㄧ講鏈嶅姟
java org.apache.soap.server.ServiceManagerClient
http://localhost:8080/soap/servlet/rpcrouter deploy deploy.xml
鍚姩Tomcat涔嬪悗錛屽惎鍔ㄨ剼鏈紝鐒跺悗鎵цClient浠g爜灝卞彲浠ヤ簡錛孋lient鐨勪富浣撲唬鐮佸緢綆鍗曪紝浠g爜閲岄潰灝變笉鍔犲叆娉ㄩ噴浜嗐?br />聽聽
聽聽聽 Call call = new Call ();
聽聽聽 call.setEncodingStyleURI(Constants.NS_URI_SOAP_ENC);
聽聽聽 call.setTargetObjectURI ("urn:service");
聽聽聽 call.setMethodName ("setAlarm");
聽聽聽 Parameter param = new Parameter("alarm", String.class, alarm, Constants.NS_URI_SOAP_ENC);
聽聽聽 Vector paramList = new Vector();
聽聽聽 paramList.addElement(param);
聽聽聽 call.setParams (paramList);
聽聽聽 URL url = new URL ("http://localhost:8080/soap/servlet/rpcrouter");
聽聽聽 Response resp = call.invoke (url, "");
聽聽聽 if (!resp.generatedFault()) {
聽聽聽聽聽 // Extract Return value
聽聽聽聽聽 Parameter result = resp.getReturnValue ();
聽聽聽聽聽 String greeting = (String) result.getValue();
聽聽聽聽聽 return greeting;
聽聽聽 }
聽聽聽 else {
聽聽聽聽聽 //聽 Extract Fault Code and String
聽聽聽聽聽 Fault f = resp.getFault();
聽聽聽聽聽 String faultCode = f.getFaultCode();
聽聽聽聽聽 String faultString = f.getFaultString();
聽聽聽聽聽 System.err.println("Fault Occurred (details follow):");
聽聽聽聽聽 System.err.println("Fault Code:聽 "+faultCode);
聽聽聽聽聽 System.err.println("Fault String:聽 "+faultString);
聽聽聽聽聽 return new String ("Fault Occurred.聽 No greeting for you!");
聽聽聽 }
]]>
import org.apache.commons.logging.LogFactory;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
聽public Helloworld() {
聽}
聽聽聽.getLog(Helloworld.class);
聽聽聽throws JobExecutionException {
聽聽_log.info("Hello World! - " + new Date());
聽}
}
org.quartz.scheduler.instanceId = one
org.quartz.threadPool.threadCount =聽 2
org.quartz.threadPool.threadPriority = 4
org.quartz.plugin.triggHistory.triggerFiredMessage = Trigger {1}.{0} fired job {6}.{5} at: {4, date, HH:mm:ss MM/dd/yyyy}
org.quartz.plugin.triggHistory.triggerCompleteMessage = Trigger {1}.{0} completed firing job {6}.{5} at {4, date, HH:mm:ss MM/dd/yyyy} with resulting trigger instruction code: {9}
org.quartz.plugin.jobInitializer.fileName = quartz_job.xml
org.quartz.plugin.jobInitializer.overWriteExistingJobs = false
org.quartz.plugin.jobInitializer.failOnFileNotFound = true
org.quartz.plugin.shutdownhook.class = org.quartz.plugins.management.ShutdownHookPlugin
org.quartz.plugin.shutdownhook.cleanShutdown = true
<quartz>
聽 <job>
聽聽聽 <job-detail>
聽聽聽聽聽 <name>helloworld</name>
聽聽聽聽聽 <group>group1</group>
聽聽聽聽聽 <job-class>Helloworld</job-class>
聽聽聽 </job-detail>
聽聽聽 <trigger>
聽聽聽聽聽 <cron>
聽聽聽聽聽聽聽 <name>test</name>
聽聽聽聽聽聽聽 <group>group1</group>
聽聽聽聽聽聽聽 <job-name>helloworld</job-name>
聽聽聽聽聽聽聽 <job-group>group1</job-group>
聽聽聽聽聽聽聽 <cron-expression>0 0/1 * * * ?</cron-expression>
聽聽聽聽 </cron>
聽聽聽 </trigger>
聽 </job>
</quartz>
聽聽聽聽聽聽聽聽 <servlet-name>
聽聽聽聽聽聽聽聽聽聽聽聽 QuartzInitializer
聽聽聽聽聽聽聽聽 </servlet-name>
聽聽聽聽聽聽聽聽 <display-name>
聽聽聽聽聽聽聽聽聽聽聽聽 Quartz Initializer Servlet
聽聽聽聽聽聽聽聽 </display-name>
聽聽聽聽聽聽聽聽 <servlet-class>
聽聽聽聽聽聽聽聽聽聽聽聽 org.quartz.ee.servlet.QuartzInitializerServlet
聽聽聽聽聽聽聽聽 </servlet-class>
聽聽聽聽聽聽聽聽 <load-on-startup>1</load-on-startup>
聽聽聽聽聽聽聽聽 <init-param>
聽聽聽聽聽聽聽聽聽聽聽聽 <param-name>config-file</param-name>
聽聽聽聽聽聽聽聽聽聽聽聽 <param-value>/quartz.properties</param-value>
聽聽聽聽聽聽聽聽 </init-param>
聽聽聽聽聽聽聽聽 <init-param>
聽聽聽聽聽聽聽聽聽聽聽聽 <param-name>shutdown-on-unload</param-name>
聽聽聽聽聽聽聽聽聽聽聽聽 <param-value>true</param-value>
聽聽聽聽聽聽聽聽 </init-param>
聽聽聽聽 </servlet>
涓涓狫ob綾伙紝涓涓猶uartz.properties鏂囦歡錛屼竴涓猶uertz_job.xml鏂囦歡錛岃繕鏈変慨鏀逛竴涓媤eb.xml鏂囦歡錛屽緢綆鍗曞憖錛?/p>
]]>
params.addElement(new Parameter("eventStatus",Integer.class, new Integer(1), null));
params.addElement(new Parameter("eventStatus",int.class, new Integer(1), null));
params.addElement(new Parameter("eventStatus",int.class, 1, null));
params.addElement(new Parameter("eventStatus",Intege.class, 1, null));
緇撴灉緇熺粺澶辮觸錛屽紕鐨勬垜閮借鎶撶媯浜嗐?br />
浠婂ぉ鍒頒簡鍏徃浠ュ悗錛岃窡緇勯暱璇翠簡榪欎歡浜嬫儏錛岀粍闀胯璁╂垜鎹㈢敤AXIS璇曡瘯鐪嬶紝鎴戝埌ws.apache.org/axis涓婇潰鐪嬩簡鐪嬫枃妗o紝鍦╱ser guide閲岄潰緇欏嚭鐨勪緥瀛愬拰鎴戠殑浠g爜宸埆寰堝ぇ錛屾垜灝卞彧濂芥寜鐫瀹冪殑渚嬪瓙閲嶆柊鏀逛唬鐮?br />
鍐欏畬浠ュ悗錛岄厤鐜鍙橀噺閰嶇殑蹇鎶撶媯鈥︹﹂儴緗茬殑鏃跺欏張鏄竴澶撮浘姘粹︹︽渶鍚庡緇堟病鏈夋垚鍔熲︹︽渶鍚庡洖鍒板鑸嶆墠鎯沖埌錛孉XIS鍜孉pache SOAP Server涓嶈繃閮芥槸鏈嶅姟鍣ㄨ屽凡錛屼笉搴旇瀛樺湪瑙勮寖涓婄殑鍖哄埆錛屼篃灝辨槸涓嶅簲璇ヤ細(xì)褰卞搷鍒板鎴風(fēng)鐨勭▼搴忥紝浜庢槸鎴戝氨鎸夌収鏈寮濮嬬殑浠g爜錛屾妸Service閮ㄧ講濂斤紝鍚姩 Tomcat錛屼粠WSDL涓壘鍒板搴旂殑淇℃伅
聽<wsdl:port binding="impl:serviceSoapBinding" name="service">
聽 <wsdlsoap:address location="http://localhost:8080/axis/services/service" />
聽</wsdl:port>
</wsdl:service>
鍦▁ml閰嶇疆鏂囦歡涓紝鎶妉ocation璧嬪肩粰URL錛屾妸name璧嬪肩粰TargetObjectURI錛岃繍琛孋lient錛屼竴鍒嘜K
涓嶇煡閬撴槸涓嶆槸鍥犱負(fù)鏈哄櫒鐨勯棶棰橈紝鍦ㄥ叕鍙哥殑鎬濊礬榪滆繙涓嶅鍦ㄥ鑸嶅晩
涓嶈繃浠婂ぉ鑷沖皯璁╂垜寰堢啛緇冪殑鎺屾彙浜嗗浣曟墜宸ラ儴緗睞XIS鏈嶅姟錛屽垱寤轟竴涓獁sdd鏂囦歡錛屾垜鎶婂畠鍛藉悕涓篸eploy.wsdd
聽聽聽 <parameter name="className" value="Service" />
聽聽聽 <parameter name="allowedMethods" value="setAlarmInfo" />
聽 </service>
</deployment>
鎶婅繖涓枃浠舵斁鍒癟omcat/webapps/axis/WEB-INF/鐩綍涓嬶紝鎶妔ervice鐨勭被鏀懼埌WEB-INF/classes/鐩綍涓嬶紝鎶?axis.jar;jaxrpc.jar;commons-logging-1.0.4.jar;commons-discovery-0.2.jar;saaj.jar 鏀懼埌classpath閲岄潰錛屽惎鍔═omcat涔嬪悗錛屽埌webapps/axis/WEB-INF鐩綍涓嬭繍琛岋細(xì)
java org.apache.axis.client.AdminClient deploy.wsdd
涔嬪悗鍙互璁塊棶
http://localhost:8080/axis/
鏉ユ煡鐪嬪垰鎵嶉儴緗茬殑service瀵瑰簲鐨剋sdl浜?img src ="http://www.tkk7.com/dearwolf/aggbug/70293.html" width = "1" height = "1" />
]]>
authenticationProcessionFilter(AuthenticationProcessingFilter)---->
authenticationManager(ProviderManger)---->
daoAuthenticationProvider(DaoAuthenticationProvider)---->
userDetailsService(UserDetailsService)
鍦ㄦ渶搴曞眰鐨刄serDetailsService鎺ュ彛涓紝鎻愪緵浜唋oadUserByUsername榪欎釜鏂規(guī)硶錛屾垜浠彧闇瑕佸疄鐜拌繖涓帴鍙o紝騫跺疄鐜版帴鍙d腑鐨勬柟娉曪紝灝卞彲浠ヤ嬌鐢ㄨ嚜宸辯殑楠岃瘉鍔熻兘浜嗐傝鏂規(guī)硶浼犲叆鐨勫弬鏁版槸String username錛岃繑鍥炵被鍨嬫槸UserDetails錛屽緢鏄劇劧錛屾垜浠渶瑕侀氳繃鑷繁鐨刣ao錛屾牴鎹畊sername鏉ュ緱鍒拌嚜瀹氫箟鐨剈ser綾誨瀷錛岀劧鍚庢妸瀹冨皝瑁呭埌UserDetails閲岄潰鍘伙紝鐒跺悗榪斿洖銆?/p>
鍙﹀錛屽湪UserDetail榪欎釜綾婚噷闈紝鏈変竴涓狦rantedAuthority[] 綾誨瀷鐨勫睘鎬э紝鐢ㄦ潵瀛樻斁璇ョ敤鎴鋒墍瀵瑰簲鐨勬潈闄愶紝鎴戜滑鍦╨oadUserByUsername榪欎釜鏂規(guī)硶閲岄潰錛屽悓鏍蜂篃闇瑕佸緱鍒拌鐢ㄦ埛鐨勬潈闄愶紝騫舵妸瀹冭祴緇欒繑鍥炵殑UserDetails銆?/p>
鍋囧鐢ㄦ埛瀵瑰簲鐨勭被鍚嶄負(fù)UserInfo錛屾潈闄愬搴旂殑綾誨悕涓篟oles錛屽湪UserInfo涓湁涓涓彉閲?/p>
private Set roles;
鍦ㄥ緱鍒版潈闄愪俊鎭殑鏃跺欙紝鍥犱負(fù)瀹冩槸闆嗗悎錛屾墍浠ュ彲浠ヤ嬌鐢ㄥ歡榪熷姞杞藉姛鑳斤紝璇誨彇鐨勬椂鍊欏厛浠庣紦瀛樹腑鍙栨暟鎹紝濡傛灉鍙栦笉鍒扮殑璇濓紝灝辮皟鐢║serInfo.getRoles()鏂規(guī)硶錛岃繖涓椂鍊欏氨浼?xì)鍒版暟鎹簱涓彇鏁版嵁浜嗗Q屽彇鍒頒互鍚庯紝鍐嶆妸鏁版嵁鏀懼埌緙撳瓨涓?/p>
SOAP is a lightweight protocol intented to exchanging structured information in a decentralized, distributed environment.The two major goals for SOAP is simplicity and extensibility.
SOAP is widely used for XML messaging as it :
聽聽聽 defines thin layer on top of widely understood HTTP聽
聽聽聽 is flexible and extensible聽
聽聽聽 enjoys broad industry and developer community support
Main uses of SOAP are for
聽聽聽 messaging: sending XML data orders, invoices, forms聽
聽聽聽 RPC: invoking services querying data sources, transacting
2. WSDL--Web Service Definition Language
As聽the communication protocols and message formats are standardized聽in the web community, it becomes increasingly possible and important to be able to聽describe the communication s in some structured way.WSDL addresses this need by defining an XML grammar for describing network services as collections of communication endpoints capable of exchanging messages.
3. 聽UDDI--聽Universal Description, Discovery, and Integration
UDDI protocol is a central element of the group of related standards that comprise the Web services stack. The specification defines a standard method for publishing and discovering the network-based software components of a service-oriented architecture.
4.聽 the relationship between SOAP,WSDL and UDDI
web service client 闇瑕佸畾浣嶅彟涓涓簲鐢ㄧ▼搴忔垨鑰呮槸緗戠粶涓婄殑鏌愪竴孌典笟鍔¢昏緫錛?/font> client 閫氳繃 name 銆?/font> catagory 銆?/font> identifier 鎴栬?/font> specification 鏉ヤ粠 UDDI registry 涓煡璇㈡湇鍔★紝瀹氫綅浠ュ悗錛?/font> client 浠?/font> UDDI registry 涓緱鍒?/font> WSDL 鏂囨。鐨勪綅緗俊鎭傚湪 WSDL 鏂囨。鐨?/font> XML schema 涓寘鍚簡濡備綍璁塊棶 web service 鍜岃姹備俊鎭殑鏍煎紡錛?/font> client 鎸夌収 xml schema 鐨勬牸寮忔潵鍒涘緩涓涓?/font> soap 娑堟伅錛屽茍鍚?/font> host 鍙戦佽姹傘?/span>