java - 带有 com.sun.net.HttpServer 和 .net 的 JAX WS

标签 java .net interop com.sun.net.httpserver

我有一个非常令人沮丧的问题。我有一个使用 JAX WS 创建的 Web 服务 注释和 Endpoint.publish(...) 技巧。当然,它使用com.sun.net.HttpServer。当我尝试在 Visual Studio 中添加服务引用时,它不会移动。服务器说:

不支持的内容类型:仅接受文本/xml

但是 .net 要求使用 application/soap+xml 内容类型。

如何更改 jax ws 中的内容类型?或者,我如何更改 Visual Studio 添加引用内容的内容类型。

谢谢。真是令人沮丧!

最佳答案

谷歌搜索后我发现......

Hi,

I've resolved the problem.

'application/soap+xml' is the content type used for SOAP 1.2 messages whereas text/xml is used for SOAP 1.1. Hence the client send SOAP 1.2 requests and service expects only SOAP 1.1.

Metro uses SOAP 1.1 by default. How to enable SOAP 1.2 binding is explained here: - http://forums.java.net/jive/thread.jspa?messageID=322894 - https://metro.dev.java.net/1.4/docs/soap12.html

Reference 。希望这有帮助:)

编辑:尝试以下注释...

@WebService 
@BindingType(javax.xml.ws.soap.SOAPBinding.SOAP12HTTP_BINDING) 

或者

Endpoint endpoint = Endpoint.create("http://java.sun.com/xml/ns/jaxws/2003/05/soap/bindings/HTTP/", impl); 
endpoint.publish("http://localhost:9080/PatientDiscovery"); 

关于java - 带有 com.sun.net.HttpServer 和 .net 的 JAX WS,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4648647/

相关文章:

c# - 创建并保存 Excel 文件

java - 带 ansi 输入的 Eclipse 控制台

java - Twitter4j 中不兼容的类型

java - Android:如何忽略或禁用 savedInstanceState?

.net - 为什么排序列表必须有一个键值对?

c# - 使用互操作在后台打开 Excel 工作簿

java - 当从特定类调用某个方法时执行 AOP

c# - 无法启动已配置的 Visual Studio 开发 Web 服务器

.net - 现实世界中的 WCF 故障合约

objective-c - Swift/ObjC 循环导入