[英]Java error Consuming WCF Service
I'm started to develop a Web Service with WCF and created a WCF Service poject. 我开始使用WCF开发Web服务,并创建了WCF服务项目。 I let all as it was and imported the service in netbeans as JAX WS service.
我照原样将服务导入到netbeans中作为JAX WS服务。 All seems to be fine.
一切似乎都很好。
Service1 test= new Service1();
CompositeType ct=new CompositeType();
ct.setBoolValue(Boolean.TRUE);
ObjectFactory factory=new ObjectFactory();
ct.setStringValue(factory.createString("StringValue"));
CompositeType result= test.getBasicHttpBindingIService1().getDataUsingDataContract(ct);
I can send the request. 我可以发送请求。 I can break in Visual studio and see the CompositeType object.
我可以在Visual Studio中休息一下,然后查看CompositeType对象。 But the object is not as it should be:
但是对象不是应该的:
true
. true
。 null
. null
。 Why can't i post the CompositeType to java but can consume it? 为什么我不能将CompositeType发布到Java,但可以使用它?
It's hard to tell from just the detail you've provided. 仅凭您提供的细节很难分辨。
Here is what I suggest: 这是我的建议:
Enable tracing on the service side, generate tracing logs, and analyze with SvcTraceViewer. 在服务端启用跟踪,生成跟踪日志,并使用SvcTraceViewer进行分析。 To do this, follow the instructions at this MSDN article on using the service trace viewer .
为此,请按照MSDN上有关使用服务跟踪查看器的文章中的说明进行操作。 Notice what's different between the first and second time.
注意第一次和第二次之间的区别。
Turn on debug exceptions. 打开调试异常。 This is done by turning in includeExceptionDetailInFaults, which you can do by following the instructions here .
这可以通过上载includeExceptionDetailInFaults来完成, 您可以按照此处的说明进行操作 。 Notice what's different between the first and second time.
注意第一次和第二次之间的区别。
Use Fiddler to monitor the wire traffic on both the client side and the service side. 使用Fiddler监视客户端和服务端的有线通信。
Generally, once you do this, you should plenty of more info on what's going funky at the service side and can diagnose the issue pretty quickly. 通常,一旦执行此操作,您就应该在服务端获取更多有关时髦问题的信息,并且可以很快地诊断出问题。 Try it, and please report back!
试试看,请回报! :)
:)
I also lost 2 hours in this! 我在此也损失了2个小时!
The problem is in java code :) 问题出在Java代码中:)
Instead of this 代替这个
ct.setStringValue(factory.createString("StringValue"));
use this 用这个
ct.setStringValue(factory.createCompositeTypeStringValue("StringValue"));
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.