2013-08-03 81 views
0

我想連接到使用Visual Studio 2010 .NET 4的cXML Web服務,並且當我嘗試使用URL向項目添加服務引用時出現以下錯誤(我隱藏了隱私網址)爲什麼我得到這個錯誤,我怎麼才能連接到網絡服務?...如何在嘗試連接到Web服務時修復此錯誤500?

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

你說得對,我發現問題在於Web服務不是SOAP服務。這是一項REST服務。

問題是我試圖通過Visual Studio工具添加服務引用。對於我所連接的這種服務,這是不可能的,因爲它使用cXML並且是一個REST服務(它的工作原理非常不同)。

在我的解決方案中,我通過執行簡單的POST和GET請求手動編寫Web Service REST調用,並以字符串格式傳遞XML。

這個工作對我來說... 我用這個教程:https://developer.yahoo.com/dotnet/howto-rest_cs.html

1

似乎有什麼問題,你的服務或如何調用它。

我通常做的第一件事是驗證服務是否按預期工作。獲取soapUI導入wsdl並執行一些示例調用。

如果您沒有正確傳遞參數,有時服務會變得瘋狂。如果它不與soapui一起工作,則說明服務供應商出了什麼問題。

相關問題