问题描述
Exceptioninthread"main"org.codehaus.xfire.XFireRuntimeException:Couldnotinvokeservice..Nestedexceptionisorg.codehaus.xfire.fault.XFireFault:Fault:java.lang.NullPointerExceptionorg.codehaus.xfire.fault.XFireFault:Fault:java.lang.NullPointerExceptionatorg.codehaus.xfire.fault.XFireFault.createFault(XFireFault.java:89)atorg.codehaus.xfire.client.Invocation.invoke(Invocation.java:83)atorg.codehaus.xfire.client.Invocation.invoke(Invocation.java:114)atorg.codehaus.xfire.client.Client.invoke(Client.java:336)atorg.codehaus.xfire.client.XFireProxy.handleRequest(XFireProxy.java:77)atorg.codehaus.xfire.client.XFireProxy.invoke(XFireProxy.java:57)at$Proxy7.recvSms(UnknownSource)atcd.toc.Test.main(Test.java:435)Causedby:java.lang.NullPointerExceptionatorg.codehaus.xfire.aegis.type.basic.LongType.writeObject(LongType.java:27)atorg.codehaus.xfire.aegis.type.java5.HolderType.writeObject(HolderType.java:38)atorg.codehaus.xfire.aegis.AegisBindingProvider.writeParameter(AegisBindingProvider.java:229)atorg.codehaus.xfire.service.binding.AbstractBinding.writeParameter(AbstractBinding.java:273)atorg.codehaus.xfire.service.binding.WrappedBinding.writeMessage(WrappedBinding.java:90)atorg.codehaus.xfire.soap.SoapSerializer.writeMessage(SoapSerializer.java:80)atorg.codehaus.xfire.transport.http.HttpChannel.writeWithoutAttachments(HttpChannel.java:56)atorg.codehaus.xfire.transport.http.CommonsHttpMessageSender.getByteArrayRequestEntity(CommonsHttpMessageSender.java:422)atorg.codehaus.xfire.transport.http.CommonsHttpMessageSender.send(CommonsHttpMessageSender.java:360)atorg.codehaus.xfire.transport.http.HttpChannel.sendViaClient(HttpChannel.java:123)atorg.codehaus.xfire.transport.http.HttpChannel.send(HttpChannel.java:48)atorg.codehaus.xfire.handler.OutMessageSender.invoke(OutMessageSender.java:26)atorg.codehaus.xfire.handler.HandlerPipeline.invoke(HandlerPipeline.java:131)atorg.codehaus.xfire.client.Invocation.invoke(Invocation.java:79)...6more
解决方案
解决方案二:
Causedby:java.lang.NullPointerException是不是services.xml没配service?
解决方案三:
cd.toc.Test.main(Test.java:435)cd.toc.Test类中435行出现空指针异常,你应该用到转发器了吧,就是把客户端请求转发到服务端,转发器取到值了吗?
解决方案四:
是不是包的问题。
解决方案五:
谢谢我是个新人刚刚接手webservice
解决方案六:
还是不这么明白
解决方案七:
你请求服务端的地址可以请求到吗?http://请求ip/工程名/web.xml中配置的名称/webservice配置文件中配置的名称?wsdl如果在地址栏中写这个可以请求到,那说明是你客户端请求不对。下边是客户端写法Stringendpoint="http://localhost:8090/FAP/service/UserService";org.apache.axis.client.Serviceservice=neworg.apache.axis.client.Service();org.apache.axis.client.Callcall=(org.apache.axis.client.Call)service.createCall();call.addParameter("name",org.apache.axis.encoding.XMLType.XSD_STRING,javax.xml.rpc.ParameterMode.IN);---这句是要指定你传的参数名要跟他那边需要的参数名称一样call.setReturnType(org.apache.axis.encoding.XMLType.XSD_STRING);---------这句是指定你参数的类型call.setTargetEndpointAddress(newjava.net.URL(endpoint));call.setOperationName("方法名");Stringres=(String)call.invoke(newObject[]{"参数","参数"});call.setUseSOAPAction(true);System.out.print(res);