Java “线程中的异常”;“主要”;com.sun.xml.internal.ws.fault.ServerSOAPFaultException:客户端从服务器接收到SOAP错误

Java “线程中的异常”;“主要”;com.sun.xml.internal.ws.fault.ServerSOAPFaultException:客户端从服务器接收到SOAP错误,java,web-services,soap,wsdl,Java,Web Services,Soap,Wsdl,我正在努力学习SOAP协议。因此,在使用以下命令在wsimport的帮助下生成net.webservicex代码之后 C:\ProgramFiles\Java\jdk1.8.0\u 74\bin>wsimport-keep-src 我把生成的代码放在我的项目中(请看下面的屏幕截图)。我在运行配置-->java应用程序-->参数-->程序参数-->216.58.213.238 但是在执行IPLocationFinder类中的main方法时,我得到以下错误: IPLocationFinder类 im

我正在努力学习SOAP协议。因此,在使用以下命令在wsimport的帮助下生成
net.webservicex
代码之后

C:\ProgramFiles\Java\jdk1.8.0\u 74\bin>wsimport-keep-src

我把生成的代码放在我的项目中(请看下面的屏幕截图)。我在
运行配置-->java应用程序-->参数-->程序参数-->216.58.213.238

但是在执行
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)

有些地址不会出现在数据库中,因此无法映射。这是IP地址定位(Geolocation)的限制之一

您应该尝试使用此IP地址 212.58.246.79

它应该显示“英国”

您可以在此处阅读有关地理位置的更多信息:


希望这对你有所帮助。

这个问题很难分析;然而,这种异常意味着服务客户端SOAPWeb服务不再支持该请求。您可能正在使用最新的JDK版本,其中客户端使用的是最旧的版本

例如:我使用JDK1.8,客户端使用JDK1.6,JavaBrains也使用JDK1.6


解决方案:检查计算机上的JDK版本

这也可能是由于通过的soap请求中存在错误。例如:请求用户名或密码值可能有额外的“\”或其他字符。您可以使用SOAPUI对其进行验证,并在代码中更正请求