0

我正在尝试使用 Visual Studio 2010 .NET 4 连接到 cXML Web 服务,当我尝试使用 URL 向项目添加服务引用时,我收到以下错误(我已屏蔽 url 以保护隐私)为什么我收到此错误,我该如何连接到 Web 服务?...

There was an error downloading 'http://00.00.00.00:8080/xml/servlet/twaaserver?svcname=x10h015'
The request failed with the error message:
--
<h1>Error: 500</h1>
<h2>Location: /xml/servlet/twaaserver</h2><b>Internal Servlet Error:</b><br> <pre>javax.servlet.ServletException
    at processService.doProcess(processService.java:447)
    at processService.run(processService.java:585)
    at twaaserver.doGet(twaaserver.java:429)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:405)
    at org.apache.tomcat.core.Handler.service(Handler.java:287)
    at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
    at org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:812)
    at org.apache.tomcat.core.ContextManager.service(ContextManager.java:758)
    at org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpConnectionHandler.java:213)
    at org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416)
    at org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:501)
    at java.lang.Thread.run(Thread.java:534)
</pre>
<b>Root cause:</b>
<pre>java.lang.NullPointerException
    at eboservice.transformDataFeeds(eboservice.java:982)
    at processService.doProcess(processService.java:279)
    at processService.run(processService.java:585)
    at twaaserver.doGet(twaaserver.java:429)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:405)
    at org.apache.tomcat.core.Handler.service(Handler.java:287)
    at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
    at org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:812)
    at org.apache.tomcat.core.ContextManager.service(ContextManager.java:758)
    at org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpConnectionHandler.java:213)
    at org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416)
    at org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:501)
    at java.lang.Thread.run(Thread.java:534)
</pre>


--.
Metadata contains a reference that cannot be resolved: 'http://00.00.00.00:8080/xml/servlet/twaaserver?svcname=x10h015'.
The content type text/html of the response message does not match the content type of the binding (application/soap+xml; charset=utf-8). If using a custom encoder, be sure that the IsContentTypeSupported method is implemented properly. The first 1024 bytes of the response were: '<h1>Error: 500</h1>
<h2>Location: /xml/servlet/twaaserver</h2><b>Internal Servlet Error:</b><br><pre>javax.servlet.ServletException: Warning: can't output text before document element!  Ignoring...
    at processService.doProcess(processService.java:447)
    at processService.run(processService.java:585)
    at twaaserver.doGet(twaaserver.java:429)
    at twaaserver.doPost(twaaserver.java:535)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:405)
    at org.apache.tomcat.core.Handler.service(Handler.java:287)
    at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
    at org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:812)
    at org.apache.tomcat.core.ContextManager.service(ContextManager.java:758)
    at org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpConnectionHandler.java:213)
    at org.apache.tomcat.service.'.
The remote server returned an error: (500) Internal Server Error.
If the service is defined in the current solution, try building the solution and adding the service reference again.
4

2 回答 2

1

您的服务或您如何称呼它似乎有问题。

我通常做的第一件事是验证服务是否按预期工作。获取soapUI导入wsdl 并进行一些示例调用。

如果您没有正确传递参数,有时服务会发疯。如果它不与soapui 合作,请澄清服务供应商的问题。

于 2013-08-03T18:50:19.793 回答
0

你是对的,我发现问题在于 Web 服务不是 SOAP 服务。它是一个 REST 服务。

问题是我试图通过 Visual Studio 工具添加服务引用。这对于我连接的这种类型的服务是不可能的,因为它使用 cXML 并且是一个 REST 服务(它的工作方式非常不同)。

在我的解决方案中,我通过执行简单的 POST 和 GET 请求手动编写 Web 服务 REST 调用,并以字符串格式传入 XML。

这对我有用......我使用了这个教程:https ://developer.yahoo.com/dotnet/howto-rest_cs.html

于 2014-08-07T21:37:56.960 回答