【问题标题】:Error in Web Service created by EclipseEclipse 创建的 Web 服务中的错误
【发布时间】:2012-02-28 16:54:51
【问题描述】:

我在使用 Axis 1.4 测试 exlipse 创建的 Web 服务时遇到此错误

- <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"     xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <soapenv:Body>
- <soapenv:Fault>
<faultcode>soapenv:Server.userException</faultcode> 
<faultstring>java.lang.reflect.InvocationTargetException</faultstring> 
- <detail>
 <ns1:hostname xmlns:ns1="http://xml.apache.org/axis/">ahernandez-PC</ns1:hostname> 
 </detail>
 </soapenv:Fault>
 </soapenv:Body>
</soapenv:Envelope>

存在错误的文件(我相信至少如此)是这个:

<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions targetNamespace="http://cancelaciones.vital" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://cancelaciones.vital" xmlns:intf="http://cancelaciones.vital" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<!--WSDL created by Apache Axis version: 1.4
Built on Apr 22, 2006 (06:55:48 PDT)-->
 <wsdl:types>
  <schema elementFormDefault="qualified" targetNamespace="http://cancelaciones.vital" xmlns="http://www.w3.org/2001/XMLSchema">
   <element name="sellado">
    <complexType>
     <sequence>
      <element name="llave" type="xsd:string"/>
      <element name="certificado" type="xsd:string"/>
      <element name="xmlString" type="xsd:string"/>
     </sequence>
    </complexType>
   </element>
   <element name="selladoResponse">
    <complexType>
     <sequence>
      <element name="selladoReturn" type="xsd:string"/>
     </sequence>
    </complexType>
   </element>
  </schema>
 </wsdl:types>

   <wsdl:message name="selladoRequest">

      <wsdl:part element="impl:sellado" name="parameters">

      </wsdl:part>

   </wsdl:message>

   <wsdl:message name="selladoResponse">

      <wsdl:part element="impl:selladoResponse" name="parameters">

      </wsdl:part>

   </wsdl:message>

   <wsdl:portType name="Cancelacion">

      <wsdl:operation name="sellado">

         <wsdl:input message="impl:selladoRequest" name="selladoRequest">

       </wsdl:input>

         <wsdl:output message="impl:selladoResponse" name="selladoResponse">

       </wsdl:output>

      </wsdl:operation>

   </wsdl:portType>

   <wsdl:binding name="CancelacionSoapBinding" type="impl:Cancelacion">

      <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>

      <wsdl:operation name="sellado">

         <wsdlsoap:operation soapAction=""/>

         <wsdl:input name="selladoRequest">

            <wsdlsoap:body use="literal"/>

         </wsdl:input>

         <wsdl:output name="selladoResponse">

            <wsdlsoap:body use="literal"/>

         </wsdl:output>

      </wsdl:operation>

   </wsdl:binding>

   <wsdl:service name="CancelacionService">

      <wsdl:port binding="impl:CancelacionSoapBinding" name="Cancelacion">

         <wsdlsoap:address location="http://localhost:8080/CancelacionesWS/services/Cancelacion"/>

      </wsdl:port>

   </wsdl:service>

</wsdl:definitions>

web.xml 文件

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" version="3.0">
  <display-name>CanelacionesWeb</display-name>
  <welcome-file-list>
    <welcome-file>index.html</welcome-file>
    <welcome-file>index.htm</welcome-file>
    <welcome-file>index.jsp</welcome-file>
    <welcome-file>default.html</welcome-file>
    <welcome-file>default.htm</welcome-file>
    <welcome-file>default.jsp</welcome-file>
  </welcome-file-list>
  <servlet>
    <display-name>Apache-Axis Servlet</display-name>
    <servlet-name>AxisServlet</servlet-name>
    <servlet-class>org.apache.axis.transport.http.AxisServlet</servlet-class>
  </servlet>
  <servlet-mapping>
    <servlet-name>AxisServlet</servlet-name>
    <url-pattern>/servlet/AxisServlet</url-pattern>
  </servlet-mapping>
  <servlet-mapping>
    <servlet-name>AxisServlet</servlet-name>
    <url-pattern>*.jws</url-pattern>
  </servlet-mapping>
  <servlet-mapping>
    <servlet-name>AxisServlet</servlet-name>
    <url-pattern>/services/*</url-pattern>
  </servlet-mapping>
  <servlet>
    <display-name>Axis Admin Servlet</display-name>
    <servlet-name>AdminServlet</servlet-name>
    <servlet-class>org.apache.axis.transport.http.AdminServlet</servlet-class>
    <load-on-startup>100</load-on-startup>
  </servlet>
  <servlet-mapping>
    <servlet-name>AdminServlet</servlet-name>
    <url-pattern>/servlet/AdminServlet</url-pattern>
  </servlet-mapping>
</web-app>

【问题讨论】:

  • 添加或链接到整个跟踪,而不仅仅是您认为显示错误的行。
  • 我编辑了它,以显示完整的错误日志,我现在得到一个不同的错误但是我仍然迷路了。
  • InvocationTargetException: 服务 URL 错误或无响应
  • 我编辑并包含了 wsdl,我不确定哪个 URL 可能是错误的。
  • 请求的 URL。您如何尝试使用 Web 服务? (代码,请)

标签: java eclipse web-services axis


【解决方案1】:

看起来很像您有一个 WSDL 文件,可以让您了解操作,但您应该提供服务的实际服务器已关闭。检查服务是否可用

【讨论】:

【解决方案2】:

可能是 web.xml 文件中缺少配置导致的异常原因。首先,WSDL 搜索 web.xml 中的配置以及您作为 SOAP 服务生成的 .wsdl 文件。如果不匹配,可能会抛出 InvocationTargetException。

【讨论】:

  • 我包含了 web.xml,我不确定是否缺少任何条目。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-12-30
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多