В настоящее время я пытаюсь вызвать веб-сервис из написанного веб-приложения.Мое веб-приложение просто имеет поле формы, которое запрашивает у пользователя адрес электронной почты на странице JSP, отправляет его на другую страницу JSP с именем process.jsp для обработки.В process.jsp я хочу вызвать веб-сервис, который подтвердит правильность адреса электронной почты.
Я пытался вызвать следующий веб-сервис, найденный по этому URL:
http://www.xmethods.com/ve2/ViewListing.po?key=uuid:4506DD11-6A4F-2BF3-2DBE-EED251ABAA2A
Мой код ниже выглядит следующим образом:
import javax.xml.namespace.QName;
import org.apache.axis2.AxisFault;
import org.apache.axis2.addressing.EndpointReference;
import org.apache.axis2.client.Options;
import org.apache.axis2.rpc.client.RPCServiceClient;
public class ClientEmailValidate {
public static void main(String[] args) throws AxisFault {
RPCServiceClient serviceClient = new RPCServiceClient();
Options options = serviceClient.getOptions();
// Setting the endpoint resource
EndpointReference targetEPR = new EndpointReference
("http://ws.cdyne.com/emailverify/Emailvernotestemail.asmx");
options.setTo(targetEPR);
// Getting the operation based on the targetnamespace
QName opGetExchange = new QName
("http://ws.cdyne.com", "VerifyEmail");
String email = "someEmail@hotmail.com";
// preparing the arguments
Object[] opGetExchangeArgs = new Object[] { email };
// preparing the return type
Class[] returnTypes = new Class[] { String.class };
// invoking the service passing in the arguments and getting the
// response
Object[] response = serviceClient.invokeBlocking(opGetExchange,
opGetExchangeArgs, returnTypes);
// obtaining the data from the response
String result = (String) response[0];
// Displaying the result
System.out.println("Result : " + result);
}
}
Что-то я здесь не так делаю?Я очень плохо знаком с использованием веб-сервисов, поэтому, пожалуйста, будьте терпеливы со мной.
Спасибо!