简体   繁体   English

尝试添加服务参考时出错

[英]Error when trying to add service reference

We have a WebService running in glassfish and a client written in C# 我们有一个在glassfish运行的WebService和一个用C#编写的客户端

When trying to add a service reference in visual studio, I get the errormessage 尝试在Visual Studio中添加service reference时,出现错误消息

unsupported Content-Type: application/soap+xml; charset=utf-8 Supported Content-Types are: [text/xml]

This just worked until a few days ago, I do not know of any changes in client and server that could cause that. 直到几天前,这种方法一直有效,我不知道客户端和服务器的任何更改都可能导致这种情况。

I already get the message in the glassfish console window when I call "Add service reference", select the adress http://localhost:8888/Service/MyWebService?wsdl and press the Go button. 当我调用“添加服务引用”时,我已经在glassfish控制台窗口中收到消息,选择地址http://localhost:8888/Service/MyWebService?wsdl并按“执行Go按钮。

The service reference does not work, I do not get a connection to the WebService afterwards. 服务引用不起作用,此后我没有连接到WebService

Can someone point me in the right direction? 有人可以指出我正确的方向吗?

What can I do about it? 我该怎么办?

How can I find out more about what is going wrong? 我如何才能找到更多有关发生问题的信息?

Here is the full error message. 这是完整的错误消息。 Please note that I translated some parts to make it more readable, (the supported and unsupported), please excuse if this is not the correct english errormessage. 请注意,我翻译了一些部分以使其更具可读性(受支持和不受支持),如果这不是正确的英语错误消息,请原谅。

[#|2013-06-25T12:04:28.316+0200|SEVERE|glassfish3.1.2|com.sun.xml.ws.transport.http.HttpAdapter|_ThreadID=139;_ThreadName=http-thread-pool-8888(5);|Unsupported Content-Type: application/soap+xml; charset=utf-8 Supported Content-Types are: [text/xml]
com.sun.xml.ws.server.UnsupportedMediaException: Unsupported Content-Type: application/soap+xml; charset=utf-8 Supported Content-Types are: [text/xml]
        at com.sun.xml.ws.encoding.StreamSOAPCodec.decode(StreamSOAPCodec.java:322)
        at com.sun.xml.ws.encoding.StreamSOAPCodec.decode(StreamSOAPCodec.java:156)
        at com.sun.xml.ws.encoding.SOAPBindingCodec.decode(SOAPBindingCodec.java:312)
        at com.sun.xml.ws.transport.http.HttpAdapter.decodePacket(HttpAdapter.java:344)
        at com.sun.xml.ws.transport.http.HttpAdapter.invokeAsync(HttpAdapter.java:509)
        at com.sun.xml.ws.transport.http.servlet.ServletAdapter.invokeAsync(ServletAdapter.java:206)
        at com.sun.xml.ws.transport.http.servlet.WSServletDelegate.doGet(WSServletDelegate.java:159)
        at com.sun.xml.ws.transport.http.servlet.WSServletDelegate.doPost(WSServletDelegate.java:194)
        at com.sun.xml.ws.transport.http.servlet.WSServlet.doPost(WSServlet.java:80)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:688)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:770)
        at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1550)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:281)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
        at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:655)
        at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:595)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:161)
        at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:331)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:231)
        at com.sun.enterprise.v3.services.impl.ContainerMapper$AdapterCallable.call(ContainerMapper.java:317)
        at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:195)
        at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:860)
        at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:757)
        at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1056)
        at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:229)
        at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)
        at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)
        at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)
        at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)
        at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)
        at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59)
        at com.sun.grizzly.ContextTask.run(ContextTask.java:71)
        at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532)
        at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513)
        at java.lang.Thread.run(Unknown Source)
|#]

What data are you sending to your service? 您要发送什么数据到您的服务? Look at "unsupported Content-Type: application/soap+xml; charset=utf-8" 查看“不受支持的内容类型:application / soap + xml; charset = utf-8”

Could be that server receives what it does not expect to receive? 服务器可能收到了它不希望收到的内容吗? Eg suddenly changed encoding. 例如突然更改了编码。

PS I can't comment, so answering PS我不能发表评论,所以回答

Something inside the WebService has changed. WebService内部的某些内容已更改。

But I was able to generate the proxy by calling svcutil in the Visual Studio command line manually. 但是我能够通过在Visual Studio命令行中手动调用svcutil来生成代理。

The warnings there gave me good hints to change the webservice so that I can add a service reference now again. 那里的警告为我提供了更改Web服务的好提示,以便我现在可以再次添加服务引用。

恕我直言,您的客户端正在使用Soap 1.2协议进行呼叫,而服务器(默认情况下)配置为使用Soap 1.1协议。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM