Produced by Araxis Merge on 1/17/2019 10:54:39 AM Central Standard 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 | v1_iter_1_VIP_Build_4_Dec_2018_CG.zip\v1_iter_1_VIP_Build_4\portlets\caret-portlet\docroot\WEB-INF\src\gov\va\oit\oed\vaww\handler | MessageHandler.java | Wed Jan 16 16:07:52 2019 UTC |
| 2 | v1_iter_1_VIP_Build_4_Dec_2018_CG.zip\v1_iter_1_VIP_Build_4\portlets\caret-portlet\docroot\WEB-INF\src\gov\va\oit\oed\vaww\handler | MessageHandler.java | Wed Jan 16 21:34:53 2019 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 2 | 260 |
| 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.oit.o ed.vaww.ha ndler; | |
| 2 | ||
| 3 | import jav a.io.ByteA rrayOutput Stream; | |
| 4 | import jav a.io.IOExc eption; | |
| 5 | import jav a.io.Outpu tStream; | |
| 6 | import jav a.io.Strin gReader; | |
| 7 | import jav a.io.Strin gWriter; | |
| 8 | import jav a.util.Set ; | |
| 9 | ||
| 10 | import jav ax.xml.nam espace.QNa me; | |
| 11 | import jav ax.xml.par sers.Docum entBuilder ; | |
| 12 | import jav ax.xml.par sers.Docum entBuilder Factory; | |
| 13 | import jav ax.xml.soa p.SOAPElem ent; | |
| 14 | import jav ax.xml.soa p.SOAPExce ption; | |
| 15 | import jav ax.xml.soa p.SOAPMess age; | |
| 16 | import jav ax.xml.tra nsform.Tra nsformerEx ception; | |
| 17 | import jav ax.xml.tra nsform.Tra nsformerFa ctory; | |
| 18 | import jav ax.xml.tra nsform.Tra nsformerFa ctoryConfi gurationEr ror; | |
| 19 | import jav ax.xml.tra nsform.dom .DOMSource ; | |
| 20 | import jav ax.xml.tra nsform.str eam.Stream Result; | |
| 21 | import jav ax.xml.ws. handler.Me ssageConte xt; | |
| 22 | import jav ax.xml.ws. handler.so ap.SOAPHan dler; | |
| 23 | import jav ax.xml.ws. handler.so ap.SOAPMes sageContex t; | |
| 24 | ||
| 25 | import org .w3c.dom.D ocument; | |
| 26 | import org .w3c.dom.E lement; | |
| 27 | import org .w3c.dom.N ode; | |
| 28 | import org .w3c.dom.N odeList; | |
| 29 | import org .xml.sax.I nputSource ; | |
| 30 | ||
| 31 | import com .liferay.p ortal.kern el.log.Log ; | |
| 32 | import com .liferay.p ortal.kern el.log.Log FactoryUti l; | |
| 33 | ||
| 34 | import gov .va.caret. Applicatio nWorkFlowE xception; | |
| 35 | ||
| 36 | ||
| 37 | public cla ss Message Handler im plements S OAPHandler <SOAPMessa geContext> { | |
| 38 | ||
| 39 | pr ivate stat ic Log _lo g = LogFac toryUtil.g etLog(Mess ageHandler .class); | |
| 40 | ||
| 41 | @O verride | |
| 42 | pu blic boole an handleM essage(SOA PMessageCo ntext cont ext) { | |
| 43 | ||
| 44 | Bool ean outBou nd = (Bool ean) conte xt.get(Mes sageContex t.MESSAGE_ OUTBOUND_P ROPERTY); | |
| 45 | ||
| 46 | SOAP Message me ssage = co ntext.getM essage(); | |
| 47 | if ( outBound.b ooleanValu e()) { | |
| 48 | try { | |
| 49 | message. getSOAPPar t().getEnv elope().ge tHeader(). setPrefix( "S"); | |
| 50 | message. getSOAPPar t().getEnv elope().re moveNamesp aceDeclara tion("SOAP -ENV"); | |
| 51 | ||
| 52 | ||
| 53 | Document BuilderFac tory facto ry = Docum entBuilder Factory.ne wInstance( ); | |
| 54 | Document Builder bu ilder; | |
| 55 | try { | |
| 56 | //added fo r Fortify Scan | |
| 57 | // factory.se tFeature(" http://apa che.org/xm l/features /disallow- doctype-de cl", true) ; | |
| 58 | buil der = fact ory.newDoc umentBuild er(); | |
| 59 | Docu ment docum ent = buil der.parse( new InputS ource(new StringRead er( com.li feray.port al.kernel. util.HtmlU til.unesca pe(toStrin g( (SOAPEl ement) mes sage.getSO APPart().g etEnvelope ().getBody ().getFirs tChild() ) ) ))); | |
| 60 | ||
| 61 | Elem ent origin alDocument Element = document.g etDocument Element(); | |
| 62 | Element ne wDocumentE lement = d ocument.cr eateElemen tNS("http: // DNS . URL . ", origina lDocumentE lement.get NodeName() ); | |
| 63 | // S et the des ired names pace and p refix | |
| 64 | newD ocumentEle ment.setPr efix("ps") ; | |
| 65 | // C opy all ch ildren | |
| 66 | Node List list = original DocumentEl ement.getC hildNodes( ); | |
| 67 | whil e(list.get Length()!= 0) { | |
| 68 | newDocumen tElement.a ppendChild (list.item (0)); | |
| 69 | } | |
| 70 | // R eplace the original element | |
| 71 | docu ment.repla ceChild(ne wDocumentE lement, or iginalDocu mentElemen t); | |
| 72 | ||
| 73 | ((SO APElement) message.g etSOAPPart ().getEnve lope().get Body().get FirstChild ()).detach Node(); | |
| 74 | mess age.getSOA PPart().ge tEnvelope( ).getBody( ).addDocum ent( docum ent ); | |
| 75 | ||
| 76 | } catch (Exception e) { | |
| 77 | e.pr intStackTr ace(); | |
| 78 | } | |
| 79 | ||
| 80 | ((SOAPEl ement) mes sage.getSO APPart().g etEnvelope ().getBody ().getFirs tChild()). setAttribu te("xmlns" , "urn:hl7 -org:v3"); | |
| 81 | ((SOAPEl ement) mes sage.getSO APPart().g etEnvelope ().getBody ().getFirs tChild()). removeName spaceDecla ration("xs i"); | |
| 82 | ((SOAPEl ement) mes sage.getSO APPart().g etEnvelope ().getBody ().getFirs tChild()). setAttribu te("ITSVer sion", "XM L_1.0"); | |
| 83 | ((SOAPEl ement) mes sage.getSO APPart().g etEnvelope ().getBody ().getFirs tChild()). removeAttr ibute("xsi :type"); | |
| 84 | ||
| 85 | message. saveChange s(); | |
| 86 | } catc h (SOAPExc eption | T ransformer FactoryCon figuration Error e) { | |
| 87 | Applicat ionWorkFlo wException .handleExc eption(e); | |
| 88 | } | |
| 89 | } | |
| 90 | ||
| 91 | if ( _log.isDe bugEnabled () ) { | |
| 92 | _log.d ebug(outBo und.boolea nValue()? "OUTBOUND: :::" : "IN COMING:::: "); | |
| 93 | Output Stream bao s = new By teArrayOut putStream( ); | |
| 94 | try { | |
| 95 | message. writeTo(ba os); | |
| 96 | } catc h (SOAPExc eption | I OException e) { | |
| 97 | e.printS tackTrace( ); | |
| 98 | } | |
| 99 | _log.d ebug( baos ); | |
| 100 | } | |
| 101 | ||
| 102 | retu rn true; | |
| 103 | } | |
| 104 | ||
| 105 | St ring toStr ing(Node n ode) { | |
| 106 | Stri ngWriter s tringWrite r = new St ringWriter (); | |
| 107 | try { | |
| 108 | Transf ormerFacto ry inst = Transforme rFactory.n ewInstance (); | |
| 109 | //adde d for Fort ify Scan | |
| 110 | // inst.s etAttribut e("http:// javax.xml. XMLConstan ts/propert y/accessEx ternalDTD" , ""); //X MLConstant s.ACCESS_E XTERNAL_DT D | |
| 111 | inst.n ewTransfor mer().tran sform(new DOMSource( node), new StreamRes ult(string Writer)); | |
| 112 | } ca tch (Trans formerExce ption e) { | |
| 113 | Applic ationWorkF lowExcepti on.handleE xception(e ); | |
| 114 | } | |
| 115 | retu rn stringW riter.toSt ring(); | |
| 116 | } | |
| 117 | ||
| 118 | @O verride | |
| 119 | pu blic boole an handleF ault(SOAPM essageCont ext contex t) { | |
| 120 | retu rn true; | |
| 121 | } | |
| 122 | ||
| 123 | @O verride | |
| 124 | pu blic void close(Mess ageContext context) { | |
| 125 | } | |
| 126 | ||
| 127 | @O verride | |
| 128 | pu blic Set<Q Name> getH eaders() { | |
| 129 | retu rn null; | |
| 130 | } | |
| 131 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.