Flutter SVG gradient is not rendered: Failed to find definition for url - flutter

I have this gradient image
but it seems that flutter_svg is not able to render it.
The code of the image is:
<svg width="249" height="76" viewBox="0 0 249 76" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M156.656 57.6692C153.048 57.6692 149.734 56.8297 146.714 55.1506C143.693 53.4715 141.26 51.1628 139.415 48.2244C137.653 45.202 136.772 41.8019 136.772 38.0239C136.772 34.162 137.653 30.8038 139.415 27.9494C141.26 25.011 143.693 22.7442 146.714 21.1491C149.734 19.47 153.048 18.6304 156.656 18.6304C160.347 18.6304 163.661 19.47 166.597 21.1491C169.618 22.7442 172.009 25.011 173.771 27.9494C175.533 30.8038 176.413 34.162 176.413 38.0239C176.413 41.8019 175.533 45.202 173.771 48.2244C172.009 51.1628 169.618 53.4715 166.597 55.1506C163.661 56.8297 160.347 57.6692 156.656 57.6692ZM156.656 47.4688C159.256 47.4688 161.354 46.5873 162.948 44.8242C164.626 42.9772 165.465 40.7104 165.465 38.0239C165.465 35.2534 164.626 33.0286 162.948 31.3495C161.354 29.6704 159.256 28.8309 156.656 28.8309C154.139 28.8309 151.999 29.6704 150.237 31.3495C148.559 33.0286 147.721 35.2534 147.721 38.0239C147.721 40.7104 148.559 42.9772 150.237 44.8242C151.999 46.5873 154.139 47.4688 156.656 47.4688Z" fill="url(#paint0_linear_809_1834)"/>
<path d="M192.916 57.6692C187.211 57.6692 182.513 56.4939 178.822 54.1432C178.067 53.6394 177.521 53.0517 177.186 52.3801C176.85 51.6245 176.682 50.9109 176.682 50.2393C176.682 48.812 177.144 47.5108 178.067 46.3354C179.073 45.16 180.29 44.5723 181.716 44.5723C182.387 44.5723 183.058 44.7403 183.73 45.0761C185.24 45.7477 186.96 46.3354 188.889 46.8391C190.819 47.2589 192.581 47.4688 194.175 47.4688C197.279 47.4688 198.831 46.7552 198.831 45.3279C198.831 44.4884 198.454 43.7748 197.699 43.1871C196.943 42.5155 195.182 42.0537 192.413 41.8019C191.322 41.7179 189.896 41.55 188.134 41.2981C186.456 41.0463 184.778 40.5845 183.1 39.9129C181.422 39.1573 179.996 38.0659 178.822 36.6387C177.731 35.2114 177.186 33.2805 177.186 30.8458C177.186 27.0679 178.612 24.0875 181.464 21.9047C184.317 19.7218 188.134 18.6304 192.916 18.6304C195.685 18.6304 198.286 18.9243 200.719 19.512C203.236 20.0996 205.123 20.9812 206.382 22.1565C207.556 23.2479 208.144 24.5072 208.144 25.9345C208.144 27.1938 207.682 28.3272 206.759 29.3346C205.837 30.3421 204.662 30.8458 203.236 30.8458C202.481 30.8458 201.768 30.6779 201.096 30.3421C200.09 29.6704 198.789 29.1667 197.195 28.8309C195.685 28.4951 194.133 28.3272 192.539 28.3272C189.351 28.3272 187.757 28.9988 187.757 30.3421C187.757 30.9298 188.05 31.4755 188.638 31.9792C189.309 32.399 190.777 32.7768 193.042 33.1126C194.468 33.2805 196.104 33.5323 197.95 33.8682C199.796 34.12 201.558 34.6237 203.236 35.3793C204.998 36.051 206.466 37.1844 207.64 38.7795C208.815 40.3746 209.402 42.5574 209.402 45.3279C209.402 49.1059 207.892 52.1282 204.872 54.395C201.851 56.5778 197.866 57.6692 192.916 57.6692Z" fill="url(#paint1_linear_809_1834)"/>
<path d="M208.358 23.6677C208.358 21.9886 208.946 20.7293 210.12 19.8897C211.295 19.0502 212.637 18.6304 214.147 18.6304C215.322 18.6304 216.329 18.9662 217.168 19.6379C218.091 20.2256 218.72 21.0651 219.055 22.1565L226.858 41.1722C227.277 42.2636 227.865 42.8093 228.62 42.8093C229.375 42.8093 229.92 42.2636 230.256 41.1722L237.051 22.1565C237.471 20.9812 238.142 20.0996 239.065 19.512C240.072 18.9243 241.12 18.6304 242.211 18.6304C243.637 18.6304 244.938 19.0922 246.112 20.0157C247.371 20.9392 248 22.1565 248 23.6677C248 24.5072 247.832 25.3048 247.497 26.0604L227.865 71.3958C227.277 72.6551 226.522 73.5366 225.599 74.0404C224.76 74.628 223.879 74.9219 222.957 74.9219C221.446 74.9219 220.062 74.3762 218.804 73.2848C217.629 72.2773 217.042 71.06 217.042 69.6327C217.042 68.8772 217.21 68.2055 217.545 67.6178L224.341 55.5284C222.915 55.1086 221.782 54.0592 220.943 52.3801L208.736 25.9345C208.484 25.1789 208.358 24.4233 208.358 23.6677Z" fill="url(#paint2_linear_809_1834)"/>
<path d="M45.0462 53.0098C43.4521 54.2691 41.0191 55.3605 37.7471 56.284C34.4751 57.2075 31.287 57.6692 28.1828 57.6692C22.9811 57.6692 18.3248 56.5359 14.2139 54.2691C10.1029 51.9184 6.87283 48.6861 4.5237 44.5723C2.17457 40.4586 1 35.7991 1 30.5939C1 25.1369 2.13262 20.4355 4.39785 16.4896C6.74698 12.5437 9.97703 9.52137 14.088 7.42251C18.199 5.2397 22.9811 4.14829 28.4345 4.14829C30.6997 4.14829 32.965 4.35818 35.2302 4.77795C37.5793 5.19772 39.7187 5.86936 41.6483 6.79286C42.6551 7.29658 43.3682 7.96822 43.7877 8.80776C44.2911 9.56335 44.5428 10.4029 44.5428 11.3264C44.5428 12.6697 44.0394 13.929 43.0327 15.1043C42.1098 16.1958 40.8513 16.7415 39.2573 16.7415C38.5861 16.7415 37.873 16.6155 37.1179 16.3637C35.6077 15.776 33.9717 15.3142 32.2099 14.9784C30.448 14.5586 28.8959 14.3488 27.5536 14.3488C23.1909 14.3488 19.5414 15.818 16.6049 18.7564C13.7524 21.6948 12.3262 25.6406 12.3262 30.5939C12.3262 35.8831 13.7944 40.0388 16.7308 43.0612C19.7511 46.0835 23.6104 47.5947 28.3086 47.5947C30.2383 47.5947 32.2938 47.2589 34.4751 46.5873C36.6564 45.9156 38.4183 45.0761 39.7607 44.0686C40.6835 43.4809 41.6903 43.1871 42.781 43.1871C44.2072 43.1871 45.3398 43.6908 46.1788 44.6983C47.1017 45.6218 47.5631 46.7971 47.5631 48.2244C47.5631 50.0714 46.7241 51.6665 45.0462 53.0098Z" fill="url(#paint3_linear_809_1834)"/>
<path d="M56.587 57.6692C54.993 57.6692 53.6506 57.2075 52.5599 56.284C51.4693 55.3605 50.9239 54.1851 50.9239 52.7579V5.91133C50.9239 4.56806 51.4273 3.43468 52.4341 2.51118C53.5248 1.50373 54.9091 1 56.587 1C58.1811 1 59.4815 1.50373 60.4883 2.51118C61.495 3.43468 61.9984 4.61004 61.9984 6.03727V22.7862C63.0891 21.5269 64.5573 20.5194 66.403 19.7638C68.2488 19.0082 70.2204 18.6304 72.3178 18.6304C77.0161 18.6304 80.7915 20.0157 83.644 22.7862C86.5804 25.5567 88.0486 29.9643 88.0486 36.009V53.0098C88.0486 54.353 87.5033 55.4864 86.4126 56.4099C85.4058 57.2495 84.1054 57.6692 82.5114 57.6692C80.9173 57.6692 79.5749 57.2075 78.4843 56.284C77.4775 55.3605 76.9741 54.1851 76.9741 52.7579V37.3942C76.9741 34.2879 76.261 32.0631 74.8347 30.7199C73.4924 29.3766 71.8144 28.705 69.8009 28.705C67.7034 28.705 65.9835 29.4186 64.6412 30.8458C63.2988 32.1891 62.4179 33.7002 61.9984 35.3793V52.632C61.9984 54.0592 61.4531 55.2765 60.3624 56.284C59.3556 57.2075 58.0972 57.6692 56.587 57.6692Z" fill="url(#paint4_linear_809_1834)"/>
<path d="M112.376 9.31541C105.287 10.0754 102.882 22.2992 102.565 28.3161C100.287 29.0761 100.139 22.2992 100.35 18.8158C100.35 17.5491 99.7172 17.0213 99.4007 16.9157C97.9239 16.7046 94.6537 18.1191 93.3879 25.466C92.122 32.813 93.2305 38.8017 93.7355 40.9747C93.9361 41.8379 94.5902 43.6632 95.1622 44.9008C96.8117 48.4699 99.3143 51.8243 103.198 54.6004C108.515 58.4006 116.806 58.0839 120.287 57.4505C123.874 56.6061 130.127 53.2449 132.313 46.6835C134.528 40.0332 133.79 36.5498 133.262 35.9164C132.946 35.0719 131.743 33.383 129.465 33.383C127.186 33.383 126.195 35.4942 125.984 36.5498C125.878 36.7609 125.667 37.8165 125.667 40.3499C125.667 42.8833 123.557 45.4168 122.503 46.3668C120.182 47.6335 114.654 49.2169 111.11 45.4168C107.565 41.6166 109.211 37.4998 110.477 35.9164C111.215 34.8608 113.515 32.6863 116.806 32.4329C120.097 32.1796 123.241 35.0719 124.401 36.5498C124.148 33.763 127.039 31.5885 128.515 30.8495C125.667 27.9994 122.819 26.7327 121.553 26.0994C120.54 25.5927 120.92 23.8826 121.553 23.2493L131.68 11.5322L125.351 17.5491L126.808 16.1639L131.68 11.5322C131.996 10.7932 131.49 9.44209 126.933 9.94877C121.237 10.5821 114.591 21.6659 111.426 23.2493C108.895 24.516 110.16 20.8214 111.11 18.8158C112.059 17.2324 114.085 13.5589 114.591 11.5322C115.097 9.50542 113.325 9.20986 112.376 9.31541Z" fill="url(#paint5_linear_809_1834)"/>
<path d="M131.68 11.5322C131.996 10.7932 131.49 9.44209 126.933 9.94877C121.237 10.5821 114.591 21.6659 111.426 23.2493C108.895 24.516 110.16 20.8214 111.11 18.8158C112.059 17.2324 114.085 13.5589 114.591 11.5322C115.097 9.50542 113.325 9.20986 112.376 9.31541C105.287 10.0754 102.882 22.2992 102.565 28.3161C100.287 29.0761 100.139 22.2992 100.35 18.8158C100.35 17.5491 99.7172 17.0213 99.4007 16.9157C97.9239 16.7046 94.6537 18.1191 93.3879 25.466C92.122 32.813 93.2305 38.8017 93.7355 40.9747M131.68 11.5322L126.808 16.1639L125.351 17.5491L131.68 11.5322ZM131.68 11.5322L121.553 23.2493C120.92 23.8826 120.54 25.5927 121.553 26.0994C122.819 26.7327 125.667 27.9994 128.515 30.8495C127.039 31.5885 124.148 33.763 124.401 36.5498C123.241 35.0719 120.097 32.1796 116.806 32.4329C113.515 32.6863 111.215 34.8608 110.477 35.9164C109.211 37.4998 107.565 41.6166 111.11 45.4168C114.654 49.2169 120.182 47.6335 122.503 46.3668C123.557 45.4168 125.667 42.8833 125.667 40.3499C125.667 37.8165 125.878 36.7609 125.984 36.5498C126.195 35.4942 127.186 33.383 129.465 33.383C131.743 33.383 132.946 35.0719 133.262 35.9164C133.79 36.5498 134.528 40.0332 132.313 46.6835C130.127 53.2449 123.874 56.6061 120.287 57.4505C116.806 58.0839 108.515 58.4006 103.198 54.6004C99.3143 51.8243 96.8117 48.4699 95.1622 44.9008M93.7355 40.9747C93.9361 41.8379 94.5902 43.6632 95.1622 44.9008M93.7355 40.9747L95.1622 44.9008M156.656 57.6692C153.048 57.6692 149.734 56.8297 146.714 55.1506C143.693 53.4715 141.26 51.1628 139.415 48.2244C137.653 45.202 136.772 41.8019 136.772 38.0239C136.772 34.162 137.653 30.8038 139.415 27.9494C141.26 25.011 143.693 22.7442 146.714 21.1491C149.734 19.47 153.048 18.6304 156.656 18.6304C160.347 18.6304 163.661 19.47 166.597 21.1491C169.618 22.7442 172.009 25.011 173.771 27.9494C175.533 30.8038 176.413 34.162 176.413 38.0239C176.413 41.8019 175.533 45.202 173.771 48.2244C172.009 51.1628 169.618 53.4715 166.597 55.1506C163.661 56.8297 160.347 57.6692 156.656 57.6692ZM156.656 47.4688C159.256 47.4688 161.354 46.5873 162.948 44.8242C164.626 42.9772 165.465 40.7104 165.465 38.0239C165.465 35.2534 164.626 33.0286 162.948 31.3495C161.354 29.6704 159.256 28.8309 156.656 28.8309C154.139 28.8309 151.999 29.6704 150.237 31.3495C148.559 33.0286 147.721 35.2534 147.721 38.0239C147.721 40.7104 148.559 42.9772 150.237 44.8242C151.999 46.5873 154.139 47.4688 156.656 47.4688ZM192.916 57.6692C187.211 57.6692 182.513 56.4939 178.822 54.1431C178.067 53.6394 177.521 53.0517 177.186 52.3801C176.85 51.6245 176.682 50.9109 176.682 50.2393C176.682 48.812 177.144 47.5108 178.067 46.3354C179.073 45.16 180.29 44.5723 181.716 44.5723C182.387 44.5723 183.058 44.7403 183.73 45.0761C185.24 45.7477 186.96 46.3354 188.889 46.8391C190.819 47.2589 192.581 47.4688 194.175 47.4688C197.279 47.4688 198.831 46.7552 198.831 45.3279C198.831 44.4884 198.454 43.7748 197.699 43.1871C196.943 42.5155 195.182 42.0537 192.413 41.8019C191.322 41.7179 189.896 41.55 188.134 41.2981C186.456 41.0463 184.778 40.5845 183.1 39.9129C181.422 39.1573 179.996 38.0659 178.822 36.6387C177.731 35.2114 177.186 33.2805 177.186 30.8458C177.186 27.0679 178.612 24.0875 181.464 21.9047C184.317 19.7218 188.134 18.6304 192.916 18.6304C195.685 18.6304 198.286 18.9243 200.719 19.512C203.236 20.0996 205.123 20.9812 206.382 22.1565C207.556 23.2479 208.144 24.5072 208.144 25.9345C208.144 27.1938 207.682 28.3272 206.759 29.3346C205.837 30.3421 204.662 30.8458 203.236 30.8458C202.481 30.8458 201.768 30.6779 201.096 30.3421C200.09 29.6704 198.789 29.1667 197.195 28.8309C195.685 28.4951 194.133 28.3272 192.539 28.3272C189.351 28.3272 187.757 28.9988 187.757 30.3421C187.757 30.9298 188.05 31.4755 188.638 31.9792C189.309 32.399 190.777 32.7768 193.042 33.1126C194.468 33.2805 196.104 33.5323 197.95 33.8682C199.796 34.12 201.558 34.6237 203.236 35.3793C204.998 36.051 206.466 37.1844 207.64 38.7795C208.815 40.3746 209.402 42.5574 209.402 45.3279C209.402 49.1059 207.892 52.1282 204.872 54.395C201.851 56.5778 197.866 57.6692 192.916 57.6692ZM208.358 23.6677C208.358 21.9886 208.946 20.7293 210.12 19.8897C211.295 19.0502 212.637 18.6304 214.147 18.6304C215.322 18.6304 216.329 18.9662 217.168 19.6379C218.091 20.2256 218.72 21.0651 219.055 22.1565L226.858 41.1722C227.277 42.2636 227.865 42.8093 228.62 42.8093C229.375 42.8093 229.92 42.2636 230.256 41.1722L237.051 22.1565C237.471 20.9812 238.142 20.0996 239.065 19.512C240.072 18.9243 241.12 18.6304 242.211 18.6304C243.637 18.6304 244.938 19.0922 246.112 20.0157C247.371 20.9392 248 22.1565 248 23.6677C248 24.5072 247.832 25.3048 247.497 26.0604L227.865 71.3958C227.277 72.6551 226.522 73.5366 225.599 74.0403C224.76 74.628 223.879 74.9219 222.957 74.9219C221.446 74.9219 220.062 74.3762 218.804 73.2848C217.629 72.2773 217.042 71.06 217.042 69.6327C217.042 68.8772 217.21 68.2055 217.545 67.6178L224.341 55.5284C222.915 55.1086 221.782 54.0592 220.943 52.3801L208.736 25.9345C208.484 25.1789 208.358 24.4233 208.358 23.6677ZM45.0462 53.0098C43.4521 54.2691 41.0191 55.3605 37.7471 56.284C34.4751 57.2075 31.287 57.6692 28.1828 57.6692C22.9811 57.6692 18.3248 56.5359 14.2139 54.2691C10.1029 51.9184 6.87283 48.6861 4.5237 44.5723C2.17457 40.4586 1 35.7991 1 30.5939C1 25.1369 2.13262 20.4355 4.39785 16.4896C6.74698 12.5437 9.97703 9.52137 14.088 7.42251C18.199 5.2397 22.9811 4.14829 28.4345 4.14829C30.6997 4.14829 32.965 4.35818 35.2302 4.77795C37.5793 5.19772 39.7187 5.86936 41.6483 6.79286C42.6551 7.29658 43.3682 7.96822 43.7877 8.80776C44.2911 9.56335 44.5428 10.4029 44.5428 11.3264C44.5428 12.6697 44.0394 13.929 43.0327 15.1043C42.1098 16.1958 40.8513 16.7415 39.2573 16.7415C38.5861 16.7415 37.873 16.6155 37.1179 16.3637C35.6077 15.776 33.9717 15.3142 32.2099 14.9784C30.448 14.5586 28.8959 14.3488 27.5536 14.3488C23.1909 14.3488 19.5414 15.818 16.6049 18.7564C13.7524 21.6948 12.3262 25.6406 12.3262 30.5939C12.3262 35.8831 13.7944 40.0388 16.7308 43.0612C19.7511 46.0835 23.6104 47.5947 28.3086 47.5947C30.2383 47.5947 32.2938 47.2589 34.4751 46.5873C36.6564 45.9156 38.4183 45.0761 39.7607 44.0686C40.6835 43.4809 41.6903 43.1871 42.781 43.1871C44.2072 43.1871 45.3398 43.6908 46.1788 44.6983C47.1017 45.6218 47.5631 46.7971 47.5631 48.2244C47.5631 50.0714 46.7241 51.6665 45.0462 53.0098ZM56.587 57.6692C54.993 57.6692 53.6506 57.2075 52.5599 56.284C51.4693 55.3605 50.9239 54.1851 50.9239 52.7579V5.91133C50.9239 4.56806 51.4273 3.43468 52.4341 2.51118C53.5248 1.50373 54.9091 1 56.587 1C58.1811 1 59.4815 1.50373 60.4883 2.51118C61.495 3.43468 61.9984 4.61004 61.9984 6.03727V22.7862C63.0891 21.5269 64.5573 20.5194 66.403 19.7638C68.2488 19.0082 70.2204 18.6304 72.3178 18.6304C77.0161 18.6304 80.7915 20.0157 83.644 22.7862C86.5804 25.5567 88.0486 29.9643 88.0486 36.009V53.0098C88.0486 54.353 87.5033 55.4864 86.4126 56.4099C85.4058 57.2495 84.1054 57.6692 82.5114 57.6692C80.9173 57.6692 79.5749 57.2075 78.4843 56.284C77.4775 55.3605 76.9741 54.1851 76.9741 52.7579V37.3942C76.9741 34.2879 76.261 32.0631 74.8347 30.7199C73.4924 29.3766 71.8144 28.705 69.8009 28.705C67.7034 28.705 65.9835 29.4186 64.6412 30.8458C63.2988 32.1891 62.4179 33.7003 61.9984 35.3793V52.632C61.9984 54.0592 61.4531 55.2765 60.3624 56.284C59.3556 57.2075 58.0972 57.6692 56.587 57.6692Z" stroke="url(#paint6_linear_809_1834)" stroke-width="0.263406" stroke-linecap="round" stroke-linejoin="round"/>
<defs>
<linearGradient id="paint0_linear_809_1834" x1="1" y1="74.5218" x2="120.071" y2="-92.6821" gradientUnits="userSpaceOnUse">
<stop stop-color="#E96443"/>
<stop offset="1" stop-color="#904E95"/>
</linearGradient>
<linearGradient id="paint1_linear_809_1834" x1="1" y1="74.5218" x2="120.071" y2="-92.6821" gradientUnits="userSpaceOnUse">
<stop stop-color="#E96443"/>
<stop offset="1" stop-color="#904E95"/>
</linearGradient>
<linearGradient id="paint2_linear_809_1834" x1="1" y1="74.5218" x2="120.071" y2="-92.6821" gradientUnits="userSpaceOnUse">
<stop stop-color="#E96443"/>
<stop offset="1" stop-color="#904E95"/>
</linearGradient>
<linearGradient id="paint3_linear_809_1834" x1="1" y1="74.5218" x2="120.071" y2="-92.6821" gradientUnits="userSpaceOnUse">
<stop stop-color="#E96443"/>
<stop offset="1" stop-color="#904E95"/>
</linearGradient>
<linearGradient id="paint4_linear_809_1834" x1="1" y1="74.5218" x2="120.071" y2="-92.6821" gradientUnits="userSpaceOnUse">
<stop stop-color="#E96443"/>
<stop offset="1" stop-color="#904E95"/>
</linearGradient>
<linearGradient id="paint5_linear_809_1834" x1="1" y1="74.5218" x2="120.071" y2="-92.6821" gradientUnits="userSpaceOnUse">
<stop stop-color="#E96443"/>
<stop offset="1" stop-color="#904E95"/>
</linearGradient>
<linearGradient id="paint6_linear_809_1834" x1="1" y1="74.5218" x2="120.071" y2="-92.6821" gradientUnits="userSpaceOnUse">
<stop stop-color="#E96443"/>
<stop offset="1" stop-color="#904E95"/>
</linearGradient>
</defs>
</svg>
I tried many things, but the SVG file should be correct. When in Flutter, I see the image in white.
The error I get is:
════════ Exception caught by SVG ═══════════════════════════════════════════════
Failed to find definition for url(#paint6_linear_809_1834)
It happens for all the paintN_linear points.

Just move the defs to the top right below the svg tag.
Here's the result:
The XML is going to be like the following:
<svg width="249" height="76" viewBox="0 0 249 76" fill="none" xmlns="http://www.w3.org/2000/svg">
<defs>
<linearGradient id="paint0_linear_809_1834" x1="1" y1="74.5218" x2="120.071" y2="-92.6821" gradientUnits="userSpaceOnUse">
<stop stop-color="#E96443"/>
<stop offset="1" stop-color="#904E95"/>
</linearGradient>
<linearGradient id="paint1_linear_809_1834" x1="1" y1="74.5218" x2="120.071" y2="-92.6821" gradientUnits="userSpaceOnUse">
<stop stop-color="#E96443"/>
<stop offset="1" stop-color="#904E95"/>
</linearGradient>
<linearGradient id="paint2_linear_809_1834" x1="1" y1="74.5218" x2="120.071" y2="-92.6821" gradientUnits="userSpaceOnUse">
<stop stop-color="#E96443"/>
<stop offset="1" stop-color="#904E95"/>
</linearGradient>
<linearGradient id="paint3_linear_809_1834" x1="1" y1="74.5218" x2="120.071" y2="-92.6821" gradientUnits="userSpaceOnUse">
<stop stop-color="#E96443"/>
<stop offset="1" stop-color="#904E95"/>
</linearGradient>
<linearGradient id="paint4_linear_809_1834" x1="1" y1="74.5218" x2="120.071" y2="-92.6821" gradientUnits="userSpaceOnUse">
<stop stop-color="#E96443"/>
<stop offset="1" stop-color="#904E95"/>
</linearGradient>
<linearGradient id="paint5_linear_809_1834" x1="1" y1="74.5218" x2="120.071" y2="-92.6821" gradientUnits="userSpaceOnUse">
<stop stop-color="#E96443"/>
<stop offset="1" stop-color="#904E95"/>
</linearGradient>
<linearGradient id="paint6_linear_809_1834" x1="1" y1="74.5218" x2="120.071" y2="-92.6821" gradientUnits="userSpaceOnUse">
<stop stop-color="#E96443"/>
<stop offset="1" stop-color="#904E95"/>
</linearGradient>
</defs>
<path d="M156.656 57.6692C153.048 57.6692 149.734 56.8297 146.714 55.1506C143.693 53.4715 141.26 51.1628 139.415 48.2244C137.653 45.202 136.772 41.8019 136.772 38.0239C136.772 34.162 137.653 30.8038 139.415 27.9494C141.26 25.011 143.693 22.7442 146.714 21.1491C149.734 19.47 153.048 18.6304 156.656 18.6304C160.347 18.6304 163.661 19.47 166.597 21.1491C169.618 22.7442 172.009 25.011 173.771 27.9494C175.533 30.8038 176.413 34.162 176.413 38.0239C176.413 41.8019 175.533 45.202 173.771 48.2244C172.009 51.1628 169.618 53.4715 166.597 55.1506C163.661 56.8297 160.347 57.6692 156.656 57.6692ZM156.656 47.4688C159.256 47.4688 161.354 46.5873 162.948 44.8242C164.626 42.9772 165.465 40.7104 165.465 38.0239C165.465 35.2534 164.626 33.0286 162.948 31.3495C161.354 29.6704 159.256 28.8309 156.656 28.8309C154.139 28.8309 151.999 29.6704 150.237 31.3495C148.559 33.0286 147.721 35.2534 147.721 38.0239C147.721 40.7104 148.559 42.9772 150.237 44.8242C151.999 46.5873 154.139 47.4688 156.656 47.4688Z" fill="url(#paint0_linear_809_1834)"/>
<path d="M192.916 57.6692C187.211 57.6692 182.513 56.4939 178.822 54.1432C178.067 53.6394 177.521 53.0517 177.186 52.3801C176.85 51.6245 176.682 50.9109 176.682 50.2393C176.682 48.812 177.144 47.5108 178.067 46.3354C179.073 45.16 180.29 44.5723 181.716 44.5723C182.387 44.5723 183.058 44.7403 183.73 45.0761C185.24 45.7477 186.96 46.3354 188.889 46.8391C190.819 47.2589 192.581 47.4688 194.175 47.4688C197.279 47.4688 198.831 46.7552 198.831 45.3279C198.831 44.4884 198.454 43.7748 197.699 43.1871C196.943 42.5155 195.182 42.0537 192.413 41.8019C191.322 41.7179 189.896 41.55 188.134 41.2981C186.456 41.0463 184.778 40.5845 183.1 39.9129C181.422 39.1573 179.996 38.0659 178.822 36.6387C177.731 35.2114 177.186 33.2805 177.186 30.8458C177.186 27.0679 178.612 24.0875 181.464 21.9047C184.317 19.7218 188.134 18.6304 192.916 18.6304C195.685 18.6304 198.286 18.9243 200.719 19.512C203.236 20.0996 205.123 20.9812 206.382 22.1565C207.556 23.2479 208.144 24.5072 208.144 25.9345C208.144 27.1938 207.682 28.3272 206.759 29.3346C205.837 30.3421 204.662 30.8458 203.236 30.8458C202.481 30.8458 201.768 30.6779 201.096 30.3421C200.09 29.6704 198.789 29.1667 197.195 28.8309C195.685 28.4951 194.133 28.3272 192.539 28.3272C189.351 28.3272 187.757 28.9988 187.757 30.3421C187.757 30.9298 188.05 31.4755 188.638 31.9792C189.309 32.399 190.777 32.7768 193.042 33.1126C194.468 33.2805 196.104 33.5323 197.95 33.8682C199.796 34.12 201.558 34.6237 203.236 35.3793C204.998 36.051 206.466 37.1844 207.64 38.7795C208.815 40.3746 209.402 42.5574 209.402 45.3279C209.402 49.1059 207.892 52.1282 204.872 54.395C201.851 56.5778 197.866 57.6692 192.916 57.6692Z" fill="url(#paint1_linear_809_1834)"/>
<path d="M208.358 23.6677C208.358 21.9886 208.946 20.7293 210.12 19.8897C211.295 19.0502 212.637 18.6304 214.147 18.6304C215.322 18.6304 216.329 18.9662 217.168 19.6379C218.091 20.2256 218.72 21.0651 219.055 22.1565L226.858 41.1722C227.277 42.2636 227.865 42.8093 228.62 42.8093C229.375 42.8093 229.92 42.2636 230.256 41.1722L237.051 22.1565C237.471 20.9812 238.142 20.0996 239.065 19.512C240.072 18.9243 241.12 18.6304 242.211 18.6304C243.637 18.6304 244.938 19.0922 246.112 20.0157C247.371 20.9392 248 22.1565 248 23.6677C248 24.5072 247.832 25.3048 247.497 26.0604L227.865 71.3958C227.277 72.6551 226.522 73.5366 225.599 74.0404C224.76 74.628 223.879 74.9219 222.957 74.9219C221.446 74.9219 220.062 74.3762 218.804 73.2848C217.629 72.2773 217.042 71.06 217.042 69.6327C217.042 68.8772 217.21 68.2055 217.545 67.6178L224.341 55.5284C222.915 55.1086 221.782 54.0592 220.943 52.3801L208.736 25.9345C208.484 25.1789 208.358 24.4233 208.358 23.6677Z" fill="url(#paint2_linear_809_1834)"/>
<path d="M45.0462 53.0098C43.4521 54.2691 41.0191 55.3605 37.7471 56.284C34.4751 57.2075 31.287 57.6692 28.1828 57.6692C22.9811 57.6692 18.3248 56.5359 14.2139 54.2691C10.1029 51.9184 6.87283 48.6861 4.5237 44.5723C2.17457 40.4586 1 35.7991 1 30.5939C1 25.1369 2.13262 20.4355 4.39785 16.4896C6.74698 12.5437 9.97703 9.52137 14.088 7.42251C18.199 5.2397 22.9811 4.14829 28.4345 4.14829C30.6997 4.14829 32.965 4.35818 35.2302 4.77795C37.5793 5.19772 39.7187 5.86936 41.6483 6.79286C42.6551 7.29658 43.3682 7.96822 43.7877 8.80776C44.2911 9.56335 44.5428 10.4029 44.5428 11.3264C44.5428 12.6697 44.0394 13.929 43.0327 15.1043C42.1098 16.1958 40.8513 16.7415 39.2573 16.7415C38.5861 16.7415 37.873 16.6155 37.1179 16.3637C35.6077 15.776 33.9717 15.3142 32.2099 14.9784C30.448 14.5586 28.8959 14.3488 27.5536 14.3488C23.1909 14.3488 19.5414 15.818 16.6049 18.7564C13.7524 21.6948 12.3262 25.6406 12.3262 30.5939C12.3262 35.8831 13.7944 40.0388 16.7308 43.0612C19.7511 46.0835 23.6104 47.5947 28.3086 47.5947C30.2383 47.5947 32.2938 47.2589 34.4751 46.5873C36.6564 45.9156 38.4183 45.0761 39.7607 44.0686C40.6835 43.4809 41.6903 43.1871 42.781 43.1871C44.2072 43.1871 45.3398 43.6908 46.1788 44.6983C47.1017 45.6218 47.5631 46.7971 47.5631 48.2244C47.5631 50.0714 46.7241 51.6665 45.0462 53.0098Z" fill="url(#paint3_linear_809_1834)"/>
<path d="M56.587 57.6692C54.993 57.6692 53.6506 57.2075 52.5599 56.284C51.4693 55.3605 50.9239 54.1851 50.9239 52.7579V5.91133C50.9239 4.56806 51.4273 3.43468 52.4341 2.51118C53.5248 1.50373 54.9091 1 56.587 1C58.1811 1 59.4815 1.50373 60.4883 2.51118C61.495 3.43468 61.9984 4.61004 61.9984 6.03727V22.7862C63.0891 21.5269 64.5573 20.5194 66.403 19.7638C68.2488 19.0082 70.2204 18.6304 72.3178 18.6304C77.0161 18.6304 80.7915 20.0157 83.644 22.7862C86.5804 25.5567 88.0486 29.9643 88.0486 36.009V53.0098C88.0486 54.353 87.5033 55.4864 86.4126 56.4099C85.4058 57.2495 84.1054 57.6692 82.5114 57.6692C80.9173 57.6692 79.5749 57.2075 78.4843 56.284C77.4775 55.3605 76.9741 54.1851 76.9741 52.7579V37.3942C76.9741 34.2879 76.261 32.0631 74.8347 30.7199C73.4924 29.3766 71.8144 28.705 69.8009 28.705C67.7034 28.705 65.9835 29.4186 64.6412 30.8458C63.2988 32.1891 62.4179 33.7002 61.9984 35.3793V52.632C61.9984 54.0592 61.4531 55.2765 60.3624 56.284C59.3556 57.2075 58.0972 57.6692 56.587 57.6692Z" fill="url(#paint4_linear_809_1834)"/>
<path d="M112.376 9.31541C105.287 10.0754 102.882 22.2992 102.565 28.3161C100.287 29.0761 100.139 22.2992 100.35 18.8158C100.35 17.5491 99.7172 17.0213 99.4007 16.9157C97.9239 16.7046 94.6537 18.1191 93.3879 25.466C92.122 32.813 93.2305 38.8017 93.7355 40.9747C93.9361 41.8379 94.5902 43.6632 95.1622 44.9008C96.8117 48.4699 99.3143 51.8243 103.198 54.6004C108.515 58.4006 116.806 58.0839 120.287 57.4505C123.874 56.6061 130.127 53.2449 132.313 46.6835C134.528 40.0332 133.79 36.5498 133.262 35.9164C132.946 35.0719 131.743 33.383 129.465 33.383C127.186 33.383 126.195 35.4942 125.984 36.5498C125.878 36.7609 125.667 37.8165 125.667 40.3499C125.667 42.8833 123.557 45.4168 122.503 46.3668C120.182 47.6335 114.654 49.2169 111.11 45.4168C107.565 41.6166 109.211 37.4998 110.477 35.9164C111.215 34.8608 113.515 32.6863 116.806 32.4329C120.097 32.1796 123.241 35.0719 124.401 36.5498C124.148 33.763 127.039 31.5885 128.515 30.8495C125.667 27.9994 122.819 26.7327 121.553 26.0994C120.54 25.5927 120.92 23.8826 121.553 23.2493L131.68 11.5322L125.351 17.5491L126.808 16.1639L131.68 11.5322C131.996 10.7932 131.49 9.44209 126.933 9.94877C121.237 10.5821 114.591 21.6659 111.426 23.2493C108.895 24.516 110.16 20.8214 111.11 18.8158C112.059 17.2324 114.085 13.5589 114.591 11.5322C115.097 9.50542 113.325 9.20986 112.376 9.31541Z" fill="url(#paint5_linear_809_1834)"/>
<path d="M131.68 11.5322C131.996 10.7932 131.49 9.44209 126.933 9.94877C121.237 10.5821 114.591 21.6659 111.426 23.2493C108.895 24.516 110.16 20.8214 111.11 18.8158C112.059 17.2324 114.085 13.5589 114.591 11.5322C115.097 9.50542 113.325 9.20986 112.376 9.31541C105.287 10.0754 102.882 22.2992 102.565 28.3161C100.287 29.0761 100.139 22.2992 100.35 18.8158C100.35 17.5491 99.7172 17.0213 99.4007 16.9157C97.9239 16.7046 94.6537 18.1191 93.3879 25.466C92.122 32.813 93.2305 38.8017 93.7355 40.9747M131.68 11.5322L126.808 16.1639L125.351 17.5491L131.68 11.5322ZM131.68 11.5322L121.553 23.2493C120.92 23.8826 120.54 25.5927 121.553 26.0994C122.819 26.7327 125.667 27.9994 128.515 30.8495C127.039 31.5885 124.148 33.763 124.401 36.5498C123.241 35.0719 120.097 32.1796 116.806 32.4329C113.515 32.6863 111.215 34.8608 110.477 35.9164C109.211 37.4998 107.565 41.6166 111.11 45.4168C114.654 49.2169 120.182 47.6335 122.503 46.3668C123.557 45.4168 125.667 42.8833 125.667 40.3499C125.667 37.8165 125.878 36.7609 125.984 36.5498C126.195 35.4942 127.186 33.383 129.465 33.383C131.743 33.383 132.946 35.0719 133.262 35.9164C133.79 36.5498 134.528 40.0332 132.313 46.6835C130.127 53.2449 123.874 56.6061 120.287 57.4505C116.806 58.0839 108.515 58.4006 103.198 54.6004C99.3143 51.8243 96.8117 48.4699 95.1622 44.9008M93.7355 40.9747C93.9361 41.8379 94.5902 43.6632 95.1622 44.9008M93.7355 40.9747L95.1622 44.9008M156.656 57.6692C153.048 57.6692 149.734 56.8297 146.714 55.1506C143.693 53.4715 141.26 51.1628 139.415 48.2244C137.653 45.202 136.772 41.8019 136.772 38.0239C136.772 34.162 137.653 30.8038 139.415 27.9494C141.26 25.011 143.693 22.7442 146.714 21.1491C149.734 19.47 153.048 18.6304 156.656 18.6304C160.347 18.6304 163.661 19.47 166.597 21.1491C169.618 22.7442 172.009 25.011 173.771 27.9494C175.533 30.8038 176.413 34.162 176.413 38.0239C176.413 41.8019 175.533 45.202 173.771 48.2244C172.009 51.1628 169.618 53.4715 166.597 55.1506C163.661 56.8297 160.347 57.6692 156.656 57.6692ZM156.656 47.4688C159.256 47.4688 161.354 46.5873 162.948 44.8242C164.626 42.9772 165.465 40.7104 165.465 38.0239C165.465 35.2534 164.626 33.0286 162.948 31.3495C161.354 29.6704 159.256 28.8309 156.656 28.8309C154.139 28.8309 151.999 29.6704 150.237 31.3495C148.559 33.0286 147.721 35.2534 147.721 38.0239C147.721 40.7104 148.559 42.9772 150.237 44.8242C151.999 46.5873 154.139 47.4688 156.656 47.4688ZM192.916 57.6692C187.211 57.6692 182.513 56.4939 178.822 54.1431C178.067 53.6394 177.521 53.0517 177.186 52.3801C176.85 51.6245 176.682 50.9109 176.682 50.2393C176.682 48.812 177.144 47.5108 178.067 46.3354C179.073 45.16 180.29 44.5723 181.716 44.5723C182.387 44.5723 183.058 44.7403 183.73 45.0761C185.24 45.7477 186.96 46.3354 188.889 46.8391C190.819 47.2589 192.581 47.4688 194.175 47.4688C197.279 47.4688 198.831 46.7552 198.831 45.3279C198.831 44.4884 198.454 43.7748 197.699 43.1871C196.943 42.5155 195.182 42.0537 192.413 41.8019C191.322 41.7179 189.896 41.55 188.134 41.2981C186.456 41.0463 184.778 40.5845 183.1 39.9129C181.422 39.1573 179.996 38.0659 178.822 36.6387C177.731 35.2114 177.186 33.2805 177.186 30.8458C177.186 27.0679 178.612 24.0875 181.464 21.9047C184.317 19.7218 188.134 18.6304 192.916 18.6304C195.685 18.6304 198.286 18.9243 200.719 19.512C203.236 20.0996 205.123 20.9812 206.382 22.1565C207.556 23.2479 208.144 24.5072 208.144 25.9345C208.144 27.1938 207.682 28.3272 206.759 29.3346C205.837 30.3421 204.662 30.8458 203.236 30.8458C202.481 30.8458 201.768 30.6779 201.096 30.3421C200.09 29.6704 198.789 29.1667 197.195 28.8309C195.685 28.4951 194.133 28.3272 192.539 28.3272C189.351 28.3272 187.757 28.9988 187.757 30.3421C187.757 30.9298 188.05 31.4755 188.638 31.9792C189.309 32.399 190.777 32.7768 193.042 33.1126C194.468 33.2805 196.104 33.5323 197.95 33.8682C199.796 34.12 201.558 34.6237 203.236 35.3793C204.998 36.051 206.466 37.1844 207.64 38.7795C208.815 40.3746 209.402 42.5574 209.402 45.3279C209.402 49.1059 207.892 52.1282 204.872 54.395C201.851 56.5778 197.866 57.6692 192.916 57.6692ZM208.358 23.6677C208.358 21.9886 208.946 20.7293 210.12 19.8897C211.295 19.0502 212.637 18.6304 214.147 18.6304C215.322 18.6304 216.329 18.9662 217.168 19.6379C218.091 20.2256 218.72 21.0651 219.055 22.1565L226.858 41.1722C227.277 42.2636 227.865 42.8093 228.62 42.8093C229.375 42.8093 229.92 42.2636 230.256 41.1722L237.051 22.1565C237.471 20.9812 238.142 20.0996 239.065 19.512C240.072 18.9243 241.12 18.6304 242.211 18.6304C243.637 18.6304 244.938 19.0922 246.112 20.0157C247.371 20.9392 248 22.1565 248 23.6677C248 24.5072 247.832 25.3048 247.497 26.0604L227.865 71.3958C227.277 72.6551 226.522 73.5366 225.599 74.0403C224.76 74.628 223.879 74.9219 222.957 74.9219C221.446 74.9219 220.062 74.3762 218.804 73.2848C217.629 72.2773 217.042 71.06 217.042 69.6327C217.042 68.8772 217.21 68.2055 217.545 67.6178L224.341 55.5284C222.915 55.1086 221.782 54.0592 220.943 52.3801L208.736 25.9345C208.484 25.1789 208.358 24.4233 208.358 23.6677ZM45.0462 53.0098C43.4521 54.2691 41.0191 55.3605 37.7471 56.284C34.4751 57.2075 31.287 57.6692 28.1828 57.6692C22.9811 57.6692 18.3248 56.5359 14.2139 54.2691C10.1029 51.9184 6.87283 48.6861 4.5237 44.5723C2.17457 40.4586 1 35.7991 1 30.5939C1 25.1369 2.13262 20.4355 4.39785 16.4896C6.74698 12.5437 9.97703 9.52137 14.088 7.42251C18.199 5.2397 22.9811 4.14829 28.4345 4.14829C30.6997 4.14829 32.965 4.35818 35.2302 4.77795C37.5793 5.19772 39.7187 5.86936 41.6483 6.79286C42.6551 7.29658 43.3682 7.96822 43.7877 8.80776C44.2911 9.56335 44.5428 10.4029 44.5428 11.3264C44.5428 12.6697 44.0394 13.929 43.0327 15.1043C42.1098 16.1958 40.8513 16.7415 39.2573 16.7415C38.5861 16.7415 37.873 16.6155 37.1179 16.3637C35.6077 15.776 33.9717 15.3142 32.2099 14.9784C30.448 14.5586 28.8959 14.3488 27.5536 14.3488C23.1909 14.3488 19.5414 15.818 16.6049 18.7564C13.7524 21.6948 12.3262 25.6406 12.3262 30.5939C12.3262 35.8831 13.7944 40.0388 16.7308 43.0612C19.7511 46.0835 23.6104 47.5947 28.3086 47.5947C30.2383 47.5947 32.2938 47.2589 34.4751 46.5873C36.6564 45.9156 38.4183 45.0761 39.7607 44.0686C40.6835 43.4809 41.6903 43.1871 42.781 43.1871C44.2072 43.1871 45.3398 43.6908 46.1788 44.6983C47.1017 45.6218 47.5631 46.7971 47.5631 48.2244C47.5631 50.0714 46.7241 51.6665 45.0462 53.0098ZM56.587 57.6692C54.993 57.6692 53.6506 57.2075 52.5599 56.284C51.4693 55.3605 50.9239 54.1851 50.9239 52.7579V5.91133C50.9239 4.56806 51.4273 3.43468 52.4341 2.51118C53.5248 1.50373 54.9091 1 56.587 1C58.1811 1 59.4815 1.50373 60.4883 2.51118C61.495 3.43468 61.9984 4.61004 61.9984 6.03727V22.7862C63.0891 21.5269 64.5573 20.5194 66.403 19.7638C68.2488 19.0082 70.2204 18.6304 72.3178 18.6304C77.0161 18.6304 80.7915 20.0157 83.644 22.7862C86.5804 25.5567 88.0486 29.9643 88.0486 36.009V53.0098C88.0486 54.353 87.5033 55.4864 86.4126 56.4099C85.4058 57.2495 84.1054 57.6692 82.5114 57.6692C80.9173 57.6692 79.5749 57.2075 78.4843 56.284C77.4775 55.3605 76.9741 54.1851 76.9741 52.7579V37.3942C76.9741 34.2879 76.261 32.0631 74.8347 30.7199C73.4924 29.3766 71.8144 28.705 69.8009 28.705C67.7034 28.705 65.9835 29.4186 64.6412 30.8458C63.2988 32.1891 62.4179 33.7003 61.9984 35.3793V52.632C61.9984 54.0592 61.4531 55.2765 60.3624 56.284C59.3556 57.2075 58.0972 57.6692 56.587 57.6692Z" stroke="url(#paint6_linear_809_1834)" stroke-width="0.263406" stroke-linecap="round" stroke-linejoin="round"/>
</svg>

Related

Soap request signing

Hello fellow developers,
I have no experience working on soap, saml and xml signing,
I am trying to generate this structure and then add 2 signature tags to it.
<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope">
<env:Header xmlns:a="http://www.w3.org/2005/08/addressing">
<a:MessageID></a:MessageID>
<a:To env:mustUnderstand="true"></a:To>
<a:Action env:mustUnderstand="true">urn:hl7-org:v3:PRPA_IN201305UV02:CrossGatewayPatientDiscovery</a:Action>
<wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
<wsu:Timestamp wsu:Id="timestamp_ID">
<wsu:Created>2022-10-13T18:18:17.763Z</wsu:Created>
<wsu:Expires>2023-10-13T18:23:17.763Z</wsu:Expires>
</wsu:Timestamp>
<saml2:Assertion xmlns:saml2="urn:oasis:names:tc:SAML:2.0:assertion" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ID="assertion_ID" IssueInstant="2022-10-13T18:18:17.763Z" Version="2.0">
<saml2:Issuer Format="urn:oasis:names:tc:SAML:2.0:nameid-format:X509SubjectName"></saml2:Issuer>
<Signature xmlns="http://www.w3.org/2000/09/xmldsig#">
<SignedInfo>
<CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
<SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"/>
<Reference URI="#assertion_ID">
<Transforms>
<Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"/>
<Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
</Transforms>
<DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>
<DigestValue></DigestValue>
</Reference>
</SignedInfo>
<SignatureValue></SignatureValue>
<KeyInfo>
<X509Data>
<X509Certificate></X509Certificate>
</X509Data>
</KeyInfo>
</Signature>
<saml2:Subject>
<saml2:NameID Format="urn:oasis:names:tc:SAML:1.1:nameid-format:X509SubjectName"></saml2:NameID>
<saml2:SubjectConfirmation Method="urn:oasis:names:tc:SAML:2.0:cm:holder-of-key">
<saml2:SubjectConfirmationData>
<KeyInfo xmlns="http://www.w3.org/2000/09/xmldsig#">
<KeyValue>
<RSAKeyValue>
<Modulus></Modulus>
<Exponent>AQAB</Exponent>
</RSAKeyValue>
</KeyValue>
</KeyInfo>
</saml2:SubjectConfirmationData>
</saml2:SubjectConfirmation>
</saml2:Subject>
<saml2:Conditions NotBefore="2022-10-13T18:15:17.763Z" NotOnOrAfter="2022-10-13T18:23:17.763Z">
<saml2:AudienceRestriction>
<saml2:Audience></saml2:Audience>
</saml2:AudienceRestriction>
</saml2:Conditions>
<saml2:AuthnStatement AuthnInstant="2022-10-13T17:55:17.743Z" SessionIndex="1234567890">
<saml2:SubjectLocality Address="10.1.1.144" DNSName="localhost"/>
<saml2:AuthnContext>
<saml2:AuthnContextClassRef>urn:oasis:names:tc:SAML:2.0:ac:classes:PasswordProtectedTransport</saml2:AuthnContextClassRef>
</saml2:AuthnContext>
</saml2:AuthnStatement>
<saml2:AttributeStatement>
<saml2:Attribute Name="urn:oasis:names:tc:xspa:1.0:subject:subject-id">
<saml2:AttributeValue>John Doe</saml2:AttributeValue>
</saml2:Attribute>
<saml2:Attribute Name="urn:oasis:names:tc:xspa:1.0:subject:organization">
<saml2:AttributeValue>Dr. John M Doe, MD Practice</saml2:AttributeValue>
</saml2:Attribute>
<saml2:Attribute Name="urn:oasis:names:tc:xspa:1.0:subject:organization-id">
<saml2:AttributeValue></saml2:AttributeValue>
</saml2:Attribute>
<saml2:Attribute Name="urn:nhin:names:saml:homeCommunityId">
<saml2:AttributeValue></saml2:AttributeValue>
</saml2:Attribute>
<saml2:Attribute Name="urn:oasis:names:tc:xacml:2.0:subject:role">
<saml2:AttributeValue>
<Role xmlns="urn:hl7-org:v3" code="112247003" codeSystem="2.16.840.1.113883.6.96" codeSystemName="SNOMED CT" displayName="Medical doctor" xsi:type="CE"/>
</saml2:AttributeValue>
</saml2:Attribute>
<saml2:Attribute Name="urn:oasis:names:tc:xspa:1.0:subject:purposeofuse">
<saml2:AttributeValue>
<PurposeOfUse xmlns="urn:hl7-org:v3" code="TREATMENT" codeSystem="2.16.840.1.113883.3.18.7.1" codeSystemName="nhin-purpose" displayName="Treatment" xsi:type="CE"/>
</saml2:AttributeValue>
</saml2:Attribute>
<saml2:Attribute Name="urn:oasis:names:tc:xacml:2.0:resource:resource-id">
<saml2:AttributeValue></saml2:AttributeValue>
</saml2:Attribute>
</saml2:AttributeStatement>
</saml2:Assertion>
<Signature xmlns="http://www.w3.org/2000/09/xmldsig#">
<SignedInfo>
<CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
<SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"/>
<Reference URI="#timestamp_ID">
<Transforms>
<Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"/>
<Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
</Transforms>
<DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>
<DigestValue></DigestValue>
</Reference>
</SignedInfo>
<SignatureValue></SignatureValue>
<KeyInfo>
<wsse:SecurityTokenReference xmlns:wsse11="http://docs.oasis-open.org/wss/oasis-wss-wssecurity-secext-1.1.xsd" wsse11:TokenType="http://docs.oasis-open.org/wss/oasis-wss-saml-token-profile-1.1#SAMLV2.0">
<wsse:KeyIdentifier ValueType="http://docs.oasis-open.org/wss/oasis-wss-saml-token-profile-1.1#SAMLID">assertion_ID</wsse:KeyIdentifier>
</wsse:SecurityTokenReference>
</KeyInfo>
</Signature>
</wsse:Security>
</env:Header>
<env:Body>
<PRPA_IN201305UV02 xmlns="urn:hl7-org:v3" ITSVersion="XML_1.0">
<id extension="126627497759" root="1.3.6.1.4.1.52618.1.3"/>
<creationTime value="20221013181817"/>
<interactionId extension="PRPA_IN201305UV02" root="2.16.840.1.113883.1.6"/>
<processingCode code="P"/>
<processingModeCode code="T"/>
<acceptAckCode code="AL"/>
<receiver typeCode="RCV">
<device classCode="DEV" determinerCode="INSTANCE">
<id root="0.0.0"/>
<telecom value="https://RH-Windows-TMP-b994dba9f85ba908.elb.us-east-1.amazonaws.com:4437/"/>
<asAgent classCode="AGNT">
<representedOrganization classCode="ORG" determinerCode="INSTANCE">
<id root=""/>
</representedOrganization>
</asAgent>
</device>
</receiver>
<sender typeCode="SND">
<device classCode="DEV" determinerCode="INSTANCE">
<id root="1.3.6.1.4.1.52618.1.2"/>
<asAgent classCode="AGNT">
<representedOrganization classCode="ORG" determinerCode="INSTANCE">
<id root="1.3.6.1.4.1.52618.1"/>
</representedOrganization>
</asAgent>
</device>
</sender>
<controlActProcess classCode="CACT" moodCode="EVN">
<code code="PRPA_TE201305UV02" codeSystem="2.16.840.1.113883.1.6"/>
<authorOrPerformer typeCode="AUT">
<assignedDevice classCode="ASSIGNED">
<id root="1.3.6.1.4.1.52618.1.1"/>
</assignedDevice>
</authorOrPerformer>
<queryByParameter>
<queryId extension="126627497760" root="1.3.6.1.4.1.52618.1.3.1"/>
<statusCode code="new"/>
<responseModalityCode code="R"/>
<responsePriorityCode code="I"/>
<parameterList>
<livingSubjectAdministrativeGender>
<value code="M"/>
<semanticsText>LivingSubject.administrativeGender</semanticsText>
</livingSubjectAdministrativeGender>
<livingSubjectBirthTime>
<value value=""/>
<semanticsText>LivingSubject.birthTime</semanticsText>
</livingSubjectBirthTime>
<livingSubjectId>
<value extension="" root="1.3.6.1.4.1.52618.1.1"/>
<semanticsText>LivingSubject.id</semanticsText>
</livingSubjectId>
<livingSubjectName>
<value>
<given></given>
<family>TEST</family>
</value>
<semanticsText>LivingSubject.name</semanticsText>
</livingSubjectName>
<patientAddress>
<value>
<streetAddressLine>Home Dr</streetAddressLine>
<city>Charlotte</city>
<state>NC</state>
<postalCode></postalCode>
<country>US</country>
</value>
<semanticsText>Patient.addr</semanticsText>
</patientAddress>
</parameterList>
</queryByParameter>
</controlActProcess>
</PRPA_IN201305UV02>
</env:Body>
</env:Envelope>
I am using rhino javascript and below is the code
//////////////////////////////////////////////////////////////////////////////////
// Generate our dynamic message values
//
var timestampId = UUIDGenerator.getUUID();
var assertionId = UUIDGenerator.getUUID();
var createdTimestamp = new Date().toISOString();
var expiresTimestamp = new Date((new Date()).getTime() + 10000*10).toISOString();
var samlenvelope="<env:Envelope xmlns:env=\"http://www.w3.org/2003/05/soap-envelope\">"+
"<env:Header xmlns:a=\"http://www.w3.org/2005/08/addressing\">"+
"<a:MessageID>urn:uuid:32886a29-98ad-4284-b00e-3fe4ded10d16</a:MessageID>"+
"<a:To env:mustUnderstand=\"true\"></a:To>"+
"<a:Action env:mustUnderstand=\"true\">urn:hl7-org:v3:PRPA_IN201305UV02:CrossGatewayPatientDiscovery</a:Action>"+
"<wsse:Security xmlns:wsse=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd\" xmlns:wsu=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd\">"+
"<wsu:Timestamp wsu:Id=\"timestamp_ID\">"+
"<wsu:Created>2022-10-13T18:18:17.763Z</wsu:Created>"+
"<wsu:Expires>2023-10-13T18:23:17.763Z</wsu:Expires>"+
"</wsu:Timestamp>"+
"<saml2:Assertion xmlns:saml2=\"urn:oasis:names:tc:SAML:2.0:assertion\" xmlns:ds=\"http://www.w3.org/2000/09/xmldsig#\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" ID=\"assertion_ID\" IssueInstant=\"2022-10-13T18:18:17.763Z\" Version=\"2.0\">"+
"<saml2:Issuer Format=\"urn:oasis:names:tc:SAML:2.0:nameid-format:X509SubjectName\"></saml2:Issuer>"+
"<saml2:Subject>"+
"<saml2:NameID Format=\"urn:oasis:names:tc:SAML:1.1:nameid-format:X509SubjectName\"></saml2:NameID>"+
"<saml2:SubjectConfirmation Method=\"urn:oasis:names:tc:SAML:2.0:cm:holder-of-key\">"+
"<saml2:SubjectConfirmationData>"+
"<KeyInfo xmlns=\"http://www.w3.org/2000/09/xmldsig#\">"+
"<KeyValue>"+
"<RSAKeyValue>"+
"<Modulus></Modulus>"+
"<Exponent>AQAB</Exponent>"+
"</RSAKeyValue>"+
"</KeyValue>"+
"</KeyInfo>"+
"</saml2:SubjectConfirmationData>"+
"</saml2:SubjectConfirmation>"+
"</saml2:Subject>"+
"<saml2:Conditions NotBefore=\"2022-10-13T18:15:17.763Z\" NotOnOrAfter=\"2022-10-13T18:23:17.763Z\">"+
"</saml2:Conditions>"+
"<saml2:AuthnStatement AuthnInstant=\"2022-10-13T17:55:17.743Z\" SessionIndex=\"1234567890\">"+
"<saml2:SubjectLocality Address=\"10.1.1.144\" DNSName=\"localhost\"/>"+
"<saml2:AuthnContext>"+
"<saml2:AuthnContextClassRef>urn:oasis:names:tc:SAML:2.0:ac:classes:PasswordProtectedTransport</saml2:AuthnContextClassRef>"+
"</saml2:AuthnContext>"+
"</saml2:AuthnStatement>"+
"<saml2:AttributeStatement>"+
"<saml2:Attribute Name=\"urn:oasis:names:tc:xspa:1.0:subject:subject-id\">"+
"<saml2:AttributeValue>John Doe</saml2:AttributeValue>"+
"</saml2:Attribute>"+
"<saml2:Attribute Name=\"urn:oasis:names:tc:xspa:1.0:subject:organization\">"+
"<saml2:AttributeValue>Dr. John M Doe, MD Practice</saml2:AttributeValue>"+
"</saml2:Attribute>"+
"<saml2:Attribute Name=\"urn:oasis:names:tc:xspa:1.0:subject:organization-id\">"+
"<saml2:AttributeValue></saml2:AttributeValue>"+
"</saml2:Attribute>"+
"<saml2:Attribute Name=\"urn:nhin:names:saml:homeCommunityId\">"+
"<saml2:AttributeValue></saml2:AttributeValue>"+
"</saml2:Attribute>"+
"<saml2:Attribute Name=\"urn:oasis:names:tc:xacml:2.0:subject:role\">"+
"<saml2:AttributeValue>"+
"<Role xmlns=\"urn:hl7-org:v3\" code=\"112247003\" codeSystem=\"2.16.840.1.113883.6.96\" codeSystemName=\"SNOMED CT\" displayName=\"Medical doctor\" xsi:type=\"CE\"/>"+
"</saml2:AttributeValue>"+
"</saml2:Attribute>"+
"<saml2:Attribute Name=\"urn:oasis:names:tc:xspa:1.0:subject:purposeofuse\">"+
"<saml2:AttributeValue>"+
"<PurposeOfUse xmlns=\"urn:hl7-org:v3\" code=\"TREATMENT\" codeSystem=\"2.16.840.1.113883.3.18.7.1\" codeSystemName=\"nhin-purpose\" displayName=\"Treatment\" xsi:type=\"CE\"/>"+
"</saml2:AttributeValue>"+
"</saml2:Attribute>"+
"<saml2:Attribute Name=\"urn:oasis:names:tc:xacml:2.0:resource:resource-id\">"+
"<saml2:AttributeValue></saml2:AttributeValue>"+
"</saml2:Attribute>"+
"</saml2:AttributeStatement>"+
"</saml2:Assertion>"+
"</wsse:Security>"+
"</env:Header>"+
"<env:Body>"+
"<PRPA_IN201305UV02 xmlns=\"urn:hl7-org:v3\" ITSVersion=\"XML_1.0\">"+
"<id extension=\"126627497759\" root=\"1.3.6.1.4.1.52618.1.3\"/>"+
"<creationTime value=\"20221013181817\"/>"+
"<interactionId extension=\"PRPA_IN201305UV02\" root=\"2.16.840.1.113883.1.6\"/>"+
"<processingCode code=\"P\"/>"+
"<processingModeCode code=\"T\"/>"+
"<acceptAckCode code=\"AL\"/>"+
"<receiver typeCode=\"RCV\">"+
"<device classCode=\"DEV\" determinerCode=\"INSTANCE\">"+
"<id root=\"0.0.0\"/>"+
"<telecom value=\"https://RH-Windows-TMP-b994dba9f85ba908.elb.us-east-1.amazonaws.com:4437/\"/>"+
"<asAgent classCode=\"AGNT\">"+
"<representedOrganization classCode=\"ORG\" determinerCode=\"INSTANCE\">"+
"<id root=\"\"/>"+
"</representedOrganization>"+
"</asAgent>"+
"</device>"+
"</receiver>"+
"<sender typeCode=\"SND\">"+
"<device classCode=\"DEV\" determinerCode=\"INSTANCE\">"+
"<id root=\"1.3.6.1.4.1.52618.1.2\"/>"+
"<asAgent classCode=\"AGNT\">"+
"<representedOrganization classCode=\"ORG\" determinerCode=\"INSTANCE\">"+
"<id root=\"1.3.6.1.4.1.52618.1\"/>"+
"</representedOrganization>"+
"</asAgent>"+
"</device>"+
"</sender>"+
"<controlActProcess classCode=\"CACT\" moodCode=\"EVN\">"+
"<code code=\"PRPA_TE201305UV02\" codeSystem=\"2.16.840.1.113883.1.6\"/>"+
"<authorOrPerformer typeCode=\"AUT\">"+
"<assignedDevice classCode=\"ASSIGNED\">"+
"<id root=\"1.3.6.1.4.1.52618.1.1\"/>"+
"</assignedDevice>"+
"</authorOrPerformer>"+
"<queryByParameter>"+
"<queryId extension=\"\" root=\"1.3.6.1.4.1.52618.1.3.1\"/>"+
"<statusCode code=\"new\"/>"+
"<responseModalityCode code=\"R\"/>"+
"<responsePriorityCode code=\"I\"/>"+
"<parameterList>"+
"<livingSubjectAdministrativeGender>"+
"<value code=\"M\"/>"+
"<semanticsText>LivingSubject.administrativeGender</semanticsText>"+
"</livingSubjectAdministrativeGender>"+
"<livingSubjectBirthTime>"+
"<value value=\"\"/>"+
"<semanticsText>LivingSubject.birthTime</semanticsText>"+
"</livingSubjectBirthTime>"+
"<livingSubjectId>"+
"<value extension=\"\" root=\"1.3.6.1.4.1.52618.1.1\"/>"+
"<semanticsText>LivingSubject.id</semanticsText>"+
"</livingSubjectId>"+
"<livingSubjectName>"+
"<value>"+
"<given></given>"+
"<family>TEST</family>"+
"</value>"+
"<semanticsText>LivingSubject.name</semanticsText>"+
"</livingSubjectName>"+
"<patientAddress>"+
"<value>"+
"<streetAddressLine>Home Dr</streetAddressLine>"+
"<city>Charlotte</city>"+
"<state>NC</state>"+
"<postalCode></postalCode>"+
"<country>US</country>"+
"</value>"+
"<semanticsText>Patient.addr</semanticsText>"+
"</patientAddress>"+
"</parameterList>"+
"</queryByParameter>"+
"</controlActProcess>"+
"</PRPA_IN201305UV02>"+
"</env:Body>"+
"</env:Envelope>"+;
var samlString = new java.lang.String(samlenvelope);
////////////////////////////////////////////////////////////////////////////////////
// Build our XML DOM for signature
//
var documentBuilderFactory = javax.xml.parsers.DocumentBuilderFactory.newInstance();
documentBuilderFactory.setNamespaceAware(true);
var document = documentBuilderFactory.newDocumentBuilder().parse(new java.io.ByteArrayInputStream(samlString.getBytes("utf-8")));
////////////////////////////////////////////////////////////////////////////////////
// Configure Digital Signature utilities for required crypto operations
//
var xmlDsigFactory = javax.xml.crypto.dsig.XMLSignatureFactory.getInstance("DOM");
var parameterSpec = new javax.xml.crypto.dsig.spec.ExcC14NParameterSpec();
var reference = xmlDsigFactory.newReference
(
"#assertion_ID",
xmlDsigFactory.newDigestMethod(javax.xml.crypto.dsig.DigestMethod.SHA1, null),
java.util.Collections.singletonList(xmlDsigFactory.newTransform("http://www.w3.org/2001/10/xml-exc-c14n#", parameterSpec)),
null, //type
null //id
)
var signedInfo = xmlDsigFactory.newSignedInfo
(
xmlDsigFactory.newCanonicalizationMethod
(
javax.xml.crypto.dsig.CanonicalizationMethod.EXCLUSIVE,
parameterSpec
),
xmlDsigFactory.newSignatureMethod(javax.xml.crypto.dsig.SignatureMethod.RSA_SHA1, null),
java.util.Collections.singletonList(reference)
)
var reference1 = xmlDsigFactory.newReference
(
"#timestamp_ID",
xmlDsigFactory.newDigestMethod(javax.xml.crypto.dsig.DigestMethod.SHA1, null),
java.util.Collections.singletonList(xmlDsigFactory.newTransform("http://www.w3.org/2001/10/xml-exc-c14n#", parameterSpec)),
null, //type
null //id
)
var signedInfo1 = xmlDsigFactory.newSignedInfo
(
xmlDsigFactory.newCanonicalizationMethod
(
javax.xml.crypto.dsig.CanonicalizationMethod.EXCLUSIVE,
parameterSpec
),
xmlDsigFactory.newSignatureMethod(javax.xml.crypto.dsig.SignatureMethod.RSA_SHA1, null),
java.util.Collections.singletonList(reference1)
)
//////////////////////////////////////////////////////
// Fetch our certificate and key
//
var certificate;
try
{
var inputStream = new java.io.FileInputStream("test.crt");
var certificateFactory = java.security.cert.CertificateFactory.getInstance("X.509");
certificate = certificateFactory.generateCertificate(inputStream);
}
finally
{
if (inputStream != null)
inputStream.close();
}
var privateKey;
var keyFactory = java.security.KeyFactory.getInstance("RSA");
var keySpec = new java.security.spec.PKCS8EncodedKeySpec(java.nio.file.Files.readAllBytes(new java.io.File("private_key.der").toPath()));
privateKey = keyFactory.generatePrivate(keySpec);
////////////////////////////////////////////////////////
// Generate the KeyInfo for our signature
//
var keyInfoFactory = xmlDsigFactory.getKeyInfoFactory();
var x509Content = new java.util.ArrayList();
x509Content.add(certificate);
var x509Data = keyInfoFactory.newX509Data(x509Content);
var keyInfo = keyInfoFactory.newKeyInfo(java.util.Collections.singletonList(x509Data));
var signature = xmlDsigFactory.newXMLSignature(signedInfo, keyInfo);
var dsc = new javax.xml.crypto.dsig.dom.DOMSignContext(privateKey, document.getDocumentElement());
var rootEl = document.getDocumentElement();
rootEl.setIdAttribute("ID",true);
signature.sign(dsc);
var signature1 = xmlDsigFactory.newXMLSignature(signedInfo1, keyInfo1);
var dsc = new javax.xml.crypto.dsig.dom.DOMSignContext(privateKey, document.getDocumentElement());
signature1.sign(dsc);
/*
var newEle=document.createElement("Transform");
newEle.setAttribute('Algorithm', 'http://www.w3.org/2000/09/xmldsig#enveloped-signature');
document.getElementsByTagName("Transforms").item(0).appendChild(newEle);*/
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Define any formatting preferences get the signed document as a string
//
var transformerFactory = javax.xml.transform.TransformerFactory.newInstance();
var transformer = transformerFactory.newTransformer();
transformer.setOutputProperty(javax.xml.transform.OutputKeys.OMIT_XML_DECLARATION, "yes");
var stringWriter = new java.io.StringWriter();
transformer.transform(new javax.xml.transform.dom.DOMSource(document), new javax.xml.transform.stream.StreamResult(stringWriter));
channelMap.put("soapMessage", stringWriter.toString());
when I run the code I get this error
Wrapped org.w3c.dom.DOMException: NOT_FOUND_ERR: An attempt is made to
reference a node in a context where it does not exist.
Will appreciate your help

How do I reformat an existing XML document with PowerShell

I'm trying to update an XML document from this:
<Enclave id="OLD">
<device>
<name>MGMT</name>
<type>VoIP</type>
<vlan>Voice2Network</vlan>
<inform>PEM</inform>
<outform>PEM</outform>
<RequireCert>0</RequireCert>
</device>
</Enclave>
<Enclave id="NEW">
<device>
<name>G-VDS-GooD</name>
<type>VoIP</type>
<vlan>Voice2Network</vlan>
<inform>PEM</inform>
<outform>PEM</outform>
<RequireCert>0</RequireCert>
</device>
<device>
<name>G-VDS-ENC001</name>
<type>VoIP</type>
<vlan>Voice2Network</vlan>
<inform>PEM</inform>
<outform>PEM</outform>
<RequireCert>0</RequireCert>
</device>
<device>
<name>G-VDS-ENC002</name>
<type>VoIP</type>
<vlan>Voice2Network</vlan>
<inform>PEM</inform>
<outform>PEM</outform>
<RequireCert>0</RequireCert>
</device>
</Enclave>
To this:
<Enclave id="OLD">
<device>
<name>MGMT</name>
<type>VoIP</type>
<vlan>Voice2Network</vlan>
<inform>PEM</inform>
<outform>PEM</outform>
<RequireCert>0</RequireCert>
</device>
</Enclave>
<Enclave id="NEW">
<device>
<name>G-VDS-GooD</name>
<type>VoIP</type>
<vlan>Voice2Network</vlan>
<inform>PEM</inform>
<outform>PEM</outform>
<RequireCert>0</RequireCert>
</device>
<device>
<name>G-VDS-ENC001</name>
<type>VoIP</type>
<vlan>Voice2Network</vlan>
<cert>
<inform>PEM</inform>
<outform>PEM</outform>
<name>G-VDS-ENC001</name>
<type>WEBServer</type>
<pwd>Password</pwd>
<altSubject />
</cert>
<RequireCert>1</RequireCert>
</device>
<device>
<name>G-VDS-ENC002</name>
<type>VoIP</type>
<vlan>Voice2Network</vlan>
<cert>
<inform>PEM</inform>
<outform>PEM</outform>
<name>G-VDS-ENC002</name>
<type>WEBServer</type>
<pwd>Password</pwd>
<altSubject />
</cert>
<RequireCert>1</RequireCert>
</device>
</Enclave>
I've written some PowerShell commands (see below) but only have been able to get this far:
<Enclave id="OLD">
<device>
<name>MGMT</name>
<type>VoIP</type>
<vlan>Voice2Network</vlan>
<inform>PEM</inform>
<outform>PEM</outform>
<RequireCert>0</RequireCert>
</device>
</Enclave>
<Enclave id="NEW">
<device>
<name>G-VDS-GooD</name>
<type>VoIP</type>
<vlan>Voice2Network</vlan>
<inform>PEM</inform>
<outform>PEM</outform>
<RequireCert>0</RequireCert>
</device>
<device>
<name>G-VDS-ENC001</name>
<type>VoIP</type>
<vlan>Voice2Network</vlan>
<cert>
<inform>PEM</inform>
<outform>PEM</outform>
<type>WEBServer</type>
<pwd>Password</pwd>
<altSubject />
</cert>
<RequireCert>0</RequireCert>
</device>
<device>
<name>G-VDS-ENC002</name>
<type>VoIP</type>
<vlan>Voice2Network</vlan>
<cert>
<inform>PEM</inform>
<outform>PEM</outform>
<type>WEBServer</type>
<pwd>Password</pwd>
<altSubject />
</cert>
<RequireCert>1</RequireCert>
<RequireCert>0</RequireCert>
</device>
</Enclave>
Here is my PowerShell code:
$LoadType = "NEW"
$FileName = "C:\Voip.xml"
[xml]$FileOriginal = Get-Content $FileName
$Pattern = $FileOriginal.SelectNodes("/Configuration/Enclave[#id = `"$LoadType`"]/device[name[contains(text(), 'G-VDS-ENC')]]")
foreach($Pat in $Pattern) {
$inform = $FileOriginal.SelectSingleNode("/Configuration/Enclave[#id = `"$LoadType`"]/device[name[contains(text(), 'G-VDS-ENC')]]/inform")
$inform.ParentNode.RemoveChild($inform) | Out-Null
$outform = $FileOriginal.SelectSingleNode("/Configuration/Enclave[#id = `"$LoadType`"]/device[name[contains(text(), 'G-VDS-ENC')]]/outform")
$outform.ParentNode.RemoveChild($outform) | Out-Null
$RequireCert = $FileOriginal.SelectSingleNode("/Configuration/Enclave[#id = `"$LoadType`"]/device[name[contains(text(), 'G-VDS-ENC')]]/RequireCert")
$RequireCert.ParentNode.RemoveChild($RequireCert) | Out-Null
# Create cert element
$cert = $FileOriginal.CreateElement('cert')
$newinform = $FileOriginal.CreateElement('inform')
$newinform.InnerText = 'PEM'
$newoutform = $FileOriginal.CreateElement('outform')
$newoutform.InnerText = 'PEM'
$type = $FileOriginal.CreateElement('type')
$type.InnerText = 'WebServer'
$pwd = $FileOriginal.CreateElement('pwd')
$pwd.InnerText = 'password'
$altSubject = $FileOriginal.CreateElement('altSubject')
$cert.AppendChild($newinform)
$cert.AppendChild($newoutform)
#$cert.AppendChild($name)
$cert.AppendChild($type)
$cert.AppendChild($pwd)
$cert.AppendChild($altSubject)
# Insert cert element after 'vlan' element
$Pat.InsertAfter( $cert, $Pat.SelectSingleNode('vlan') )
$newRequireCert = $FileOriginal.CreateElement('RequireCert')
$newRequireCert.InnerText = "1"
$Pat.InsertAfter( $newRequireCert, $Pat.SelectSingleNode('cert') )
}
$FileOriginal.Save($FileName)
I couldn't get the "RequireCert" node to appear correctly with a 1 attribute in both the G-VDS-ENC001 & G-VDS-ENC002 nodes. Also, I couldn't come up with any syntax on how to clone or copy both the G-VDS-ENC001 & G-VDS-ENC002 Node elements into the newly created Cert node. Can anyone help me figure out what else is needed or go over my poor PowerShell code.
You can update the existing RequireCert node instead of removing+recreating it:
# Select the node
$RequireCert = $FileOriginal.SelectSingleNode("/Configuration/Enclave[#id = `"$LoadType`"]/device[name[contains(text(), 'G-VDS-ENC')]]/RequireCert")
# Set the node's text value
$RequireCert.'#Text' = 1
Then you can remove the $newRequireCert section in your current code.
I agree with Cpt.Whale you need not remove and recreate the RequireCert node.
Using dot notation you can update these nodes like this:
(($FileOriginal.Configuration.Enclave | Where-Object { $_.id -eq $LoadType }).device |
Where-Object { $_.name -like 'G-VDS-ENC*' }) | ForEach-Object { $_.RequireCert = '1' }

Correct PowerShell syntax for XML Node Loop value change

I have another question. I have an XML document that I would like to update a couple of nodes. I'm looking to copy/clone the device name node to a new node. For a more of an understanding here is the sample XML document:
<Configuration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<Enclave id="OLD">
<device>
<name>G-VDS-GooD</name>
<type>VoIP</type>
<vlan>Voice2Network</vlan>
<inform>PEM</inform>
<outform>PEM</outform>
<RequireCert>0</RequireCert>
</device>
<device>
<name>G-VDS-ENC001</name>
<type>VoIP</type>
<vlan>Voice2Network</vlan>
<inform>PEM</inform>
<outform>PEM</outform>
<RequireCert>0</RequireCert>
</device>
<device>
<name>G-VDS-ENC002</name>
<type>VoIP</type>
<vlan>Voice2Network</vlan>
<inform>PEM</inform>
<outform>PEM</outform>
<RequireCert>0</RequireCert>
</device>
</Enclave>
</Configuration>
Here is what I'm trying to get to:
<Configuration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<Enclave id="OLD">
<device>
<name>G-VDS-GooD</name>
<type>VoIP</type>
<vlan>Voice2Network</vlan>
<inform>PEM</inform>
<outform>PEM</outform>
<RequireCert>0</RequireCert>
</device>
<device>
<name>G-VDS-ENC001</name>
<type>VoIP</type>
<vlan>Voice2Network</vlan>
<cert>
<name>G-VDS-ENC001</name>
</cert>
<inform>PEM</inform>
<outform>PEM</outform>
<RequireCert>0</RequireCert>
</device>
<device>
<name>G-VDS-ENC002</name>
<type>VoIP</type>
<vlan>Voice2Network</vlan>
<cert>
<name>G-VDS-ENC002</name>
</cert>
<inform>PEM</inform>
<outform>PEM</outform>
<RequireCert>0</RequireCert>
</device>
</Enclave>
</Configuration>
Here is my code:
$LoadType = "OLD"
$FileName = "C:\name.xml"
[xml]$FileOriginal = Get-Content $FileName
$Pattern = $FileOriginal.SelectNodes("/Configuration/Enclave[#id = `"$LoadType`"]/device[name[contains(text(), 'G-VDS-ENC')]]")
foreach($Pat in $Pattern) {
$device = $FileOriginal.SelectSingleNode("//Configuration/Enclave[#id = `"$LoadType`"]/device[name[contains(text(), 'G-VDS-ENC')]]")
$devicename = $device.name;
$name = $FileOriginal.CreateElement('name')
foreach($name in $device) {
$devicename = $device.name;
$name = $FileOriginal.CreateElement('name')
$name.InnerText = "$devicename"
}
$cert = $FileOriginal.CreateElement('cert')
$cert.AppendChild($name)
$Pat.InsertAfter( $cert, $Pat.SelectSingleNode('vlan') )
}
$FileOriginal.Save($FileName)
Here was the result:
<Configuration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<Enclave id="OLD">
<device>
<name>G-VDS-GooD</name>
<type>VoIP</type>
<vlan>Voice2Network</vlan>
<inform>PEM</inform>
<outform>PEM</outform>
<RequireCert>0</RequireCert>
</device>
<device>
<name>G-VDS-ENC001</name>
<type>VoIP</type>
<vlan>Voice2Network</vlan>
<cert>
<name>G-VDS-ENC001</name>
</cert>
<inform>PEM</inform>
<outform>PEM</outform>
<RequireCert>0</RequireCert>
</device>
<device>
<name>G-VDS-ENC002</name>
<type>VoIP</type>
<vlan>Voice2Network</vlan>
<cert>
<name>G-VDS-ENC001</name>
</cert>
<inform>PEM</inform>
<outform>PEM</outform>
<RequireCert>0</RequireCert>
</device>
</Enclave>
</Configuration>
I tried to accomplish this through a foreach syntax but I don't know or think thats the correct approach. I also tried a different approach in using the CloneNode cmdlet but I couldn't get that to work either. Anyone have an idea on how to make this work?
I think the code is trying to do too much. Some minor simplification should make it work as desired:
$LoadType = "OLD"
$FileName = "c:\name.xml"
[xml]$FileOriginal = Get-Content $FileName
$Pattern = $FileOriginal.SelectNodes("/Configuration/Enclave[#id = `"$LoadType`"]/device[name[contains(text(), 'G-VDS-ENC')]]")
foreach($Pat in $Pattern) {
# new name node
$name = $FileOriginal.CreateElement('name')
# set node text to the current device name
$name.InnerText = $Pat.name
# new cert node
$cert = $FileOriginal.CreateElement('cert')
# add name node as child of cert node
$cert.AppendChild($name)
# insert new cert node after current device's vlan node
$Pat.InsertAfter( $cert, $Pat.SelectSingleNode('vlan') )
}
$FileOriginal.Save($FileName)

Wildfly14 + Unable to lookup invm queue

Unable to lookup invm queue thru ConnectionFactory
Hashtable<String, Object> properties = new Hashtable<>();
properties.put("connectionFactory.ConnectionFactory", "(tcp://localhost:8080)?httpUpgradeEnabled=true&retryInterval=3000&reconnectAttempts=-1&initialConnectAttempts=10&maxRetryInterval=3000&clientFailureCheckPeriod=1000");
properties.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory");
InitialContext jndiContext = new InitialContext(properties);
ConnectoryFactory connFactory = (ConnectionFactory) jndiContext.lookup(connectionFactory);
Connection connection = connFactory.createConnection(userName, password);
session = connection.createSession(true, javax.jms.Session.AUTO_ACKNOWLEDGE);
Hashtable<String, Object> properties = new Hashtable<>();
properties.put(Context.INITIAL_CONTEXT_FACTORY, factoryInitial);
InitialContext ctx = new InitialContext(properties);
destination = (Destination) ctx.lookup("dynamicQueues/TestQueue"); //I can't put queue name in jndi.properties
MessageProducer producer = session.createProducer(destination);
producer.send(message, Message.DEFAULT_DELIVERY_MODE, Message.DEFAULT_PRIORITY, msgTTL);
if (session.getTransacted() && session.getAcknowledgeMode() == Session.SESSION_TRANSACTED) {
session.commit();
}
When I execute the above code then it throws error saying that Queue "TestQueue" does not exists. I have tried with lookup queue with dynamicQueues/TestQueue and jms/TestQueue but in both cases I got same error
Can you please let me know what is wrong with this code.
Please find below Wildfly ActiveMQ Artemis configuration
<server name="default" persistence-enabled="true">
<cluster password="${jboss.messaging.cluster.password:CHANGE ME!!}"/>
<bindings-directory path="/opt/shared/messaging/live/bindings"/>
<journal-directory path="/opt/shared/messaging/live/journal"/>
<large-messages-directory path="/opt/shared/messaging/live/largemessages"/>
<paging-directory path="/opt/shared/messaging/live/paging"/>
<security-setting name="#">
<role name="guest" send="true" consume="true" create-durable-queue="true" delete-durable-queue="true" create-non-durable-queue="true" delete-non-durable-queue="true"/>
</security-setting>
<address-setting name="#" dead-letter-address="jms.queue.DLQ" expiry-address="jms.queue.ExpiryQueue" redelivery-delay="60000" max-delivery-attempts="5" max-size-bytes="50485760" page-size-bytes="10485760" address-full-policy="PAGE" redistribution-delay="1000"/>
<http-connector name="http-connector" socket-binding="http" endpoint="http-acceptor"/>
<http-connector name="http-connector-throughput" socket-binding="http" endpoint="http-acceptor-throughput">
<param name="batch-delay" value="50"/>
</http-connector>
<in-vm-connector name="in-vm" server-id="0">
<param name="buffer-pooling" value="false"/>
</in-vm-connector>
<http-acceptor name="http-acceptor" http-listener="default"/>
<http-acceptor name="http-acceptor-throughput" http-listener="default">
<param name="batch-delay" value="50"/>
<param name="direct-deliver" value="false"/>
</http-acceptor>
<in-vm-acceptor name="in-vm" server-id="0">
<param name="buffer-pooling" value="false"/>
</in-vm-acceptor>
<broadcast-group name="bg-group1" jgroups-cluster="activemq-cluster" connectors="http-connector"/>
<discovery-group name="dg-group1" jgroups-cluster="activemq-cluster"/>
<cluster-connection name="my-cluster" address="jms" connector-name="http-connector" discovery-group="dg-group1"/>
<jms-queue name="ExpiryQueue" entries="java:/jms/queue/ExpiryQueue"/>
<jms-queue name="DLQ" entries="java:/jms/queue/DLQ"/>
<jms-queue name="TestQueue" entries="java:/jms/TestQueue java:jboss/exported/jms/TestQueue"/>
<connection-factory name="InVmConnectionFactory" entries="java:/ConnectionFactory" connectors="in-vm"/>
<connection-factory name="RemoteConnectionFactory" entries="java:jboss/exported/jms/RemoteConnectionFactory" connectors="http-connector" ha="true" block-on-acknowledge="true" reconnect-attempts="-1"/>
<pooled-connection-factory name="activemq-ra" entries="java:/JmsXA java:jboss/DefaultJMSConnectionFactory" connectors="in-vm" transaction="xa"/>
</server>
I just want to share some links with you, for further reading.
The quickstarts are a good entry point if you start developing with wildfly.
Here you have an external client example:
https://github.com/wildfly/quickstart/tree/14.x/helloworld-jms
Here one where it everything runs inside the wildfly container:
https://github.com/wildfly/quickstart/tree/14.x/helloworld-mdb
Here you have general documentation about messaging in wildfly 14:
https://docs.wildfly.org/14/Admin_Guide.html#Messaging
The initial context factory you're using (i.e. org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory) is a client-side only JNDI implementation for use with standalone ActiveMQ Artemis. Since you are using Wildfly you should be using their JNDI implementation (i.e. org.wildfly.naming.client.WildFlyInitialContextFactory). Then you can lookup both the connection factory and the destination from the Wildfly server and you won't need to specify the connection factory URL in your code.
Also, there is no such thing as an "invm queue".

iPhone weather forecast application

I am working with an iphone application in xcode that uses the google weather api. But when i connects to the api then its giving me the following output
2010-04-28 12:19:56.903 weather[176:20b] urlstring: http://www.google.com/ig/api?weather=Kolkata
2010-04-28 12:19:57.214 weather[176:20b] Receiving data... 2010-04-28 12:19:57.215 weather[176:20b] responsedata: <3c3f786d 6c207665 7273696f 6e3d2231 2e30223f 3e3c786d 6c5f6170 695f7265 706c7920 76657273 696f6e3d 2231223e 3c776561 74686572 206d6f64 756c655f 69643d22 30222074 61625f69 643d2230 22206d6f 62696c65 5f726f77 3d223022 206d6f62 696c655f 7a697070 65643d22 31222072 6f773d22 30222073 65637469 6f6e3d22 3022203e 3c666f72 65636173 745f696e 666f726d 6174696f 6e3e3c63 69747920 64617461 3d224b6f 6c6b6174 612c2057 65737420 42656e67 616c222f 3e3c706f 7374616c 5f636f64 65206461 74613d22 4b6f6c6b 61746122 2f3e3c6c 61746974 7564655f 65362064 6174613d 22222f3e 3c6c6f6e 67697475 64655f65 36206461 74613d22 222f3e3c 666f7265 63617374 5f646174 65206461 74613d22 32303130 2d30342d 3238222f 3e3c6375 7272656e 745f6461 74655f74 696d6520 64617461 3d223230 31302d30 342d3238 2030363a 32303a30 30202b30 30303022 2f3e3c75 6e69745f 73797374 656d2064 6174613d 22555322 2f3e3c2f 666f7265 63617374 5f696e66 6f726d61 74696f6e 3e3c6375 7272656e 745f636f 6e646974 696f6e73 3e3c636f 6e646974 696f6e20 64617461 3d224861 7a65222f 3e3c7465 6d705f66 20646174 613d2239 37222f3e 3c74656d 705f6320 64617461 3d223336 222f3e3c 68756d69 64697479 20646174 613d2248 756d6964 6974793a 20363025 222f3e3c 69636f6e 20646174 613d222f 69672f69 6d616765 732f7765 61746865 722f6861 7a652e67 6966222f 3e3c7769 6e645f63 6f6e6469 74696f6e 20646174 613d2257 696e643a 20532061 74203133 206d7068 222f3e3c 2f637572 72656e74 5f636f6e 64697469 6f6e733e 3c666f72 65636173 745f636f 6e646974 696f6e73 3e3c6461 795f6f66 5f776565 6b206461 74613d22 57656422 2f3e3c6c 6f772064 6174613d 22383222 2f3e3c68 69676820 64617461 3d223931 222f3e3c 69636f6e 20646174 613d222f 69672f69 6d616765 732f7765 61746865 722f6368 616e6365 5f6f665f 7261696e 2e676966 222f3e3c 636f6e64 6974696f 6e206461 74613d22 4368616e 6365206f 66205261 696e222f 3e3c2f66 6f726563 6173745f 636f6e64 6974696f 6e733e3c 666f7265 63617374 5f636f6e 64697469 6f6e733e 3c646179 5f6f665f 7765656b 20646174 613d2254 6875222f 3e3c6c6f 77206461 74613d22 3832222f 3e3c6869 67682064 6174613d 22393622 2f3e3c69 636f6e20 64617461 3d222f69 672f696d 61676573 2f776561 74686572 2f726169 6e2e6769 66222f3e 3c636f6e 64697469 6f6e2064 6174613d 22526169 6e222f3e 3c2f666f 72656361 73745f63 6f6e6469 74696f6e 733e3c66 6f726563 6173745f 636f6e64 6974696f 6e733e3c 6461795f 6f665f77 65656b20 64617461 3d224672 69222f3e 3c6c6f77 20646174 613d2238 32222f3e 3c686967 68206461 74613d22 3936222f 3e3c6963 6f6e2064 6174613d 222f6967 2f696d61 6765732f 77656174 6865722f 73756e6e 792e6769 66222f3e 3c636f6e 64697469 6f6e2064 6174613d 22436c65 6172222f 3e3c2f66 6f726563> 2010-04-28 12:19:57.217 weather[176:20b] Receiving data... 2010-04-28 12:19:57.217 weather[176:20b] responsedata: <3c3f786d 6c207665 7273696f 6e3d2231 2e30223f 3e3c786d 6c5f6170 695f7265 706c7920 76657273 696f6e3d 2231223e 3c776561 74686572 206d6f64 756c655f 69643d22 30222074 61625f69 643d2230 22206d6f 62696c65 5f726f77 3d223022 206d6f62 696c655f 7a697070 65643d22 31222072 6f773d22 30222073 65637469 6f6e3d22 3022203e 3c666f72 65636173 745f696e 666f726d 6174696f 6e3e3c63 69747920 64617461 3d224b6f 6c6b6174 612c2057 65737420 42656e67 616c222f 3e3c706f 7374616c 5f636f64 65206461 74613d22 4b6f6c6b 61746122 2f3e3c6c 61746974 7564655f 65362064 6174613d 22222f3e 3c6c6f6e 67697475 64655f65 36206461 74613d22 222f3e3c 666f7265 63617374 5f646174 65206461 74613d22 32303130 2d30342d 3238222f 3e3c6375 7272656e 745f6461 74655f74 696d6520 64617461 3d223230 31302d30 342d3238 2030363a 32303a30 30202b30 30303022 2f3e3c75 6e69745f 73797374 656d2064 6174613d 22555322 2f3e3c2f 666f7265 63617374 5f696e66 6f726d61 74696f6e 3e3c6375 7272656e 745f636f 6e646974 696f6e73 3e3c636f 6e646974 696f6e20 64617461 3d224861 7a65222f 3e3c7465 6d705f66 20646174 613d2239 37222f3e 3c74656d 705f6320 64617461 3d223336 222f3e3c 68756d69 64697479 20646174 613d2248 756d6964 6974793a 20363025 222f3e3c 69636f6e 20646174 613d222f 69672f69 6d616765 732f7765 61746865 722f6861 7a652e67 6966222f 3e3c7769 6e645f63 6f6e6469 74696f6e 20646174 613d2257 696e643a 20532061 74203133 206d7068 222f3e3c 2f637572 72656e74 5f636f6e 64697469 6f6e733e 3c666f72 65636173 745f636f 6e646974 696f6e73 3e3c6461 795f6f66 5f776565 6b206461 74613d22 57656422 2f3e3c6c 6f772064 6174613d 22383222 2f3e3c68 69676820 64617461 3d223931 222f3e3c 69636f6e 20646174 613d222f 69672f69 6d616765 732f7765 61746865 722f6368 616e6365 5f6f665f 7261696e 2e676966 222f3e3c 636f6e64 6974696f 6e206461 74613d22 4368616e 6365206f 66205261 696e222f 3e3c2f66 6f726563 6173745f 636f6e64 6974696f 6e733e3c 666f7265 63617374 5f636f6e 64697469 6f6e733e 3c646179 5f6f665f 7765656b 20646174 613d2254 6875222f 3e3c6c6f 77206461 74613d22 3832222f 3e3c6869 67682064 6174613d 22393622 2f3e3c69 636f6e20 64617461 3d222f69 672f696d 61676573 2f776561 74686572 2f726169 6e2e6769 66222f3e 3c636f6e 64697469 6f6e2064 6174613d 22526169 6e222f3e 3c2f666f 72656361 73745f63 6f6e6469 74696f6e 733e3c66 6f726563 6173745f 636f6e64 6974696f 6e733e3c 6461795f 6f665f77 65656b20 64617461 3d224672 69222f3e 3c6c6f77 20646174 613d2238 32222f3e 3c686967 68206461 74613d22 3936222f 3e3c6963 6f6e2064 6174613d 222f6967 2f696d61 6765732f 77656174 6865722f 73756e6e 792e6769 66222f3e 3c636f6e 64697469 6f6e2064 6174613d 22436c65 6172222f 3e3c2f66 6f726563 6173745f 636f6e64 6974696f 6e733e3c 666f7265 63617374 5f636f6e 64697469 6f6e733e 3c646179 5f6f665f 7765656b 20646174 613d2253 6174222f 3e3c6c6f 77206461 74613d22 3738222f 3e3c6869 67682064 6174613d 22393822 2f3e3c69 636f6e20 64617461 3d222f69 672f696d 61676573 2f776561 74686572 2f6d6f73 746c795f 73756e6e 792e6769 66222f3e 3c636f6e 64697469 6f6e2064 6174613d 224d6f73 746c7920 53756e6e 79222f3e 3c2f666f 72656361 73745f63 6f6e6469 74696f6e 733e3c2f 77656174 6865723e 3c2f786d 6c5f6170 695f7265 706c793e> 2010-04-28 12:19:57.219 weather[176:20b] Finished loading...
My Code looks like this
- (void)viewDidLoad
{
NSString *currentLocation=#"Kolkata";
NSString *URLString = [NSString stringWithFormat:#"http://www.google.com/ig/api?weather=%#", currentLocation];
NSLog(#"urlstring: %#", URLString);
NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:URLString] cachePolicy:NSURLRequestUseProtocolCachePolicy timeoutInterval:60.0];
NSURLConnection *theConnection = [[NSURLConnection alloc] initWithRequest:request delegate:self];
if (theConnection)
{
responseData = [[NSMutableData alloc] retain];
}
[super viewDidLoad];
}
- (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response
{
[responseData setLength:0];
}
- (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data
{
NSLog(#"Receiving data...");
[responseData appendData:data];
NSLog(#"responsedata: %#",responseData);
}
- (void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error
{
NSLog(#"Reverse Geocode request to Google failed!");
}
- (void)connectionDidFinishLoading:(NSURLConnection *)connection
{
NSLog(#"Finished loading...");
[connection release];
}
I can't figure it out how to read this data.
Looking for your's valuable suggetion. I am using this url(http://www.google.com/ig/api?weather=kolkata)
Thanks in advance
I suspect that this is because you are using NSData. Try converting that to NSString or just use an NSString returning method like stringWithContentsOfURL:encoding:error: