I am using JDK 1.5 with SAAJ [saaj-api-1.3.jar and saaj-impl-1.3.15.jar] and activation.jar
Now I have simple client below: On running this I am just getting the response just as ERROR tag nothing else, its very confusion, I thought there is something wrong with the webservice, so I have printed the SOAP_MESSAGE generated by SAAJ and using SOAP-UI sent the exact same message and it gave me the correct response, I even tried another webservice from
URL [http://www.actionscript.org/forums/showthread.php3?t=70742] and it seem to be working correctly. Please someone let me know I am totally lost here. Thanks in advance.
import java.io.IOException;
import java.net.URL;
import javax.xml.namespace.QName;
import javax.xml.soap.MessageFactory;
import javax.xml.soap.SOAPBody;
import javax.xml.soap.SOAPConnection;
import javax.xml.soap.SOAPConnectionFactory;
import javax.xml.soap.SOAPElement;
import javax.xml.soap.SOAPEnvelope;
import javax.xml.soap.SOAPMessage;
import javax.xml.soap.SOAPPart;
import javax.xml.transform.Source;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.OutputKeys;
public class Test {
// Method for creating the SOAP Request
private static SOAPMessage createSOAPRequest() throws Exception {
MessageFactory messageFactory = MessageFactory.newInstance();
SOAPMessage soapMessage = messageFactory.createMessage();
SOAPPart soapPart = soapMessage.getSOAPPart();
// Construct SOAP Request Message:
// SOAP Envelope
SOAPEnvelope envelope = soapPart.getEnvelope();
envelope.addNamespaceDeclaration("sch", "http://www.cpscreen.com/schemas");
// SOAP Body
SOAPBody soapBody = envelope.getBody();
SOAPElement soapBodyElem = soapBody.addChildElement("CPLinkRequest","sch");
QName attributeName1 = new QName("account");
soapBodyElem.addAttribute(attributeName1, "NOTEST");
QName attributeName2 = new QName("userId");
soapBodyElem.addAttribute(attributeName2, "NONAME");
QName attributeName3 = new QName("password");
soapBodyElem.addAttribute(attributeName3, "NOPASSWORD");
SOAPElement soapBodyElem1 = soapBodyElem.addChildElement("Type", "sch");
soapBodyElem1.addTextNode("Report");
SOAPElement soapBodyElem2 = soapBodyElem.addChildElement("ProviderReferenceId", "sch");
soapBodyElem2.addTextNode("WPS-6472130");
soapMessage.saveChanges();
// Check the input
System.out.println("Request SOAP Message for Product web service");
soapMessage.writeTo(System.out);
System.out.println();
return soapMessage;
}
// Method for receiving the SOAP Response
private static void printSOAPResponse(SOAPMessage soapResponse) throws Exception {
TransformerFactory transformerFactory = TransformerFactory.newInstance();
Transformer transformer = transformerFactory.newTransformer();
transformer.setOutputProperty(OutputKeys.INDENT, "yes");
transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount","2");
Source sourceContent = soapResponse.getSOAPPart().getContent();
System.out.println("\nResponse SOAP Message from Product web service : ");
StreamResult result = new StreamResult(System.out);
transformer.transform(sourceContent, result);
}
// Starting point for SaajClient
public static void main(String args[]) {
try {
// Create SOAP Connection
SOAPConnectionFactory soapConnectionFactory = SOAPConnectionFactory.newInstance();
SOAPConnection soapConnection = soapConnectionFactory.createConnection();
// Sending SOAP Message to SOAP Server i.e, Product Catalog service
//String url = "http://www.webservicex.net/convertFrequency.asmx?WSDL";
java.net.URL endpoint = new URL("https://abc.xyz.com/pub/aaa/ws/backgroundCheck");
SOAPMessage soapResponse = soapConnection.call(createSOAPRequest(),endpoint);
// Processing the SOAP Response
printSOAPResponse(soapResponse);
//System.out.print("Response SOAP Message:");
//soapResponse.writeTo(System.out);
soapConnection.close();
} catch (Exception e) {
System.err.println("Error occurred while sending SOAP Request to Server");
e.printStackTrace();
}
}
}
Related
I am sending a SOAP request to a webservice but it is sending its WSDL definition back as its response.
What would lead to this?
Response:
<?xml version="1.0" encoding="UTF-8"?><wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://www.sample.com/test_request" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:tns="http://www.sample.com/test_request" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
<wsdl:types>
<xsd:schema e
Code:
import javax.xml.soap.*;
import javax.xml.transform.*;
import javax.xml.transform.stream.*;
public class Test {
/**
* Starting point for the SAAJ - SOAP Client Testing
*/
public static void main(String args[]) {
try {
// Create SOAP Connection
SOAPConnectionFactory soapConnectionFactory = SOAPConnectionFactory.newInstance();
SOAPConnection soapConnection = soapConnectionFactory.createConnection();
// Send SOAP Message to SOAP Server
String url = "https://xxxxxxxxxxx.xxxxxxxxx.com/xxxxxxxx.do?WSDL&xxxxxxxxx=qualified";
SOAPMessage soapResponse = soapConnection.call(createSOAPRequest(), url);
// Process the SOAP Response
printSOAPResponse(soapResponse);
soapConnection.close();
} catch (Exception e) {
System.err.println("Error occurred while sending SOAP Request to Server");
e.printStackTrace();
}
}
private static SOAPMessage createSOAPRequest() throws Exception {
MessageFactory messageFactory = MessageFactory.newInstance();
SOAPMessage soapMessage = messageFactory.createMessage();
SOAPPart soapPart = soapMessage.getSOAPPart();
String serverURI = "http://www.xxxxxxxx.com/xxxxxx";
// SOAP Envelope
SOAPEnvelope envelope = soapPart.getEnvelope();
envelope.addNamespaceDeclaration("a", "http://www.xxxxxxw.com/xxxxxxxx");
// SOAP Body
SOAPBody soapBody = envelope.getBody();
SOAPElement soapBodyElem = soapBody.addChildElement("test", "a");
SOAPElement soapBodyElem1 = soapBodyElem.addChildElement("testid", "a");
soapBodyElem1.addTextNode("xxxxxxxxx");
MimeHeaders headers = soapMessage.getMimeHeaders();
headers.addHeader("SOAPAction", "http://www.xxxxxx-xxxxx.com/xxxxxxx/xxxx");
String username = "123";
String password = "123";
String authorization = new sun.misc.BASE64Encoder().encode((username + ":" + password).getBytes());
System.out.println(authorization);
headers.addHeader("Authorization", "Basic " + authorization);
headers.addHeader("Proxy-Connection","Keep-Alive");
soapMessage.saveChanges();
/* Print the request message */
System.out.println("Request: ");
soapMessage.writeTo(System.out);
System.out.println();
return soapMessage;
}
/**
* Method used to print the SOAP Response
*/
private static void printSOAPResponse(SOAPMessage soapResponse) throws Exception {
TransformerFactory transformerFactory = TransformerFactory.newInstance();
Transformer transformer = transformerFactory.newTransformer();
Source sourceContent = soapResponse.getSOAPPart().getContent();
System.out.print("\nResponse SOAP Message = ");
StreamResult result = new StreamResult(System.out);
transformer.transform(sourceContent, result);
}
}
What have caused this issue?
I am getting proper response from SOAP UI
You specified in the URL to get the WSDL (Parameter ?WSDL). You need to specify the proper URL for the service operation you want to call.
When accessing WSO2 DAS using REST api using jersey java rest client im getting response as unsupported media type with response status 415 with response
InboundJaxrsResponse{context=ClientResponse{method=POST, uri=https://localhost:9443/analytics/search, status=415, reason=Unsupported Media Type}}
the client source below. Can anyone help on this issue.
package com.rilfi.research.c2c.das.rest.client;
import org.glassfish.jersey.SslConfigurator;
import org.glassfish.jersey.client.ClientConfig;
import org.glassfish.jersey.client.authentication.HttpAuthenticationFeature;
import javax.net.ssl.SSLContext;`enter code here`
import javax.ws.rs.client.*;
import javax.ws.rs.core.*;
public class DasClientApp {
public static void main(String[] args) {
SslConfigurator sslConfig = SslConfigurator.newInstance()
.trustStoreFile("./client-truststore.jks")
.trustStorePassword("wso2carbon")
.keyStoreFile("wso2carbon.jks")
.keyPassword("wso2carbon");
SSLContext sslContext = sslConfig.createSSLContext();
Client client = ClientBuilder.newBuilder().sslContext(sslContext).build();
WebTarget webTarget = client.target("https://localhost:9443").path("analytics/search");
MultivaluedMap<String, String> formData = new MultivaluedHashMap<String, String>();
formData.add("tableName", "V1SALEFULL3");
formData.add("query", "product:phone");
formData.add("start", "0");
formData.add("count", "10");
Response response = webTarget.request(MediaType.APPLICATION_JSON).post(Entity.form(formData));
System.out.println(response.getStatus());
System.out.println(response.readEntity(String.class));
System.out.println(response);
}
}
After adding HttpAuthenticationFeature feature = HttpAuthenticationFeature.basic("admin", "admin"); i can now access wso2 DAS using rest api
package com.rilfi.research.c2c.das.rest.client;
import org.glassfish.jersey.SslConfigurator;
import org.glassfish.jersey.client.ClientConfig;
import org.glassfish.jersey.client.authentication.HttpAuthenticationFeature;
import javax.net.ssl.SSLContext;
import javax.ws.rs.client.*;
import javax.ws.rs.core.*;
/**
* Created by rilfi on 5/5/16.
*/
public class DasClientApp {
public static void main(String[] args) {
SslConfigurator sslConfig = SslConfigurator.newInstance()
.trustStoreFile("client-truststore.jks")
.trustStorePassword("wso2carbon")
.keyStoreFile("wso2carbon.jks")
.keyPassword("wso2carbon");
SSLContext sslContext = sslConfig.createSSLContext();
HttpAuthenticationFeature feature = HttpAuthenticationFeature.basic("admin", "admin");
Client client = ClientBuilder.newBuilder().sslContext(sslContext).build();
WebTarget webTarget = client.target("https://localhost:9443").path("analytics/search").register(feature);
String payload = "{\"tableName\":\"V1SALEFULL3\",\"query\":\"product:phone\",\"start\":50,\"count\":10}";
Response response = webTarget.request(MediaType.APPLICATION_JSON_TYPE).post(Entity.json(payload));
System.out.println(response.getStatus());
System.out.println(response.readEntity(String.class));
System.out.println(response);
}
}
I have a problem about SOAP request.I want to explain what am I doing.
This is my SOAP request.
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:web="http://www.webserviceX.NET">
<soapenv:Header/>
<soapenv:Body>
<web:GetWeather>
<!--Optional:-->
<web:CityName>Istanbul</web:CityName>
<!--Optional:-->
<web:CountryName>Turkey</web:CountryName>
</web:GetWeather>
</soapenv:Body>
</soapenv:Envelope>
Endpoint : http://www.webservicex.net/globalweather.asmx
WSDL link : http://www.webservicex.net/globalweather.asmx?WSDL
Also this is my code.
public static void main(String args[]) {
try {
// Create SOAP Connection
SOAPConnectionFactory soapConnectionFactory = SOAPConnectionFactory
.newInstance();
SOAPConnection soapConnection = soapConnectionFactory
.createConnection();
// Send SOAP Message to SOAP Server
String url = "http://www.webservicex.net/globalweather.asmx?WSDL";
// SOAPMessage soapResponse =
SOAPMessage soapResponse = soapConnection.call(createSOAPRequest(),
url);
// Process the SOAP Response
printSOAPResponse(soapResponse);
soapConnection.close();
} catch (Exception e) {
System.err.println("Error occurred while sending SOAP Request to Server");
e.printStackTrace();
}
}
private static SOAPMessage createSOAPRequest() throws Exception {
MessageFactory messageFactory = MessageFactory.newInstance();
SOAPMessage soapMessage = messageFactory.createMessage();
SOAPPart soapPart = soapMessage.getSOAPPart();
String serverURL = "http://www.webserviceX.NET/";
SOAPEnvelope envelope = soapPart.getEnvelope();
envelope.addNamespaceDeclaration("web", serverURL);
// SOAP Body
SOAPBody soapBody = envelope.getBody();
SOAPElement soapElement = soapBody.addChildElement("GetWeather", "web");
SOAPElement soapElement1 = soapElement.addChildElement("CityName",
"web");
soapElement1.addTextNode("Istanbul");
SOAPElement soapElement2 = soapElement.addChildElement("CountryName",
"web");
soapElement2.addTextNode("Turkey");
MimeHeaders headers = soapMessage.getMimeHeaders();
headers.addHeader("SOAPAction", serverURL + "GetWeather");
soapMessage.saveChanges();
return soapMessage;
}
/**
* Method used to print the SOAP Response
*/
private static void printSOAPResponse(SOAPMessage soapResponse)
throws Exception {
TransformerFactory transformerFactory = TransformerFactory
.newInstance();
Transformer transformer = transformerFactory.newTransformer();
Source sourceContent = soapResponse.getSOAPPart().getContent();
System.out.print("\nResponse SOAP Message = ");
StreamResult result = new StreamResult(System.out);
transformer.transform(sourceContent, result);
}}
As a result, I got "Server was unable to process.Procedure or function 'getWeather' expects parameter '#CountryName', which was not supplied."
What does it mean ? Why am I taking this exception ?
Any suggestion about solution ?
You are using the variable serverUrl as both the HTTP server URL and as the XML namespace name. They are close but not exactly the same. The namespace name is http://www.webserviceX.NET but your server URL is http://www.webserviceX.NET/ (notice the trailing slash). The string for an XML namespace must be an exact match to the namespace name in the schema.
Recommend you create a separate variable for the namespace (or just inline it):
String serverURL = "http://www.webserviceX.NET/";
SOAPEnvelope envelope = soapPart.getEnvelope();
envelope.addNamespaceDeclaration("web", "http://www.webserviceX.NET");
...
With this change, your code works for me.
package java4s;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
#Path("/vinay")
public class JsonFromRestful {
#POST
#Path("/{runID}/{tweetID}/{tweet : .*}")
#Produces(MediaType.TEXT_PLAIN)
public String sayPlainTextHello( #PathParam("runID") String rid,
#PathParam("tweetID") String tid,
#PathParam("tweet") String twt) throws IOException, InterruptedException {
StringBuffer resneel=new StringBuffer();
resneel.append(rid);
resneel.append(tid);
resneel.append(twt);
return return resneel.toString();
}
}
client test program
package neel;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.MultivaluedMap;
import com.sun.jersey.api.client.Client;
import com.sun.jersey.api.client.ClientResponse;
import com.sun.jersey.api.client.WebResource;
import com.sun.jersey.core.util.MultivaluedMapImpl;
/*
* excerpt of the maven dependencies
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-client</artifactId>
<version>1.19</version>
</dependency>
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-core</artifactId>
<version>1.19</version>
</dependency>
*/
public class ClientTest {
public static void main(String[] args)
{
if(args.length != 4)
{
System.out.println("Incorrect parameters, usage:");
System.out.println("java -jar neelclienttest.jar run_id tweet_id tweet_to_annotate rest_api");
System.exit(1);
}
String runID = args[0];
String tweetID = args[1];
String tweet = args[2];
String uri = args[3];
try {
String annotations = annotate(uri, runID, tweetID, tweet);
System.out.println(annotations);
} catch (Exception e) {
e.printStackTrace();
}
}
public static String annotate(String uri, String runID, String tweetID, String tweet) throws Exception
{
Client client = Client.create();
WebResource webResource = client.resource(uri);
MultivaluedMap<String,String> params = new MultivaluedMapImpl();
params.add("RunID", runID);
params.add("TweetID", tweetID);
params.add("Tweet", tweet);
ClientResponse response = webResource.
accept(MediaType.TEXT_PLAIN_TYPE).
post(ClientResponse.class, params);
// check if status code != 200 OK
if ( response.getStatus() != 200 )
throw new Exception ("The REST interface has answered with an unexpected status code" + response.getStatus());
return response.getEntity(String.class);
}
}
here i am giving command line arguements runid tweetid tweet and the path is http://localhost/cen_neel/vinay/ but it is showing java.lang exception. we created a webservice and whatever i have given clienttest is for testing. i dont need any changes in clienttest. please help if there is any error in my program. i tested the same program with restclient plugin like below
http://localhost/cen_neel/vinay/r12/v23/Chennai and i am getting response back correctly.
Here post(ClientResponse.class, params);. you're trying to post the URI information into the body of the request. That's not where they belong. Actually, based on your resource method, there shouldn't be a body at all. You can simply pass an empty string.
Instead, how you should be building the request, is with .path() on the WebResource to append path segments
ClientResponse response = webResource
.path(runID)
.path(tweetID)
.path(tweet)
.accept(MediaType.TEXT_PLAIN_TYPE)
.post(ClientResponse.class, "");
It seems completely pointless though, the way you are doing it. Why not just pass the entire URI, like you are in the Rest Client.
Anyway, this is not really a good design overall. Here are some improvements I would make.
The actual tweet should not be in the URI. It should be posted in the body. To accept it in the body, simply don't annotate it with #PathParam for the tweet method parameter, and get rid of the path template {tweet : .*}. Then you can post(ClientReponse.class, tweet). You should also add #Consumes(MediaType.TEXT_PLAIN) to the resource method, and use type to create the request. i.e.
.accept(MediaType.TEXT_PLAIN_TYPE)
.type(MediaType.TEXT_PLAIN_TYPE)
.post(ClientResponse.class, tweet);
If you are trying to create a new tweet, the id, should not be in the template. The id should not exist yet. When the tweet is created, the server should notify the client with the newly created id of the tweet, with a Location header.
This is related to my earlier post here getSOAPBody returns NULL whereas SOAPResponse.writeTo prints the whole message, Strange?
I am posting my code that i am using to unmarshal. I receive all nulls in the target object
package trials;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBElement;
import javax.xml.bind.Unmarshaller;
import javax.xml.soap.MessageFactory;
import javax.xml.soap.MimeHeaders;
import javax.xml.soap.SOAPBody;
import javax.xml.soap.SOAPConnection;
import javax.xml.soap.SOAPConnectionFactory;
import javax.xml.soap.SOAPElement;
import javax.xml.soap.SOAPEnvelope;
import javax.xml.soap.SOAPMessage;
import javax.xml.soap.SOAPPart;
import javax.xml.stream.XMLInputFactory;
import javax.xml.stream.XMLStreamReader;
import javax.xml.transform.stream.StreamSource;
public class SOAPClientSAAJ {
public static void main(String args[]) throws Exception {
// Create SOAP Connection
SOAPConnectionFactory soapConnectionFactory = SOAPConnectionFactory.newInstance();
SOAPConnection soapConnection = soapConnectionFactory.createConnection();
// Send SOAP Message to SOAP Server
String url = "http://ws.cdyne.com/emailverify/Emailvernotestemail.asmx";
SOAPMessage soapResponse = soapConnection.call(createSOAPRequest(), url);
System.out.println("Body");
// print SOAP Response
System.out.print("Response SOAP Message:");
System.out.println("SOAP Body 2= " + soapResponse.getSOAPBody());
System.out.println("SOAP Body 2=" + soapResponse.getSOAPPart().getEnvelope().getBody());
soapResponse.writeTo(System.out);
SOAPBody body = soapResponse.getSOAPBody();
System.out.println("\n");
System.out.println(body.getElementsByTagName("ResponseText").item(0).getTextContent());
System.out.println(body.getElementsByTagName("ResponseCode").item(0).getTextContent());
System.out.println(body.getElementsByTagName("GoodEmail").item(0).getTextContent());
ByteArrayOutputStream bos = new ByteArrayOutputStream();
soapResponse.writeTo(bos);
XMLInputFactory xif = XMLInputFactory.newFactory();
StreamSource xml = new StreamSource(new ByteArrayInputStream(bos.toByteArray()));
XMLStreamReader xsr = xif.createXMLStreamReader(xml);
xsr.nextTag();
while (!xsr.getLocalName().equals("VerifyEmailResult")) {
xsr.nextTag();
}
JAXBContext jc = JAXBContext.newInstance(VerifyEmailResult.class);
Unmarshaller unmarshaller = jc.createUnmarshaller();
JAXBElement<VerifyEmailResult> jb = unmarshaller.unmarshal(xsr, VerifyEmailResult.class);
xsr.close();
VerifyEmailResult v = jb.getValue();
System.out.println(v.ResponseText);
System.out.println(v.ResponseCode);
System.out.println(v.LastMailServer);
System.out.println(v.GoodEmail);
soapConnection.close();
}
private static SOAPMessage createSOAPRequest() throws Exception {
MessageFactory messageFactory = MessageFactory.newInstance();
SOAPMessage soapMessage = messageFactory.createMessage();
SOAPPart soapPart = soapMessage.getSOAPPart();
String serverURI = "http://ws.cdyne.com/";
// SOAP Envelope
SOAPEnvelope envelope = soapPart.getEnvelope();
envelope.addNamespaceDeclaration("example", serverURI);
/*
* Constructed SOAP Request Message: <SOAP-ENV:Envelope
* xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
* xmlns:example="http://ws.cdyne.com/"> <SOAP-ENV:Header/>
* <SOAP-ENV:Body> <example:VerifyEmail>
* <example:email>mutantninja#gmail.com</example:email>
* <example:LicenseKey>123</example:LicenseKey> </example:VerifyEmail>
* </SOAP-ENV:Body> </SOAP-ENV:Envelope>
*/
// SOAP Body
SOAPBody soapBody = envelope.getBody();
SOAPElement soapBodyElem = soapBody.addChildElement("VerifyEmail", "example");
SOAPElement soapBodyElem1 = soapBodyElem.addChildElement("email", "example");
soapBodyElem1.addTextNode("mutantninja#gmail.com");
SOAPElement soapBodyElem2 = soapBodyElem.addChildElement("LicenseKey", "example");
soapBodyElem2.addTextNode("123");
MimeHeaders headers = soapMessage.getMimeHeaders();
headers.addHeader("SOAPAction", serverURI + "VerifyEmail");
soapMessage.saveChanges();
/* Print the request message */
System.out.print("Request SOAP Message:");
soapMessage.writeTo(System.out);
System.out.println();
return soapMessage;
}
}
Here is my class which i am trying to unmarshal to
package trials;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
#XmlRootElement
#XmlAccessorType(XmlAccessType.FIELD)
public class VerifyEmailResult {
public String ResponseText;
public String ResponseCode;
public String LastMailServer;
public String GoodEmail;
}
Here is my console output
Request SOAP Message:<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:example="http://ws.cdyne.com/"><SOAP-ENV:Header/><SOAP-ENV:Body><example:VerifyEmail><example:email>mutantninja#gmail.com</example:email><example:LicenseKey>123</example:LicenseKey></example:VerifyEmail></SOAP-ENV:Body></SOAP-ENV:Envelope>
Body
Response SOAP Message:SOAP Body 2= [soap:Body: null]
SOAP Body 2=[soap:Body: null]
<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><soap:Body><VerifyEmailResponse xmlns="http://ws.cdyne.com/"><VerifyEmailResult><ResponseText>Current license key only allows so many checks</ResponseText><ResponseCode>9</ResponseCode><LastMailServer/><GoodEmail>false</GoodEmail></VerifyEmailResult></VerifyEmailResponse></soap:Body></soap:Envelope>
Current license key only allows so many checks
9
false
null
null
null
null
Try with
response.response.getSOAPBody().extractContentAsDocument()
I was facing the same problem and it is fixed with below code :
SOAPMessage response = dispatch.invoke(request);
Document document = response.getSOAPBody().extractContentAsDocument();
NodeList list = document.getChildNodes();
System.out.println("Value : " + list.item(0).getChildNodes().item(0).getChildNodes().item(0).getTextContent());
Hope this helps