Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/entity-framework/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 在尝试连接到web服务时,如何修复此错误?_Java_Xml_Apache_Servlets_Cxml - Fatal编程技术网

Java 在尝试连接到web服务时,如何修复此错误?

Java 在尝试连接到web服务时,如何修复此错误?,java,xml,apache,servlets,cxml,Java,Xml,Apache,Servlets,Cxml,我正在尝试使用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: --

我正在尝试使用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.
下载时出错'http://00.00.00.00:8080/xml/servlet/twaaserver?svcname=x10h015'
请求失败,出现错误消息:
--
误差:500
位置:/xml/servlet/twaaServer内部servlet错误:
javax.servlet.ServletException 在processService.doProcess(processService.java:447) 运行(processService.java:585) 在twaaserver.doGet(twaaserver.java:429) 位于javax.servlet.http.HttpServlet.service(HttpServlet.java:740) 位于javax.servlet.http.HttpServlet.service(HttpServlet.java:853) 位于org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:405) 位于org.apache.tomcat.core.Handler.service(Handler.java:287) 位于org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372) 位于org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:812) 位于org.apache.tomcat.core.ContextManager.service(ContextManager.java:758) 位于org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpConnectionHandler.java:213) 位于org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416) 位于org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:501) 运行(Thread.java:534) 根本原因: java.lang.NullPointerException 在eboservice.transformDataFeeds(eboservice.java:982) 在processService.doProcess(processService.java:279) 运行(processService.java:585) 在twaaserver.doGet(twaaserver.java:429) 位于javax.servlet.http.HttpServlet.service(HttpServlet.java:740) 位于javax.servlet.http.HttpServlet.service(HttpServlet.java:853) 位于org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:405) 位于org.apache.tomcat.core.Handler.service(Handler.java:287) 位于org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372) 位于org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:812) 位于org.apache.tomcat.core.ContextManager.service(ContextManager.java:758) 位于org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpConnectionHandler.java:213) 位于org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416) 位于org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:501) 运行(Thread.java:534) --. 元数据包含无法解析的引用:'http://00.00.00.00:8080/xml/servlet/twaaserver?svcname=x10h015'. 响应消息的内容类型text/html与绑定的内容类型不匹配(application/soap+xml;charset=utf-8)。如果使用自定义编码器,请确保正确实现IsContentTypeSupported方法。响应的前1024个字节是:“错误:500” 位置:/xml/servlet/twaaserverInternal servlet错误:
javax.servlet.ServletException:警告:无法在文档元素之前输出文本!忽略。。。 在processService.doProcess(processService.java:447) 运行(processService.java:585) 在twaaserver.doGet(twaaserver.java:429) 在twaaserver.doPost(twaaserver.java:535) 位于javax.servlet.http.HttpServlet.service(HttpServlet.java:760) 位于javax.servlet.http.HttpServlet.service(HttpServlet.java:853) 位于org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:405) 位于org.apache.tomcat.core.Handler.service(Handler.java:287) 位于org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372) 位于org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:812) 位于org.apache.tomcat.core.ContextManager.service(ContextManager.java:758) 位于org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpConnectionHandler.java:213) 在org.apache.tomcat.service上。 远程服务器返回错误:(500)内部服务器错误。 如果服务是在当前解决方案中定义的,请尝试构建解决方案并再次添加服务引用。
您的服务或您如何称呼它似乎有问题

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


如果没有正确传递参数,有时服务会变得疯狂。如果它不使用soapui,请澄清服务供应商的问题。

你是对的,我发现问题在于web服务不是SOAP服务。这是一项休息服务

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

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

这对我有用。。。 我使用了本教程: