├── .gitignore ├── CHANGES.md ├── LICENSE ├── README.md ├── TODO.md ├── doc └── api │ ├── allclasses-frame.html │ ├── allclasses-noframe.html │ ├── constant-values.html │ ├── deprecated-list.html │ ├── help-doc.html │ ├── index-files │ ├── index-1.html │ ├── index-2.html │ ├── index-3.html │ └── index-4.html │ ├── index.html │ ├── org │ └── me │ │ └── javawsdiscovery │ │ ├── DeviceDiscovery.html │ │ ├── class-use │ │ └── DeviceDiscovery.html │ │ ├── package-frame.html │ │ ├── package-summary.html │ │ ├── package-tree.html │ │ └── package-use.html │ ├── overview-tree.html │ ├── package-list │ ├── resources │ ├── background.gif │ ├── tab.gif │ ├── titlebar.gif │ └── titlebar_end.gif │ └── stylesheet.css ├── javaWsDiscovery-0.2.jar ├── javaWsDiscovery.iml └── src ├── META-INF └── MANIFEST.MF └── org └── me └── javawsdiscovery ├── DeviceDiscovery.java ├── sampleProbe.xml ├── sampleResponseOnvif.xml └── sampleResponsePrinter.xml /.gitignore: -------------------------------------------------------------------------------- 1 | out/* 2 | test/* 3 | javaWsDiscovery.jar -------------------------------------------------------------------------------- /CHANGES.md: -------------------------------------------------------------------------------- 1 | --- 2015-06-24 --- 2 | 3 | o query all interfaces, IPv6 support 4 | 5 | --- 2015-06-19 --- 6 | 7 | o initial release 8 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "{}" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright {yyyy} {name of copyright owner} 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | 203 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # JavaWsDiscovery 2 | This is an extreme simple WS-Discovery hack for Java without any dependencies to discover Onvif device addresses and 3 | others on local networks. 4 | Looking around for WS-Discovery implementations I found java-ws-discovery and apache-cxf, please look there if you need 5 | fully equipped SOAP implementations. 6 | Please feel free to add notes, suggestions and whishes or devices not responding or small success notes: Yeah, device xy 7 | is responding. 8 | If your device is not detected, please send a network recording of your UDP traffic. 9 | 10 | Please check my modifications to https://github.com/thhart/onvif-java-lib if you want to use it for Onvif management. 11 | 12 | -- Thomas Hartwig, June 2015 13 | -------------------------------------------------------------------------------- /TODO.md: -------------------------------------------------------------------------------- 1 | o support of other discovery protocols like SSDP, GVCP 2 | 3 | o check device type return 4 | 5 | o IPv6 6 | 7 | o check query on multiple network devices 8 | -------------------------------------------------------------------------------- /doc/api/allclasses-frame.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | All Classes 7 | 8 | 9 | 10 | 11 |

All Classes

12 |
13 | 16 |
17 | 18 | 19 | -------------------------------------------------------------------------------- /doc/api/allclasses-noframe.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | All Classes 7 | 8 | 9 | 10 | 11 |

All Classes

12 |
13 | 16 |
17 | 18 | 19 | -------------------------------------------------------------------------------- /doc/api/constant-values.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Constant Field Values 7 | 8 | 9 | 10 | 11 | 17 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 35 |
36 | 63 | 64 |
65 |

Constant Field Values

66 |

Contents

67 |
68 | 69 |
70 | 71 | 72 | 73 | 74 | 83 |
84 | 111 | 112 | 113 | 114 | -------------------------------------------------------------------------------- /doc/api/deprecated-list.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Deprecated List 7 | 8 | 9 | 10 | 11 | 17 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 35 |
36 | 63 | 64 |
65 |

Deprecated API

66 |

Contents

67 |
68 | 69 |
70 | 71 | 72 | 73 | 74 | 83 |
84 | 111 | 112 | 113 | 114 | -------------------------------------------------------------------------------- /doc/api/help-doc.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | API Help 7 | 8 | 9 | 10 | 11 | 17 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 35 |
36 | 63 | 64 |
65 |

How This API Document Is Organized

66 |
This API (Application Programming Interface) document has pages corresponding to the items in the navigation bar, described as follows.
67 |
68 |
69 | 168 | This help file applies to API documentation generated using the standard doclet.
169 | 170 |
171 | 172 | 173 | 174 | 175 | 184 |
185 | 212 | 213 | 214 | 215 | -------------------------------------------------------------------------------- /doc/api/index-files/index-1.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | D-Index 7 | 8 | 9 | 10 | 11 | 17 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 35 |
36 | 63 | 64 |
D M O W  65 | 66 | 67 |

D

68 |
69 |
DeviceDiscovery - Class in org.me.javawsdiscovery
70 |
71 |
Device discovery class to list local accessible devices probed per UDP probe messages.
72 |
73 |
DeviceDiscovery() - Constructor for class org.me.javawsdiscovery.DeviceDiscovery
74 |
 
75 |
discoverWsDevices() - Static method in class org.me.javawsdiscovery.DeviceDiscovery
76 |
77 |
Discover WS device on the local network
78 |
79 |
discoverWsDevicesAsUrls() - Static method in class org.me.javawsdiscovery.DeviceDiscovery
80 |
81 |
Discover WS device on the local network and returns Urls
82 |
83 |
discoverWsDevicesAsUrls(String, String) - Static method in class org.me.javawsdiscovery.DeviceDiscovery
84 |
85 |
Discover WS device on the local network with specified filter
86 |
87 |
88 | D M O W 
89 | 90 |
91 | 92 | 93 | 94 | 95 | 104 |
105 | 132 | 133 | 134 | 135 | -------------------------------------------------------------------------------- /doc/api/index-files/index-2.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | M-Index 7 | 8 | 9 | 10 | 11 | 17 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 35 |
36 | 63 | 64 |
D M O W  65 | 66 | 67 |

M

68 |
69 |
main(String[]) - Static method in class org.me.javawsdiscovery.DeviceDiscovery
70 |
 
71 |
72 | D M O W 
73 | 74 |
75 | 76 | 77 | 78 | 79 | 88 |
89 | 116 | 117 | 118 | 119 | -------------------------------------------------------------------------------- /doc/api/index-files/index-3.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | O-Index 7 | 8 | 9 | 10 | 11 | 17 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 35 |
36 | 63 | 64 |
D M O W  65 | 66 | 67 |

O

68 |
69 |
org.me.javawsdiscovery - package org.me.javawsdiscovery
70 |
 
71 |
72 | D M O W 
73 | 74 |
75 | 76 | 77 | 78 | 79 | 88 |
89 | 116 | 117 | 118 | 119 | -------------------------------------------------------------------------------- /doc/api/index-files/index-4.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | W-Index 7 | 8 | 9 | 10 | 11 | 17 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 35 |
36 | 63 | 64 |
D M O W  65 | 66 | 67 |

W

68 |
69 |
WS_DISCOVERY_ADDRESS_IPv4 - Static variable in class org.me.javawsdiscovery.DeviceDiscovery
70 |
 
71 |
WS_DISCOVERY_ADDRESS_IPv6 - Static variable in class org.me.javawsdiscovery.DeviceDiscovery
72 |
73 |
Not supported yet.
74 |
75 |
WS_DISCOVERY_CONTENT_TYPE - Static variable in class org.me.javawsdiscovery.DeviceDiscovery
76 |
 
77 |
WS_DISCOVERY_PORT - Static variable in class org.me.javawsdiscovery.DeviceDiscovery
78 |
 
79 |
WS_DISCOVERY_PROBE_MESSAGE - Static variable in class org.me.javawsdiscovery.DeviceDiscovery
80 |
 
81 |
WS_DISCOVERY_SOAP_VERSION - Static variable in class org.me.javawsdiscovery.DeviceDiscovery
82 |
 
83 |
WS_DISCOVERY_TIMEOUT - Static variable in class org.me.javawsdiscovery.DeviceDiscovery
84 |
 
85 |
86 | D M O W 
87 | 88 |
89 | 90 | 91 | 92 | 93 | 102 |
103 | 130 | 131 | 132 | 133 | -------------------------------------------------------------------------------- /doc/api/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Generated Documentation (Untitled) 7 | 59 | 60 | 61 | 62 | 63 | 64 | <noscript> 65 | <div>JavaScript is disabled on your browser.</div> 66 | </noscript> 67 | <h2>Frame Alert</h2> 68 | <p>This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client. Link to <a href="org/me/javawsdiscovery/package-summary.html">Non-frame version</a>.</p> 69 | 70 | 71 | 72 | -------------------------------------------------------------------------------- /doc/api/org/me/javawsdiscovery/DeviceDiscovery.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | DeviceDiscovery 7 | 8 | 9 | 10 | 11 | 17 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 35 |
36 | 78 | 79 | 80 |
81 |
org.me.javawsdiscovery
82 |

Class DeviceDiscovery

83 |
84 |
85 | 93 |
94 | 107 |
108 |
109 | 220 |
221 |
222 | 370 |
371 |
372 | 373 | 374 |
375 | 376 | 377 | 378 | 379 | 388 |
389 | 431 | 432 | 433 | 434 | -------------------------------------------------------------------------------- /doc/api/org/me/javawsdiscovery/class-use/DeviceDiscovery.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Uses of Class org.me.javawsdiscovery.DeviceDiscovery 7 | 8 | 9 | 10 | 11 | 17 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 35 |
36 | 63 | 64 |
65 |

Uses of Class
org.me.javawsdiscovery.DeviceDiscovery

66 |
67 |
No usage of org.me.javawsdiscovery.DeviceDiscovery
68 | 69 |
70 | 71 | 72 | 73 | 74 | 83 |
84 | 111 | 112 | 113 | 114 | -------------------------------------------------------------------------------- /doc/api/org/me/javawsdiscovery/package-frame.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | org.me.javawsdiscovery 7 | 8 | 9 | 10 | 11 |

org.me.javawsdiscovery

12 |
13 |

Classes

14 | 17 |
18 | 19 | 20 | -------------------------------------------------------------------------------- /doc/api/org/me/javawsdiscovery/package-summary.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | org.me.javawsdiscovery 7 | 8 | 9 | 10 | 11 | 17 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 35 |
36 | 63 | 64 |
65 |

Package org.me.javawsdiscovery

66 |
67 |
68 | 87 |
88 | 89 |
90 | 91 | 92 | 93 | 94 | 103 |
104 | 131 | 132 | 133 | 134 | -------------------------------------------------------------------------------- /doc/api/org/me/javawsdiscovery/package-tree.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | org.me.javawsdiscovery Class Hierarchy 7 | 8 | 9 | 10 | 11 | 17 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 35 |
36 | 63 | 64 |
65 |

Hierarchy For Package org.me.javawsdiscovery

66 |
67 |
68 |

Class Hierarchy

69 | 76 |
77 | 78 |
79 | 80 | 81 | 82 | 83 | 92 |
93 | 120 | 121 | 122 | 123 | -------------------------------------------------------------------------------- /doc/api/org/me/javawsdiscovery/package-use.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Uses of Package org.me.javawsdiscovery 7 | 8 | 9 | 10 | 11 | 17 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 35 |
36 | 63 | 64 |
65 |

Uses of Package
org.me.javawsdiscovery

66 |
67 |
No usage of org.me.javawsdiscovery
68 | 69 |
70 | 71 | 72 | 73 | 74 | 83 |
84 | 111 | 112 | 113 | 114 | -------------------------------------------------------------------------------- /doc/api/overview-tree.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Class Hierarchy 7 | 8 | 9 | 10 | 11 | 17 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 35 |
36 | 63 | 64 |
65 |

Hierarchy For All Packages

66 | Package Hierarchies: 67 | 70 |
71 |
72 |

Class Hierarchy

73 | 80 |
81 | 82 |
83 | 84 | 85 | 86 | 87 | 96 |
97 | 124 | 125 | 126 | 127 | -------------------------------------------------------------------------------- /doc/api/package-list: -------------------------------------------------------------------------------- 1 | org.me.javawsdiscovery 2 | -------------------------------------------------------------------------------- /doc/api/resources/background.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thhart/javaWsDiscovery/8a865d76e838fff997ce298f3baa9a4d7240f3db/doc/api/resources/background.gif -------------------------------------------------------------------------------- /doc/api/resources/tab.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thhart/javaWsDiscovery/8a865d76e838fff997ce298f3baa9a4d7240f3db/doc/api/resources/tab.gif -------------------------------------------------------------------------------- /doc/api/resources/titlebar.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thhart/javaWsDiscovery/8a865d76e838fff997ce298f3baa9a4d7240f3db/doc/api/resources/titlebar.gif -------------------------------------------------------------------------------- /doc/api/resources/titlebar_end.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thhart/javaWsDiscovery/8a865d76e838fff997ce298f3baa9a4d7240f3db/doc/api/resources/titlebar_end.gif -------------------------------------------------------------------------------- /doc/api/stylesheet.css: -------------------------------------------------------------------------------- 1 | /* Javadoc style sheet */ 2 | /* 3 | Overall document style 4 | */ 5 | body { 6 | background-color:#ffffff; 7 | color:#353833; 8 | font-family:Arial, Helvetica, sans-serif; 9 | font-size:76%; 10 | margin:0; 11 | } 12 | a:link, a:visited { 13 | text-decoration:none; 14 | color:#4c6b87; 15 | } 16 | a:hover, a:focus { 17 | text-decoration:none; 18 | color:#bb7a2a; 19 | } 20 | a:active { 21 | text-decoration:none; 22 | color:#4c6b87; 23 | } 24 | a[name] { 25 | color:#353833; 26 | } 27 | a[name]:hover { 28 | text-decoration:none; 29 | color:#353833; 30 | } 31 | pre { 32 | font-size:1.3em; 33 | } 34 | h1 { 35 | font-size:1.8em; 36 | } 37 | h2 { 38 | font-size:1.5em; 39 | } 40 | h3 { 41 | font-size:1.4em; 42 | } 43 | h4 { 44 | font-size:1.3em; 45 | } 46 | h5 { 47 | font-size:1.2em; 48 | } 49 | h6 { 50 | font-size:1.1em; 51 | } 52 | ul { 53 | list-style-type:disc; 54 | } 55 | code, tt { 56 | font-size:1.2em; 57 | } 58 | dt code { 59 | font-size:1.2em; 60 | } 61 | table tr td dt code { 62 | font-size:1.2em; 63 | vertical-align:top; 64 | } 65 | sup { 66 | font-size:.6em; 67 | } 68 | /* 69 | Document title and Copyright styles 70 | */ 71 | .clear { 72 | clear:both; 73 | height:0px; 74 | overflow:hidden; 75 | } 76 | .aboutLanguage { 77 | float:right; 78 | padding:0px 21px; 79 | font-size:.8em; 80 | z-index:200; 81 | margin-top:-7px; 82 | } 83 | .legalCopy { 84 | margin-left:.5em; 85 | } 86 | .bar a, .bar a:link, .bar a:visited, .bar a:active { 87 | color:#FFFFFF; 88 | text-decoration:none; 89 | } 90 | .bar a:hover, .bar a:focus { 91 | color:#bb7a2a; 92 | } 93 | .tab { 94 | background-color:#0066FF; 95 | background-image:url(resources/titlebar.gif); 96 | background-position:left top; 97 | background-repeat:no-repeat; 98 | color:#ffffff; 99 | padding:8px; 100 | width:5em; 101 | font-weight:bold; 102 | } 103 | /* 104 | Navigation bar styles 105 | */ 106 | .bar { 107 | background-image:url(resources/background.gif); 108 | background-repeat:repeat-x; 109 | color:#FFFFFF; 110 | padding:.8em .5em .4em .8em; 111 | height:auto;/*height:1.8em;*/ 112 | font-size:1em; 113 | margin:0; 114 | } 115 | .topNav { 116 | background-image:url(resources/background.gif); 117 | background-repeat:repeat-x; 118 | color:#FFFFFF; 119 | float:left; 120 | padding:0; 121 | width:100%; 122 | clear:right; 123 | height:2.8em; 124 | padding-top:10px; 125 | overflow:hidden; 126 | } 127 | .bottomNav { 128 | margin-top:10px; 129 | background-image:url(resources/background.gif); 130 | background-repeat:repeat-x; 131 | color:#FFFFFF; 132 | float:left; 133 | padding:0; 134 | width:100%; 135 | clear:right; 136 | height:2.8em; 137 | padding-top:10px; 138 | overflow:hidden; 139 | } 140 | .subNav { 141 | background-color:#dee3e9; 142 | border-bottom:1px solid #9eadc0; 143 | float:left; 144 | width:100%; 145 | overflow:hidden; 146 | } 147 | .subNav div { 148 | clear:left; 149 | float:left; 150 | padding:0 0 5px 6px; 151 | } 152 | ul.navList, ul.subNavList { 153 | float:left; 154 | margin:0 25px 0 0; 155 | padding:0; 156 | } 157 | ul.navList li{ 158 | list-style:none; 159 | float:left; 160 | padding:3px 6px; 161 | } 162 | ul.subNavList li{ 163 | list-style:none; 164 | float:left; 165 | font-size:90%; 166 | } 167 | .topNav a:link, .topNav a:active, .topNav a:visited, .bottomNav a:link, .bottomNav a:active, .bottomNav a:visited { 168 | color:#FFFFFF; 169 | text-decoration:none; 170 | } 171 | .topNav a:hover, .bottomNav a:hover { 172 | text-decoration:none; 173 | color:#bb7a2a; 174 | } 175 | .navBarCell1Rev { 176 | background-image:url(resources/tab.gif); 177 | background-color:#a88834; 178 | color:#FFFFFF; 179 | margin: auto 5px; 180 | border:1px solid #c9aa44; 181 | } 182 | /* 183 | Page header and footer styles 184 | */ 185 | .header, .footer { 186 | clear:both; 187 | margin:0 20px; 188 | padding:5px 0 0 0; 189 | } 190 | .indexHeader { 191 | margin:10px; 192 | position:relative; 193 | } 194 | .indexHeader h1 { 195 | font-size:1.3em; 196 | } 197 | .title { 198 | color:#2c4557; 199 | margin:10px 0; 200 | } 201 | .subTitle { 202 | margin:5px 0 0 0; 203 | } 204 | .header ul { 205 | margin:0 0 25px 0; 206 | padding:0; 207 | } 208 | .footer ul { 209 | margin:20px 0 5px 0; 210 | } 211 | .header ul li, .footer ul li { 212 | list-style:none; 213 | font-size:1.2em; 214 | } 215 | /* 216 | Heading styles 217 | */ 218 | div.details ul.blockList ul.blockList ul.blockList li.blockList h4, div.details ul.blockList ul.blockList ul.blockListLast li.blockList h4 { 219 | background-color:#dee3e9; 220 | border-top:1px solid #9eadc0; 221 | border-bottom:1px solid #9eadc0; 222 | margin:0 0 6px -8px; 223 | padding:2px 5px; 224 | } 225 | ul.blockList ul.blockList ul.blockList li.blockList h3 { 226 | background-color:#dee3e9; 227 | border-top:1px solid #9eadc0; 228 | border-bottom:1px solid #9eadc0; 229 | margin:0 0 6px -8px; 230 | padding:2px 5px; 231 | } 232 | ul.blockList ul.blockList li.blockList h3 { 233 | padding:0; 234 | margin:15px 0; 235 | } 236 | ul.blockList li.blockList h2 { 237 | padding:0px 0 20px 0; 238 | } 239 | /* 240 | Page layout container styles 241 | */ 242 | .contentContainer, .sourceContainer, .classUseContainer, .serializedFormContainer, .constantValuesContainer { 243 | clear:both; 244 | padding:10px 20px; 245 | position:relative; 246 | } 247 | .indexContainer { 248 | margin:10px; 249 | position:relative; 250 | font-size:1.0em; 251 | } 252 | .indexContainer h2 { 253 | font-size:1.1em; 254 | padding:0 0 3px 0; 255 | } 256 | .indexContainer ul { 257 | margin:0; 258 | padding:0; 259 | } 260 | .indexContainer ul li { 261 | list-style:none; 262 | } 263 | .contentContainer .description dl dt, .contentContainer .details dl dt, .serializedFormContainer dl dt { 264 | font-size:1.1em; 265 | font-weight:bold; 266 | margin:10px 0 0 0; 267 | color:#4E4E4E; 268 | } 269 | .contentContainer .description dl dd, .contentContainer .details dl dd, .serializedFormContainer dl dd { 270 | margin:10px 0 10px 20px; 271 | } 272 | .serializedFormContainer dl.nameValue dt { 273 | margin-left:1px; 274 | font-size:1.1em; 275 | display:inline; 276 | font-weight:bold; 277 | } 278 | .serializedFormContainer dl.nameValue dd { 279 | margin:0 0 0 1px; 280 | font-size:1.1em; 281 | display:inline; 282 | } 283 | /* 284 | List styles 285 | */ 286 | ul.horizontal li { 287 | display:inline; 288 | font-size:0.9em; 289 | } 290 | ul.inheritance { 291 | margin:0; 292 | padding:0; 293 | } 294 | ul.inheritance li { 295 | display:inline; 296 | list-style:none; 297 | } 298 | ul.inheritance li ul.inheritance { 299 | margin-left:15px; 300 | padding-left:15px; 301 | padding-top:1px; 302 | } 303 | ul.blockList, ul.blockListLast { 304 | margin:10px 0 10px 0; 305 | padding:0; 306 | } 307 | ul.blockList li.blockList, ul.blockListLast li.blockList { 308 | list-style:none; 309 | margin-bottom:25px; 310 | } 311 | ul.blockList ul.blockList li.blockList, ul.blockList ul.blockListLast li.blockList { 312 | padding:0px 20px 5px 10px; 313 | border:1px solid #9eadc0; 314 | background-color:#f9f9f9; 315 | } 316 | ul.blockList ul.blockList ul.blockList li.blockList, ul.blockList ul.blockList ul.blockListLast li.blockList { 317 | padding:0 0 5px 8px; 318 | background-color:#ffffff; 319 | border:1px solid #9eadc0; 320 | border-top:none; 321 | } 322 | ul.blockList ul.blockList ul.blockList ul.blockList li.blockList { 323 | margin-left:0; 324 | padding-left:0; 325 | padding-bottom:15px; 326 | border:none; 327 | border-bottom:1px solid #9eadc0; 328 | } 329 | ul.blockList ul.blockList ul.blockList ul.blockList li.blockListLast { 330 | list-style:none; 331 | border-bottom:none; 332 | padding-bottom:0; 333 | } 334 | table tr td dl, table tr td dl dt, table tr td dl dd { 335 | margin-top:0; 336 | margin-bottom:1px; 337 | } 338 | /* 339 | Table styles 340 | */ 341 | .contentContainer table, .classUseContainer table, .constantValuesContainer table { 342 | border-bottom:1px solid #9eadc0; 343 | width:100%; 344 | } 345 | .contentContainer ul li table, .classUseContainer ul li table, .constantValuesContainer ul li table { 346 | width:100%; 347 | } 348 | .contentContainer .description table, .contentContainer .details table { 349 | border-bottom:none; 350 | } 351 | .contentContainer ul li table th.colOne, .contentContainer ul li table th.colFirst, .contentContainer ul li table th.colLast, .classUseContainer ul li table th, .constantValuesContainer ul li table th, .contentContainer ul li table td.colOne, .contentContainer ul li table td.colFirst, .contentContainer ul li table td.colLast, .classUseContainer ul li table td, .constantValuesContainer ul li table td{ 352 | vertical-align:top; 353 | padding-right:20px; 354 | } 355 | .contentContainer ul li table th.colLast, .classUseContainer ul li table th.colLast,.constantValuesContainer ul li table th.colLast, 356 | .contentContainer ul li table td.colLast, .classUseContainer ul li table td.colLast,.constantValuesContainer ul li table td.colLast, 357 | .contentContainer ul li table th.colOne, .classUseContainer ul li table th.colOne, 358 | .contentContainer ul li table td.colOne, .classUseContainer ul li table td.colOne { 359 | padding-right:3px; 360 | } 361 | .overviewSummary caption, .packageSummary caption, .contentContainer ul.blockList li.blockList caption, .summary caption, .classUseContainer caption, .constantValuesContainer caption { 362 | position:relative; 363 | text-align:left; 364 | background-repeat:no-repeat; 365 | color:#FFFFFF; 366 | font-weight:bold; 367 | clear:none; 368 | overflow:hidden; 369 | padding:0px; 370 | margin:0px; 371 | } 372 | caption a:link, caption a:hover, caption a:active, caption a:visited { 373 | color:#FFFFFF; 374 | } 375 | .overviewSummary caption span, .packageSummary caption span, .contentContainer ul.blockList li.blockList caption span, .summary caption span, .classUseContainer caption span, .constantValuesContainer caption span { 376 | white-space:nowrap; 377 | padding-top:8px; 378 | padding-left:8px; 379 | display:block; 380 | float:left; 381 | background-image:url(resources/titlebar.gif); 382 | height:18px; 383 | } 384 | .overviewSummary .tabEnd, .packageSummary .tabEnd, .contentContainer ul.blockList li.blockList .tabEnd, .summary .tabEnd, .classUseContainer .tabEnd, .constantValuesContainer .tabEnd { 385 | width:10px; 386 | background-image:url(resources/titlebar_end.gif); 387 | background-repeat:no-repeat; 388 | background-position:top right; 389 | position:relative; 390 | float:left; 391 | } 392 | ul.blockList ul.blockList li.blockList table { 393 | margin:0 0 12px 0px; 394 | width:100%; 395 | } 396 | .tableSubHeadingColor { 397 | background-color: #EEEEFF; 398 | } 399 | .altColor { 400 | background-color:#eeeeef; 401 | } 402 | .rowColor { 403 | background-color:#ffffff; 404 | } 405 | .overviewSummary td, .packageSummary td, .contentContainer ul.blockList li.blockList td, .summary td, .classUseContainer td, .constantValuesContainer td { 406 | text-align:left; 407 | padding:3px 3px 3px 7px; 408 | } 409 | th.colFirst, th.colLast, th.colOne, .constantValuesContainer th { 410 | background:#dee3e9; 411 | border-top:1px solid #9eadc0; 412 | border-bottom:1px solid #9eadc0; 413 | text-align:left; 414 | padding:3px 3px 3px 7px; 415 | } 416 | td.colOne a:link, td.colOne a:active, td.colOne a:visited, td.colOne a:hover, td.colFirst a:link, td.colFirst a:active, td.colFirst a:visited, td.colFirst a:hover, td.colLast a:link, td.colLast a:active, td.colLast a:visited, td.colLast a:hover, .constantValuesContainer td a:link, .constantValuesContainer td a:active, .constantValuesContainer td a:visited, .constantValuesContainer td a:hover { 417 | font-weight:bold; 418 | } 419 | td.colFirst, th.colFirst { 420 | border-left:1px solid #9eadc0; 421 | white-space:nowrap; 422 | } 423 | td.colLast, th.colLast { 424 | border-right:1px solid #9eadc0; 425 | } 426 | td.colOne, th.colOne { 427 | border-right:1px solid #9eadc0; 428 | border-left:1px solid #9eadc0; 429 | } 430 | table.overviewSummary { 431 | padding:0px; 432 | margin-left:0px; 433 | } 434 | table.overviewSummary td.colFirst, table.overviewSummary th.colFirst, 435 | table.overviewSummary td.colOne, table.overviewSummary th.colOne { 436 | width:25%; 437 | vertical-align:middle; 438 | } 439 | table.packageSummary td.colFirst, table.overviewSummary th.colFirst { 440 | width:25%; 441 | vertical-align:middle; 442 | } 443 | /* 444 | Content styles 445 | */ 446 | .description pre { 447 | margin-top:0; 448 | } 449 | .deprecatedContent { 450 | margin:0; 451 | padding:10px 0; 452 | } 453 | .docSummary { 454 | padding:0; 455 | } 456 | /* 457 | Formatting effect styles 458 | */ 459 | .sourceLineNo { 460 | color:green; 461 | padding:0 30px 0 0; 462 | } 463 | h1.hidden { 464 | visibility:hidden; 465 | overflow:hidden; 466 | font-size:.9em; 467 | } 468 | .block { 469 | display:block; 470 | margin:3px 0 0 0; 471 | } 472 | .strong { 473 | font-weight:bold; 474 | } 475 | -------------------------------------------------------------------------------- /javaWsDiscovery-0.2.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thhart/javaWsDiscovery/8a865d76e838fff997ce298f3baa9a4d7240f3db/javaWsDiscovery-0.2.jar -------------------------------------------------------------------------------- /javaWsDiscovery.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /src/META-INF/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Main-Class: org.me.javawsdiscovery.DeviceDiscovery 3 | 4 | -------------------------------------------------------------------------------- /src/org/me/javawsdiscovery/DeviceDiscovery.java: -------------------------------------------------------------------------------- 1 | package org.me.javawsdiscovery; 2 | 3 | import java.io.*; 4 | import java.net.*; 5 | import java.security.SecureRandom; 6 | import java.util.*; 7 | import java.util.concurrent.*; 8 | import javax.xml.soap.*; 9 | import org.w3c.dom.Node; 10 | import org.w3c.dom.*; 11 | 12 | /** 13 | Device discovery class to list local accessible devices probed per UDP probe messages. 14 | 15 | @author th 16 | @date 2015-06-18 17 | @version 0.1 18 | */ 19 | @SuppressWarnings({"unused", "UseOfSystemOutOrSystemErr", "CallToPrintStackTrace"}) 20 | public class DeviceDiscovery { 21 | public static String WS_DISCOVERY_SOAP_VERSION = "SOAP 1.2 Protocol"; 22 | public static String WS_DISCOVERY_CONTENT_TYPE = "application/soap+xml"; 23 | public static int WS_DISCOVERY_TIMEOUT = 4000; 24 | public static int WS_DISCOVERY_PORT = 3702; 25 | public static String WS_DISCOVERY_ADDRESS_IPv4 = "239.255.255.250"; 26 | /** 27 | * Not supported yet. 28 | */ 29 | public static String WS_DISCOVERY_ADDRESS_IPv6 = "[FF02::C]"; 30 | public static String WS_DISCOVERY_PROBE_MESSAGE = "http://schemas.xmlsoap.org/ws/2005/04/discovery/Probeurn:uuid:c032cfdd-c3ca-49dc-820e-ee6696ad63e2urn:schemas-xmlsoap-org:ws:2005:04:discovery"; 31 | private static final Random random = new SecureRandom(); 32 | 33 | public static void main(String[] args) throws InterruptedException { 34 | for (URL url : discoverWsDevicesAsUrls()) { 35 | System.out.println("Device discovered: " + url.toString()); 36 | } 37 | } 38 | 39 | /** 40 | Discover WS device on the local network and returns Urls 41 | 42 | @return list of unique device urls 43 | */ 44 | public static Collection discoverWsDevicesAsUrls() {return discoverWsDevicesAsUrls("", "");} 45 | 46 | /** 47 | Discover WS device on the local network with specified filter 48 | 49 | @param regexpProtocol url protocol matching regexp like "^http$", might be empty "" 50 | @param regexpPath url path matching regexp like "onvif", might be empty "" 51 | @return list of unique device urls filtered 52 | */ 53 | public static Collection discoverWsDevicesAsUrls(String regexpProtocol, String regexpPath) { 54 | final Collection urls = new TreeSet<>(new Comparator() { 55 | public int compare(URL o1, URL o2) { 56 | return o1.toString().compareTo(o2.toString()); 57 | } 58 | }); 59 | for (String key : discoverWsDevices()) { 60 | try { 61 | final URL url = new URL(key); 62 | boolean ok = true; 63 | if (regexpProtocol.length() > 0 && !url.getProtocol().matches(regexpProtocol)) 64 | ok = false; 65 | if (regexpPath.length() > 0 && !url.getPath().matches(regexpPath)) 66 | ok = false; 67 | if (ok) urls.add(url); 68 | } catch (MalformedURLException e) { 69 | e.printStackTrace(); 70 | } 71 | } 72 | return urls; 73 | } 74 | 75 | /** 76 | Discover WS device on the local network 77 | 78 | @return list of unique devices access strings which might be URLs in most cases 79 | */ 80 | public static Collection discoverWsDevices() { 81 | final Collection addresses = new ConcurrentSkipListSet<>(); 82 | final CountDownLatch serverStarted = new CountDownLatch(1); 83 | final CountDownLatch serverFinished = new CountDownLatch(1); 84 | final Collection addressList = new ArrayList<>(); 85 | try { 86 | final Enumeration interfaces = NetworkInterface.getNetworkInterfaces(); 87 | if(interfaces != null) { 88 | while (interfaces.hasMoreElements()) { 89 | NetworkInterface anInterface = interfaces.nextElement(); 90 | if( ! anInterface.isLoopback() ) { 91 | final List interfaceAddresses = anInterface.getInterfaceAddresses(); 92 | for (InterfaceAddress address : interfaceAddresses) { 93 | addressList.add(address.getAddress()); 94 | } 95 | } 96 | } 97 | } 98 | } catch (SocketException e) { 99 | e.printStackTrace(); 100 | } 101 | ExecutorService executorService = Executors.newCachedThreadPool(); 102 | for (final InetAddress address : addressList) { 103 | Runnable runnable = new Runnable() { 104 | public void run() { 105 | try { 106 | final String uuid = UUID.randomUUID().toString(); 107 | final String probe = WS_DISCOVERY_PROBE_MESSAGE.replaceAll("urn:uuid:.*", "urn:uuid:" + uuid + ""); 108 | final int port = random.nextInt(20000) + 40000; 109 | @SuppressWarnings("SocketOpenedButNotSafelyClosed") 110 | final DatagramSocket server = new DatagramSocket(port, address); 111 | new Thread() { 112 | public void run() { 113 | try { 114 | final DatagramPacket packet = new DatagramPacket(new byte[4096], 4096); 115 | server.setSoTimeout(WS_DISCOVERY_TIMEOUT); 116 | long timerStarted = System.currentTimeMillis(); 117 | while (System.currentTimeMillis() - timerStarted < (WS_DISCOVERY_TIMEOUT)) { 118 | serverStarted.countDown(); 119 | server.receive(packet); 120 | final Collection collection = parseSoapResponseForUrls(Arrays.copyOf(packet.getData(), packet.getLength())); 121 | for (String key : collection) { 122 | addresses.add(key); 123 | } 124 | } 125 | } catch (SocketTimeoutException ignored) { 126 | } catch (Exception e) { 127 | e.printStackTrace(); 128 | } finally { 129 | serverFinished.countDown(); 130 | server.close(); 131 | } 132 | } 133 | }.start(); 134 | try { 135 | serverStarted.await(1000, TimeUnit.MILLISECONDS); 136 | } catch (InterruptedException e) { 137 | e.printStackTrace(); 138 | } 139 | if (address instanceof Inet4Address) { 140 | server.send(new DatagramPacket(probe.getBytes(), probe.length(), InetAddress.getByName(WS_DISCOVERY_ADDRESS_IPv4), WS_DISCOVERY_PORT)); 141 | } else { 142 | server.send(new DatagramPacket(probe.getBytes(), probe.length(), InetAddress.getByName(WS_DISCOVERY_ADDRESS_IPv6), WS_DISCOVERY_PORT)); 143 | } 144 | } catch (Exception e) { 145 | e.printStackTrace(); 146 | } 147 | try { 148 | serverFinished.await((WS_DISCOVERY_TIMEOUT), TimeUnit.MILLISECONDS); 149 | } catch (InterruptedException e) { 150 | e.printStackTrace(); 151 | } 152 | } 153 | }; 154 | executorService.submit(runnable); 155 | } 156 | try { 157 | executorService.shutdown(); 158 | executorService.awaitTermination(WS_DISCOVERY_TIMEOUT + 2000, TimeUnit.MILLISECONDS); 159 | } catch (InterruptedException ignored) { 160 | } 161 | return addresses; 162 | } 163 | 164 | private static Collection getNodeMatching(Node body, String regexp) { 165 | final Collection nodes = new ArrayList<>(); 166 | if (body.getNodeName().matches(regexp)) nodes.add(body); 167 | if (body.getChildNodes().getLength() == 0) return nodes; 168 | NodeList returnList = body.getChildNodes(); 169 | for (int k = 0; k < returnList.getLength(); k++) { 170 | final Node node = returnList.item(k); 171 | nodes.addAll(getNodeMatching(node, regexp)); 172 | } 173 | return nodes; 174 | } 175 | 176 | private static Collection parseSoapResponseForUrls(byte[] data) throws SOAPException, IOException { 177 | //System.out.println(new String(data)); 178 | final Collection urls = new ArrayList<>(); 179 | MessageFactory factory = MessageFactory.newInstance(WS_DISCOVERY_SOAP_VERSION); 180 | final MimeHeaders headers = new MimeHeaders(); 181 | headers.addHeader("Content-type", WS_DISCOVERY_CONTENT_TYPE); 182 | SOAPMessage message = factory.createMessage(headers, new ByteArrayInputStream(data)); 183 | SOAPBody body = message.getSOAPBody(); 184 | for (Node node : getNodeMatching(body, ".*:XAddrs")) { 185 | if (node.getTextContent().length() > 0) { 186 | urls.addAll(Arrays.asList(node.getTextContent().split(" "))); 187 | } 188 | } 189 | return urls; 190 | } 191 | } 192 | -------------------------------------------------------------------------------- /src/org/me/javawsdiscovery/sampleProbe.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | http://schemas.xmlsoap.org/ws/2005/04/discovery/Probe 6 | urn:uuid:c032cfdd-c3ca-49dc-820e-ee6696ad63e2 7 | urn:schemas-xmlsoap-org:ws:2005:04:discovery 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /src/org/me/javawsdiscovery/sampleResponseOnvif.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | http://schemas.xmlsoap.org/ws/2005/04/discovery/ProbeMatches 8 | uuid:32f05949-5256-1fa8-3972-2a9e66b4 9 | urn:uuid:acac63be-ba61-458a-98d3-83ca045304a8 10 | http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous 11 | 12 | 13 | 14 | 15 | 16 | 17 | urn:uuid:0004634c-ec65-65ec-4c63-040004634c63 18 | 19 | dn:NetworkVideoTransmitter tds:Device 20 | onvif://www.onvif.org/type/Network_Video_Transmitter onvif://www.onvif.org/Profile/Streaming 21 | onvif://www.onvif.org/name/Bosch onvif://www.onvif.org/location/ 22 | onvif://www.onvif.org/hardware/FLEXIDOME_NDN-498-P 23 | 24 | http://192.168.188.200:80/onvif/device_service 25 | https://192.168.188.200:443/onvif/device_service 26 | 27 | 1234 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /src/org/me/javawsdiscovery/sampleResponsePrinter.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | urn:uuid:80a488c3-6acf-481c-8295-30055c3f49b5 6 | urn:uuid:ed3b9171-0338-42d0-9134-424f76bee829 7 | http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous 8 | http://schemas.xmlsoap.org/ws/2005/04/discovery/ProbeMatches 9 | 10 | 11 | 12 | 13 | 15 | 16 | urn:uuid:e3248000-80ce-11db-8000-30055c3f49b5 17 | 18 | wsdp:Device wprt:PrintDeviceType wscn:ScanDeviceType 19 | http://192.168.188.40:80/WebServices/Device 20 | 20 21 | 22 | 23 | 24 | 25 | --------------------------------------------------------------------------------