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

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

问题描述

我需要使用 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 服务端(未将对象引用设置为对象的实例"基本上是 Java 中 NullPointerException 的等效项)但它可能可能是因为您从 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 Web 服务调用给出“未将对象引用设置为对象的实例"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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