2016-06-16 16 views
2

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) 

enter image description here

enter image description here

答えて

2

Some addresses will not appear in the database and therefore cannot be mapped. This is one of the limitation of IP Address location (Geolocation).

あなたはこのIPアドレスで試してみてください 212.58.246.79

それは "イギリス"

あなたがでジオロケーションについての詳細を読むことができますが表示されます

ここに一般:https://www.lifewire.com/does-ip-address-geolocation-really-work-818154

これがあなたを助けてくれることを願っています。

0

この質問は分析するのが難しいです。ただし、この例外は単純に、サービスクライアントSoap Webサービスは要求をサポートしていないことを意味します。クライアントが最も古いものを使用している場合は、おそらく最新のJDKバージョンを使用しています。

例:私はJDK1.8を使用していて、クライアントはjdk1.6を使用していました。また、JavaBrainsはJDK 1.6を使用しています。

解決方法:お使いのコンピュータのJDKバージョンを確認してください

関連する問題