来自Java的SOAP Webservice调用给出“未将对象引用设置为对象的实例". [英] SOAP Webservice call from Java gives "Object reference not set to an instance of an object"

查看:813
本文介绍了来自Java的SOAP Webservice调用给出“未将对象引用设置为对象的实例".的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个要求,我要使用eclipse中的Axis2从Java调用基于SOAP的Web服务. Web服务代码是C#,带有BasicHttpBinding.

I have a requirement where I call a SOAP based web service from Java using Axis2 from eclipse. The web service code is in C#, with a BasicHttpBinding.

但是当我从客户端存根调用该方法时,会出现此错误.

But when I call the method from the client stub I get this error.

org.apache.axis2.AxisFault:对象引用未设置为对象的实例.

org.apache.axis2.AxisFault: Object reference not set to an instance of an object.

有人可以帮我解决这个问题吗?是在服务端还是在客户端?以前,我遇到内部服务器错误",然后他们不得不添加一些内容,以便我可以在日志中看到此错误.

Could anyone help me figure out this one? Is this on the service side or on the client side? Previously I got 'Internal Server error' and then they had to add something so that I can see this error in the logs.

推荐答案

该消息来自C#Web服务端(对象引用未设置为对象的实例"基本上与NullPointerException在Java中等效),但它可能是因为您是从Java客户端发送的内容,还是没有发送.

The message is from the C# web service side ("Object reference not set to an instance of an object" is basically a Java equivalent of NullPointerException) but it might be because of something you send from your Java client or maybe you don't send.

该错误通常意味着您没有发送必需的参数,并且Web服务没有正确地验证其输入,并且在导致NullReferenceException时丢失了参数.

The error usually means that you didn't send a required parameter and that the web service didn't do a proper job of validating it's input and missing parameter got to a point when caused the NullReferenceException.

但是只有一种方法可以确定,那就是对通话进行故障排除.

But there is only one way to be sure, and that is to troubleshoot the call.

我建议您使用 SoapUI 之类的东西来创建一条消息并将其发送到服务.在SoapUI中成功调用一次之后,请使用Java客户端中的相同参数进行调用,然后看看会发生什么.当您这样做时,使用用于记录日志的代理非常有用查看发送的消息是否实际上是预期的消息.

I suggest you use something like SoapUI to create a message and send that to the service. Once you get a succesfull call in SoapUI, make a call with the same parameters from your Java client and see what happens. When you do that, using a proxy for logging is very useful to see if the sent message is actually the expected one.

这篇关于来自Java的SOAP Webservice调用给出“未将对象引用设置为对象的实例".的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆