Problem: I am using the soap-ws library (https://github.com/reficio/soap-ws) for working with SOAP in Java. The library provides functionality to parse a WSDL from a URL, but I need to parse a WSDL from a content string instead.
What I Need: I want to modify the WSDL class in the soap-ws library to accept a WSDL content string rather than a URL.
What I Have Tried: I have examined the library's code and identified the constructor that accepts a URL. I made a modification to accept a String instead by using ByteArrayInputStream.
public class WSDL {
private static final Log LOG = LogFactory.getLog(WSDL.class);
private Definition definition;
public WSDL(String wsdlContent) throws WSDLException, IOException {
try (InputStream is = new ByteArrayInputStream(wsdlContent.getBytes(StandardCharsets.UTF_8))) {
definition = WSDLFactory.newInstance().newWSDLReader().readWSDL(null, new InputSource(is));
}
}
String wsdlContent = "Your WSDL Content as a String"; WSDL wsdl = new WSDL(wsdlContent);
What I Have Tried: I have examined the library's code and identified the constructor that accepts a URL. I made a modification to accept a String instead by using ByteArrayInputStream.