Выпуск WSDL Call Java Пример

String xml = "<s:Envelope xmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\">\r\n" +
  "  <s:Body>\r\n" +
  "       <GetInternalVal xmlns=\"http://someuri.org/\">\r\n" +
  "          <username>some_user</username>\r\n" +
  "          <password>" +some_password+ "</password>\r\n" +
  "          <domain>EARTH</domain>\r\n" +
  "       </GetInternalVal>\r\n" +
  "  </s:Body>\r\n" +
  "</s:Envelope>\r\n";

HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.TEXT_XML);
headers.set("soapaction", "http://someuri.org/MyService/GetData");

HttpEntity<String> request = new HttpEntity<String>(xml, headers);

String response = this.restTemplate.exchange("http://myhost.stage.com/someservice/InternalVal.svc?wsdl=",HttpMethod.POST, request, String.class).getBody();

/*Parse the XML response*/
/*
	<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
      <s:Body>
          <GetInternalValResponse xmlns="http://someuri.org/">
              <GetInternalVal>
                  HelloWorld
              </GetInternalVal>
          </GetInternalValResponse>
      </s:Body>
	</s:Envelope>
*/
DocumentBuilder documentBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
InputSource inputSource = new InputSource();
inputSource.setCharacterStream(new StringReader(response));

Document doc = documentBuilder.parse(inputSource);
NodeList nList = doc.getElementsByTagName("GetInternalVal");

Node node = nList.item(0);
String internalVal = node.getTextContent();

return internalVal;
Tense Tarantula