|
10 | 10 | import javax.xml.namespace.*;
|
11 | 11 | import javax.xml.parsers.*;
|
12 | 12 |
|
| 13 | +import burp.IHttpRequestResponse; |
| 14 | +import burp.IResponseInfo; |
13 | 15 | import burp.WSDLParser;
|
14 | 16 | import com.sun.xml.internal.ws.api.model.wsdl.WSDLModel;
|
15 | 17 | import org.w3c.dom.*;
|
@@ -41,13 +43,13 @@ public class WSDLReaderImpl implements WSDLReader
|
41 | 43 | {
|
42 | 44 | // Used for determining the style of operations.
|
43 | 45 | private static final List STYLE_ONE_WAY =
|
44 |
| - Arrays.asList(new String[]{Constants.ELEM_INPUT}); |
| 46 | + Arrays.asList(Constants.ELEM_INPUT); |
45 | 47 | private static final List STYLE_REQUEST_RESPONSE =
|
46 |
| - Arrays.asList(new String[]{Constants.ELEM_INPUT, Constants.ELEM_OUTPUT}); |
| 48 | + Arrays.asList(Constants.ELEM_INPUT, Constants.ELEM_OUTPUT); |
47 | 49 | private static final List STYLE_SOLICIT_RESPONSE =
|
48 |
| - Arrays.asList(new String[]{Constants.ELEM_OUTPUT, Constants.ELEM_INPUT}); |
| 50 | + Arrays.asList(Constants.ELEM_OUTPUT, Constants.ELEM_INPUT); |
49 | 51 | private static final List STYLE_NOTIFICATION =
|
50 |
| - Arrays.asList(new String[]{Constants.ELEM_OUTPUT}); |
| 52 | + Arrays.asList(Constants.ELEM_OUTPUT); |
51 | 53 |
|
52 | 54 | protected boolean verbose = true;
|
53 | 55 | protected boolean importDocuments = true;
|
@@ -412,17 +414,13 @@ protected Import parseImport(Element importEl,
|
412 | 414 |
|
413 | 415 | if (importedDef == null)
|
414 | 416 | {
|
415 |
| - URLConnection connection = new URL(url.toString()).openConnection(); |
416 |
| - for(Iterator<String> i = WSDLParser.headers.iterator(); i.hasNext(); ) { |
417 |
| - String item = i.next(); |
418 |
| - if (item.contains(":") && !item.contains("Accept-Encoding:")) { |
419 |
| - String headerName = item.split(":")[0]; |
420 |
| - String headerValue = item.split(":")[1]; |
421 |
| - connection.setRequestProperty(headerName, headerValue); |
422 |
| - } |
423 |
| - } |
424 |
| - connection.connect(); |
425 |
| - inputStream = connection.getInputStream(); |
| 417 | + byte[] request = WSDLParser.helpers.buildHttpRequest(url); |
| 418 | + IHttpRequestResponse httpRequestResponse = WSDLParser.callbacks.makeHttpRequest(WSDLParser.httpRequestResponse.getHttpService(),request); |
| 419 | + byte[] response = httpRequestResponse.getResponse(); |
| 420 | + IResponseInfo responseInfo = WSDLParser.helpers.analyzeResponse(response); |
| 421 | + int bodyOffset = responseInfo.getBodyOffset(); |
| 422 | + String body = new String(response, bodyOffset, response.length - bodyOffset); |
| 423 | + inputStream = new ByteArrayInputStream(body.getBytes()); |
426 | 424 |
|
427 | 425 | //inputStream = StringUtils.getContentAsInputStream(url);
|
428 | 426 |
|
@@ -817,17 +815,13 @@ protected ExtensibilityElement parseSchema( Class parentType,
|
817 | 815 | if (referencedSchema == null)
|
818 | 816 | {
|
819 | 817 | // We haven't read this schema in before so do it now
|
820 |
| - URLConnection connection = new URL(url.toString()).openConnection(); |
821 |
| - for(Iterator<String> i = WSDLParser.headers.iterator(); i.hasNext(); ) { |
822 |
| - String item = i.next(); |
823 |
| - if (item.contains(":") && !item.contains("Accept-Encoding:")) { |
824 |
| - String headerName = item.split(":")[0]; |
825 |
| - String headerValue = item.split(":")[1]; |
826 |
| - connection.setRequestProperty(headerName, headerValue); |
827 |
| - } |
828 |
| - } |
829 |
| - connection.connect(); |
830 |
| - inputStream = connection.getInputStream(); |
| 818 | + byte[] request = WSDLParser.helpers.buildHttpRequest(url); |
| 819 | + IHttpRequestResponse httpRequestResponse = WSDLParser.callbacks.makeHttpRequest(WSDLParser.httpRequestResponse.getHttpService(),request); |
| 820 | + byte[] response = httpRequestResponse.getResponse(); |
| 821 | + IResponseInfo responseInfo = WSDLParser.helpers.analyzeResponse(response); |
| 822 | + int bodyOffset = responseInfo.getBodyOffset(); |
| 823 | + String body = new String(response, bodyOffset, response.length - bodyOffset); |
| 824 | + inputStream = new ByteArrayInputStream(body.getBytes()); |
831 | 825 |
|
832 | 826 | if (inputStream != null)
|
833 | 827 | {
|
@@ -2292,17 +2286,13 @@ public Definition readWSDL(String contextURI, String wsdlURI)
|
2292 | 2286 | ? StringUtils.getURL(null, contextURI)
|
2293 | 2287 | : null;
|
2294 | 2288 | URL url = StringUtils.getURL(contextURL, wsdlURI);
|
2295 |
| - URLConnection connection = new URL(url.toString()).openConnection(); |
2296 |
| - for(Iterator<String> i = WSDLParser.headers.iterator(); i.hasNext(); ) { |
2297 |
| - String item = i.next(); |
2298 |
| - if (item.contains(":") && !item.contains("Accept-Encoding:")) { |
2299 |
| - String headerName = item.split(":")[0]; |
2300 |
| - String headerValue = item.split(":")[1]; |
2301 |
| - connection.setRequestProperty(headerName, headerValue); |
2302 |
| - } |
2303 |
| - } |
2304 |
| - connection.connect(); |
2305 |
| - InputStream inputStream = connection.getInputStream(); |
| 2289 | + byte[] request = WSDLParser.helpers.buildHttpRequest(url); |
| 2290 | + IHttpRequestResponse httpRequestResponse = WSDLParser.callbacks.makeHttpRequest(WSDLParser.httpRequestResponse.getHttpService(),request); |
| 2291 | + byte[] response = httpRequestResponse.getResponse(); |
| 2292 | + IResponseInfo responseInfo = WSDLParser.helpers.analyzeResponse(response); |
| 2293 | + int bodyOffset = responseInfo.getBodyOffset(); |
| 2294 | + String body = new String(response, bodyOffset, response.length - bodyOffset); |
| 2295 | + InputStream inputStream = new ByteArrayInputStream(body.getBytes()); |
2306 | 2296 | InputSource inputSource = new InputSource(inputStream);
|
2307 | 2297 | inputSource.setSystemId(url.toString());
|
2308 | 2298 | Document doc = getDocument(inputSource, url.toString());
|
|
0 commit comments