SOAPプロトコルを学習しようとしています。だから、folowingコマンドスレッド "main"の例外com.sun.xml.internal.ws.fault.ServerSOAPFaultException:クライアントがサーバーからSOAPフォルトを受信しました
C:\Program Files\Java\jdk1.8.0_74\bin>wsimport -keep -s src http://www.webservicex.net/geoipservice.asmx?WSDL
を使用して、wsimportのの助けを借りてnet.webservicex
コードを生成した後、私は(下の画面撮影を見てみてください)私のプロジェクトで生成されたコードを配置。私はrun configurations --> java application --> arguments --> programm arguments--> 216.58.213.238
でグーグルの一部のIPを追加した。しかしIPLocationFinder
クラスでmain
メソッドを実行するときに、私は次のエラーを取得しています:
IPLocationFinderクラス
import net.webservicex.GeoIP;
import net.webservicex.GeoIPService;
import net.webservicex.GeoIPServiceSoap;
public class IPLocationFinder {
public static void main(String[] args) {
if (args.length != 1) {
System.out.println("You need to pass in one IP address");
} else {
String ipAddress = args[0];
GeoIPService ipService = new GeoIPService();
GeoIPServiceSoap geoIPServiceSoap = ipService.getGeoIPServiceSoap();
// Here is line 14.
GeoIP geoIP = geoIPServiceSoap.getGeoIP(ipAddress);
System.out.println(geoIP.getCountryName());
}
}
}
エラー
Exception in thread "main" com.sun.xml.internal.ws.fault.ServerSOAPFaultException: Client received SOAP Fault from server: System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> System.NullReferenceException: Object reference not set to an instance of an object.
at WebserviceX.Service.Adapter.IPAdapter.CheckIP(String IP)
at WebserviceX.Service.GeoIPService.GetGeoIP(String IPAddress)
--- End of inner exception stack trace --- Please see the server log to find more detail regarding exact cause of the failure.
at com.sun.xml.internal.ws.fault.SOAP11Fault.getProtocolException(Unknown Source)
at com.sun.xml.internal.ws.fault.SOAPFaultBuilder.createException(Unknown Source)
at com.sun.xml.internal.ws.client.sei.StubHandler.readResponse(Unknown Source)
at com.sun.xml.internal.ws.db.DatabindingImpl.deserializeResponse(Unknown Source)
at com.sun.xml.internal.ws.db.DatabindingImpl.deserializeResponse(Unknown Source)
at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(Unknown Source)
at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(Unknown Source)
at com.sun.xml.internal.ws.client.sei.SEIStub.invoke(Unknown Source)
at com.sun.proxy.$Proxy31.getGeoIP(Unknown Source)
at IPLocationFinder.main(IPLocationFinder.java:14)