从 C# 调用 Java Web 服务 尝试将 C# 中的长值发送到 Java 中的长值
我是一名 C# 开发人员,正在开发一个项目,在该项目中我需要调用一个 Java Web 服务,该服务需要一个 Long 值作为我传递给方法的对象的属性。它看起来像这样:
public long routeDocument(long sDocID, string sRoutee)
{
DREService.QueueDocument newQDoc = new DREService.QueueDocument();
newQDoc.documentId = sDocID;
newQDoc.routee = "tracyr";
DREService.dre oSoapClient = new DREService.dre { Url = _URI };
try
{
oSoapClient.createQueueDocument(ref newQDoc, null);
}
catch (Exception ex)
{
//return "ERROR: " + ex.Message;
}
return newQDoc.id;
}
话虽如此,当我单步执行代码并查看对象属性“newQDoc.documentId”时,它已正确设置,但在 Fiddler 中,该属性根本没有显示在帖子和 Java 上服务永远不会收到它。我们编写了一个小测试工具,但也遇到了同样的问题。我猜测 .net 不知道如何处理复杂类型 Long,并且该服务的 xsd 将其定义为 long,因此它尝试将 long 数据类型发送到 Long 复杂类型。我的问题是有没有一种技巧可以将 long 从 .net 发送到 Java 中的 Long ? (请记住,两位开发人员都在内部,因此如果 Java 端需要更改某些内容,我们也可以这样做)。
我们已经将测试工具集更改为 long,并且确实将其正确框定为 Long,但 Java 人员认为更改会导致其他调用客户端的应用程序出现问题。
对此有任何帮助,我们将不胜感激!
I'm a C# developer and working on a project where I need to make a call out to a Java webservice that is expecting a Long value as a property on an object that I am passing to a method. It looks like this:
public long routeDocument(long sDocID, string sRoutee)
{
DREService.QueueDocument newQDoc = new DREService.QueueDocument();
newQDoc.documentId = sDocID;
newQDoc.routee = "tracyr";
DREService.dre oSoapClient = new DREService.dre { Url = _URI };
try
{
oSoapClient.createQueueDocument(ref newQDoc, null);
}
catch (Exception ex)
{
//return "ERROR: " + ex.Message;
}
return newQDoc.id;
}
With that said, when I step through the code and I look at the object property "newQDoc.documentId" it is being set properly, but in Fiddler the property is not showing up at all on the post and the Java service never receives it. We wrote a small test harness and we have the same problem. I'm guessing that .net doesn't know what to do with the complex type Long, and the xsd for the service is defining it as long so it is trying to send the long data type to a Long complex type. My question is is there a trick to be able to send a long from .net to a Long in Java? (Keeping in mind both developers are in house, so if something needs to change on the Java end we can do that as well).
We already changed the test harness set to a long and it does box it to a Long properly but the Java person thinks that change would cause problems in his application for other calling clients.
Any help on this is appreciated!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论