48 SOAPConnectionFactory soapConnectionFactory = SOAPConnectionFactory.newInstance();
49 SOAPConnection connection = soapConnectionFactory.createConnection();
50 SOAPFactory soapFactory = SOAPFactory.newInstance();
52 MessageFactory factory = MessageFactory.newInstance();
53 SOAPMessage message = factory.createMessage();
55 SOAPBody body = message.getSOAPBody();
57 Name bodyName = soapFactory.createName(query.getMethod(),
"",
"urn:ActiveStations");
58 SOAPBodyElement soapBodyElement = body.addBodyElement(bodyName);
59 for (Map.Entry<String, Object> methodParam : query.getMethodParams().entrySet()) {
60 soapBodyElement.addChildElement(methodParam.getKey(), methodParam.getValue().toString());
67 URL url =
new URL(endpoint);
68 SOAPMessage response = connection.call(message, url);
78 ByteArrayOutputStream out =
new ByteArrayOutputStream();
79 response.writeTo(out);
80 return out.toString();
83 }
catch (SOAPException e) {
84 throw new InvocationException(
"SOAPException: ", e);
85 }
catch (IOException e) {
86 throw new InvocationException(
"IOException: ", e);