Netbeans和.NET Web服务 [英] Netbeans and .NET web services

查看:85
本文介绍了Netbeans和.NET Web服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不是经验丰富的Java开发人员,因此欢迎任何评论...

I'm not an experienced java developer so any comment will be welcomed ...

我已经使用c#编写了一个Web服务,并且想从Java中使用此服务-用于此任务的Netbeans.

I've written a web service using c# and I wanted to consume this service from java - used Netbeans for this task.

所有方法在一个方法之外都可以很好地工作:该方法需要一个名为BusinessDataField2的类型-该类型包含2个字段:名称(字符串)和值(对象)

All methods works well beside one: the method expecting a type called BusinessDataField2 - this type contains 2 fields: name(string) and value(object)

这些字段使用get,set方法填充-这在.NET环境中很容易工作.

Those fields are filled using get,set methods - this works easily at the .NET environment.

但是...

我可以看到Java的get和set方法需要不同的参数-参数为:

I can see that Java requires different parameters for the get and set methods - the parameter is :

JAXBElement JAXBElement

JAXBElement JAXBElement

问题是:如何实例化该对象?我尝试了许多不同的方法,但没有任何效果...

The question is: how do I instantiate this object? I tried many different ways but nothing worked...

谢谢, 提供

推荐答案

您不应使用对象"类型.它可以是任何实际的类型,但是您没有告诉Java端期望什么.然后,它能做的最好的就是处理该值的实际XML.

You should not use the "object" type. It could be any actual type, but you're not telling the Java side what to expect. The best it can do, then, is process the actual XML of the value.

考虑:该对象可以是int,也可以是某些复杂的结构. Java方面将如何处理呢? Java端甚至没有用于复杂结构的代理类,因为您从未告诉过您可以返回复杂结构.

Consider: the object could be an int, or it could be some complex structure. How would the Java side know what to do with it? The Java side wouldn't even have a proxy classs for the complex structure, because you never told it that you could ever return the complex structure.

这篇关于Netbeans和.NET Web服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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