【发布时间】: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