Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

issue wsdl call java example

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

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;
Comment

PREVIOUS NEXT
Code Example
Java :: java manajro 
Java :: convert object address to string in java 
Java :: longest palindrome string in java 
Java :: The larger and the smaller of the character “E” and the integer 71 java 
Java :: android studio clear child views 
Java :: reponse entity as result spring controller 
Java :: python to java convert online 
Java :: Java @SafeVarargs annotation 
Java :: forge close gui java 
Java :: primefaces p:dataexporter encoding for pdf preProcessor 
Java :: toSet 
Java :: constructor overloading ambiguity resolved 
Java :: return index using matcher java 
Java :: viewResolver 
Java :: array remove duplicate in java 
Java :: java classes and objects 
Java :: varargs java 
Java :: unicode in java 
Java :: check if string is decimal java 
Java :: java resto 
Java :: java remove double spaces 
Java :: Java Program to find the perimeter of the circle 
Java :: what to do in minecraft 
Java :: client missing intents 
Java :: getUssd() kotlin 
Sql :: uninstall mysql ubuntu 18.04 
Sql :: how to install mysql ubuntu 
Sql :: SQL order random 
Sql :: get tables in database sql 
Sql :: postgres kill running query 
ADD CONTENT
Topic
Content
Source link
Name
3+2 =