我开始学习Web服务。我从书中给出的例子中写了我的第一段代码。但是当我运行它时,它并不像它应该的那样!我看到生成的wsdl文件并看到错误:
我的WSDL文件是:
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions targetNamespace="http://ts.ch01" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://ts.ch01" xmlns:intf="http://ts.ch01" 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://ts.ch01" xmlns="http://www.w3.org/2001/XMLSchema">
<element name="getTimeAsString">
<complexType/>
</element>
<element name="getTimeAsStringResponse">
<complexType>
<sequence>
<element name="getTimeAsStringReturn" type="xsd:string"/>
</sequence>
</complexType>
</element>
<element name="getTimeAsElapsed">
<complexType/>
</element>
<element name="getTimeAsElapsedResponse">
<complexType>
<sequence>
<element name="getTimeAsElapsedReturn" type="xsd:long"/>
</sequence>
</complexType>
</element>
</schema>
</wsdl:types>
<wsdl:message name="getTimeAsStringResponse">
<wsdl:part element="impl:getTimeAsStringResponse" name="parameters">
</wsdl:part>
</wsdl:message>
<wsdl:message name="getTimeAsElapsedResponse">
<wsdl:part element="impl:getTimeAsElapsedResponse" name="parameters">
</wsdl:part>
</wsdl:message>
<wsdl:message name="getTimeAsElapsedRequest">
<wsdl:part element="impl:getTimeAsElapsed" name="parameters">
</wsdl:part>
</wsdl:message>
<wsdl:message name="getTimeAsStringRequest">
<wsdl:part element="impl:getTimeAsString" name="parameters">
</wsdl:part>
</wsdl:message>
<wsdl:portType name="WSNewTestImpl">
<wsdl:operation name="getTimeAsString">
<wsdl:input message="impl:getTimeAsStringRequest" name="getTimeAsStringRequest">
</wsdl:input>
<wsdl:output message="impl:getTimeAsStringResponse" name="getTimeAsStringResponse">
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="getTimeAsElapsed">
<wsdl:input message="impl:getTimeAsElapsedRequest" name="getTimeAsElapsedRequest">
</wsdl:input>
<wsdl:output message="impl:getTimeAsElapsedResponse" name="getTimeAsElapsedResponse">
</wsdl:output>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="WSNewTestImplSoapBinding" type="impl:WSNewTestImpl">
<wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="getTimeAsString">
<wsdlsoap:operation soapAction=""/>
<wsdl:input name="getTimeAsStringRequest">
<wsdlsoap:body use="literal"/>
</wsdl:input>
<wsdl:output name="getTimeAsStringResponse">
<wsdlsoap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="getTimeAsElapsed">
<wsdlsoap:operation soapAction=""/>
<wsdl:input name="getTimeAsElapsedRequest">
<wsdlsoap:body use="literal"/>
</wsdl:input>
<wsdl:output name="getTimeAsElapsedResponse">
<wsdlsoap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="WSNewTestImplService">
<wsdl:port binding="impl:WSNewTestImplSoapBinding" name="WSNewTestImpl">
<wsdlsoap:address location="http://localhost:9090/WSTestOther/services/WSNewTestImpl"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
我不知道提供什么其他信息,如果您需要任何问题。我正在使用Tomcat 7.0
我也在控制台中看到错误:
[ERROR] The endpoint reference (EPR) for the Operation not found is /WSTestOther/services/WSNewTestImplService and the WSA Action = null. If this EPR was previously reachable, please contact the server administrator.
org.apache.axis2.AxisFault: The endpoint reference (EPR) for the Operation not found is /WSTestOther/services/WSNewTestImplService and the WSA Action = null. If this EPR was previously reachable, please contact the server administrator.
at org.apache.axis2.engine.DispatchPhase.checkPostConditions(DispatchPhase.java:102)
at org.apache.axis2.engine.Phase.invoke(Phase.java:329)
at org.apache.axis2.engine.AxisEngine.invoke(AxisEngine.java:262)
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:168)
at org.apache.axis2.transport.http.util.RESTUtil.invokeAxisEngine(RESTUtil.java:144)
at org.apache.axis2.transport.http.util.RESTUtil.processURLRequest(RESTUtil.java:139)
at org.apache.axis2.transport.http.AxisServlet$RestRequestProcessor.processURLRequest(AxisServlet.java:837)
at org.apache.axis2.transport.http.AxisServlet.doGet(AxisServlet.java:273)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1023)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:310)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
at java.lang.Thread.run(Thread.java:662)
[WARN] Deprecated usage of OMElement#declareNamespace(String,String) with empty prefix