我正在尝试使用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.
答案 0 :(得分:1)
您的服务似乎有问题,或者您如何称呼它。
我通常做的第一件事是验证服务是否按预期工作。获取soapUI导入wsdl并进行一些示例调用。
如果您没有正确传递参数,有时服务会变得疯狂。如果它不能与soapui合作澄清服务供应商的问题。
答案 1 :(得分:0)
你是对的,我发现问题在于Web服务不是SOAP服务。它是一个REST服务。
问题是我试图通过Visual Studio工具添加服务引用。这是我连接的这种类型的服务无法实现的,因为它使用cXML并且是一种REST服务(它的工作方式非常不同)。
在我的解决方案中,我通过执行简单的POST和GET请求手动编写Web Service REST调用,并以字符串格式传入XML。
这对我有用...... 我使用了本教程:https://developer.yahoo.com/dotnet/howto-rest_cs.html