現在、私が書いたWebアプリケーションからWebサービスを呼び出そうとしています。私のWebアプリケーションには、ユーザーにJSPページの電子メールアドレスを尋ねるフォームフィールドがあり、処理のためにprocess.jspという別のJSPページに送信されます。 process.jspでは、電子メールアドレスの有効性を確認するWebサービスを呼び出す必要があります。私は、次のWebサービスを呼び出すためにしようとしてきたAxis2でwebservicesを使用する方法
はこの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 = "[email protected]";
// 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);
}
}
は私がやっているものはありここで間違っている?私はWebサービスを使うのがとても新しいので、私と一緒に辛抱してください。
ありがとうございます!
簡単ですが、それが使用することを少し単純になる傾向があるとそれはjdkにバンドルされています。 – jtahlborn