Produced by Araxis Merge on 3/27/2019 4:03:22 PM Eastern Daylight Time. See www.araxis.com for information about Merge. This report uses XHTML and CSS2, and is best viewed with a modern standards-compliant browser. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.
# | Location | File | Last Modified |
---|---|---|---|
1 | JLV_CV_CV_2_9_1_0.zip\CV-VAS\src\java\gov\va\med\jmeadows | HeaderHandler.java | Wed Mar 20 21:45:10 2019 UTC |
2 | JLV_CV_CV_2_9_1_0.zip\CV-VAS\src\java\gov\va\med\jmeadows | HeaderHandler.java | Wed Mar 27 19:21:17 2019 UTC |
Description | Between Files 1 and 2 |
|
---|---|---|
Text Blocks | Lines | |
Unchanged | 2 | 218 |
Changed | 1 | 2 |
Inserted | 0 | 0 |
Removed | 0 | 0 |
Whitespace | |
---|---|
Character case | Differences in character case are significant |
Line endings | Differences in line endings (CR and LF characters) are ignored |
CR/LF characters | Not shown in the comparison detail |
No regular expressions were active.
1 | package go v.va.med.j meadows; | |
2 | ||
3 | /** | |
4 | * Created with Inte lliJ IDEA. | |
5 | * User: DNS | |
6 | * Date: 9 /6/14 | |
7 | * Time: 1 1:08 PM | |
8 | * To chan ge this te mplate use File | Se ttings | F ile Templa tes. | |
9 | */ | |
10 | ||
11 | import gov .va.med.co mmon.AppCo nfig; | |
12 | import gov .va.med.fo undations. utilities. EncryptUti l; | |
13 | import org .apache.lo g4j.Logger ; | |
14 | import org .springfra mework.bea ns.factory .annotatio n.Autowire d; | |
15 | import org .springfra mework.ste reotype.Co mponent; | |
16 | ||
17 | import jav a.util.Set ; | |
18 | import jav ax.xml.nam espace.QNa me; | |
19 | import jav ax.xml.soa p.SOAPElem ent; | |
20 | import jav ax.xml.soa p.SOAPEnve lope; | |
21 | import jav ax.xml.soa p.SOAPHead er; | |
22 | import jav ax.xml.soa p.SOAPMess age; | |
23 | import jav ax.xml.ws. handler.Me ssageConte xt; | |
24 | import jav ax.xml.ws. handler.so ap.SOAPHan dler; | |
25 | import jav ax.xml.ws. handler.so ap.SOAPMes sageContex t; | |
26 | ||
27 | /** | |
28 | * @author www.javad b.com | |
29 | */ | |
30 | public cla ss HeaderH andler imp lements SO APHandler< SOAPMessag eContext> { | |
31 | ||
32 | @Autow ired | |
33 | protec ted AppCon fig appCon fig; | |
34 | privat e static f inal Logge r logger = Logger.ge tLogger(JM eadowsServ iceHandler Impl.class .getName() ); | |
35 | ||
36 | public boolean h andleMessa ge(SOAPMes sageContex t smc) { | |
37 | ||
38 | Bo olean outb oundProper ty = (Bool ean) smc.g et(Message Context.ME SSAGE_OUTB OUND_PROPE RTY); | |
39 | ||
40 | if (outbound Property.b ooleanValu e()) { | |
41 | ||
42 | //SOAPMe ssage mess age = smc. getMessage (); | |
43 | ||
44 | try { | |
45 | Stri ng userNam e = Encryp tUtil.decr ypt(appCon fig.getJMe adowsUsern ame()); | |
46 | Stri ng passWor d = Encryp tUtil.decr ypt(appCon fig.getJMe adowsPassw ord()); | |
47 | ||
48 | SOAP Envelope e nvelope = smc.getMes sage().get SOAPPart() .getEnvelo pe(); | |
49 | if ( envelope.g etHeader() == null) { | |
50 | envelope.a ddHeader() ; | |
51 | } | |
52 | SOAP Header hea der = enve lope.getHe ader(); | |
53 | ||
54 | SOAP Element se curity = | |
55 | header .addChildE lement("Se curity", " wsse", "ht tp://docs. oasis-open .org/wss/2 004/01/oas is-200401- wss-wssecu rity-secex t-1.0.xsd" ); | |
56 | ||
57 | SOAP Element us ernameToke n = | |
58 | securi ty.addChil dElement(" UsernameTo ken", "wss e"); | |
59 | user nameToken. addAttribu te(new QNa me("xmlns: wsu"), "ht tp://docs. oasis-open .org/wss/2 004/01/oas is-200401- wss-wssecu rity-utili ty-1.0.xsd "); | |
60 | ||
61 | SOAP Element us ername = | |
62 | userna meToken.ad dChildElem ent("Usern ame", "wss e"); | |
63 | user name.addTe xtNode(use rName); | |
64 | ||
65 | SOAP Element pa ssword = | |
66 | userna meToken.ad dChildElem ent("Passw ord", "wss e"); | |
67 | pass word.setAt tribute("T ype", "htt p://docs.o asis-open. org/wss/20 04/01/oasi s-200401-w ss-usernam e-token-pr ofile-1.0# PasswordTe xt"); | |
68 | pass word.addTe xtNode(pas sWord); | |
69 | ||
70 | //Pr int out th e outbound SOAP mess age to Sys tem.out | |
71 | //me ssage.writ eTo(System .out); | |
72 | //Sy stem.out.p rintln("") ; | |
73 | ||
74 | } catch (Exception e) { | |
75 | e.pr intStackTr ace(); | |
76 | } | |
77 | ||
78 | } else { | |
79 | try { | |
80 | ||
81 | //Th is handler does noth ing with t he respons e from the Web Servi ce so | |
82 | //we just prin t out the SOAP messa ge. | |
83 | // SO APMessage message = smc.getMes sage(); | |
84 | // me ssage.writ eTo(System .out); | |
85 | // Sy stem.out.p rintln("") ; | |
86 | logg er.debug(" This ws-se curity hea der handle r does not hing with the respon se from th e Web Serv ice, skipp ing..."); | |
87 | ||
88 | } catch (Exception ex) { | |
89 | ex.p rintStackT race(); | |
90 | } | |
91 | } | |
92 | ||
93 | re turn outbo undPropert y; | |
94 | ||
95 | } | |
96 | ||
97 | public Set getHe aders() { | |
98 | // throw new Unsupporte dOperation Exception( "Not suppo rted yet." ); | |
99 | re turn null; | |
100 | } | |
101 | ||
102 | public boolean h andleFault (SOAPMessa geContext context) { | |
103 | // throw new Unsupporte dOperation Exception( "Not suppo rted yet." ); | |
104 | re turn true; | |
105 | } | |
106 | ||
107 | public void clos e(MessageC ontext con text) { | |
108 | // throw new Unsupporte dOperation Exception( "Not suppo rted yet." ); | |
109 | } | |
110 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.