I've been having various issues with a rather complex web service that I've been trying to implement with Eclipse, Tomcat 8, and Axis. This is my first experience with web services so I decided to start messing around with something more simple to make sure that I know what I'm doing. This is the WSDL that I'm currently using to generate a service from in Eclipse.
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:tns="http://www.example.org/WeatherService/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
name="WeatherService"
targetNamespace="http://www.example.org/WeatherService/">
<wsdl:types>
<xsd:schema targetNamespace="http://www.example.org/WeatherService/">
<xsd:element name="GetCurrentTemperatureRq">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="city" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="GetCurrentTemperatureRs">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="temperature" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
</wsdl:types>
<wsdl:message name="GetCurrentTemperatureRq">
<wsdl:part element="tns:GetCurrentTemperatureRq" name="parameters"/>
</wsdl:message>
<wsdl:message name="GetCurrentTemperatureRs">
<wsdl:part element="tns:GetCurrentTemperatureRs" name="parameters"/>
</wsdl:message>
<wsdl:portType name="WeatherServicePortType">
<wsdl:operation name="GetCurrentTemperature">
<wsdl:input message="tns:GetCurrentTemperatureRq"/>
<wsdl:output message="tns:GetCurrentTemperatureRs"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="WeatherServiceSOAP" type="tns:WeatherServicePortType">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="GetCurrentTemperature">
<soap:operation soapAction="http://www.example.org/WeatherService/GetCurrentTemperature"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="WeatherService">
<wsdl:port binding="tns:WeatherServiceSOAP" name="WeatherServiceSOAP">
<soap:address location="http://localhost:80/WeatherServiceApp/WeatherService"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
This WSDL is not my own and was taken from a tutorial . I am not strictly following this tutorial as Axis is using wsdl2java for code generation instead of wsimport and I let Eclipse/Axis take care of the web.xml.
I can successfully generate the Web Service and testing using Eclipse's Web Service's Explorer works correctly. My issue is that I want to test this using a generated client instead of just doing it locally to the web service. I generated the web service client and wrote a very simple program inside the client to try and test it.
package client;
import java.rmi.RemoteException;
import org.example.www.WeatherService.*;
public class WeatherServiceClient {
public static void main(String [] args) throws RemoteException {
WeatherServiceSOAPStub stub = new WeatherServiceSOAPStub();
GetCurrentTemperatureRq rq = new GetCurrentTemperatureRq();
stub.getCurrentTemperature(rq);
}
}
Upon running this I get an error.
Nov 19, 2019 11:55:05 AM org.apache.axis.utils.JavaUtils isAttachmentSupported
WARNING: Unable to find required classes (javax.activation.DataHandler and javax.mail.internet.MimeMultipart). Attachment support is disabled.
Exception in thread "main" AxisFault
faultCode: {http://xml.apache.org/axis/}Server.NoEndpoint
faultSubcode:
faultString: No endpoint
faultActor:
faultNode:
faultDetail:
{http://xml.apache.org/axis/}exceptionName:org.apache.axis.NoEndPointException
{http://xml.apache.org/axis/}stackTrace:No endpoint
at org.example.www.WeatherService.WeatherServiceSOAPStub.getCurrentTemperature(WeatherServiceSOAPStub.java:150)
at client.WeatherServiceClient.main(WeatherServiceClient.java:11)
{http://xml.apache.org/axis/}hostname:fake_hostname
No endpoint
at org.example.www.WeatherService.WeatherServiceSOAPStub.getCurrentTemperature(WeatherServiceSOAPStub.java:150)
at client.WeatherServiceClient.main(WeatherServiceClient.java:11)
The main web service is running in Tomcat when I try this.
How do I fix this Endpoint issue? Is there a problem in my WSDL with the address or does soapAction need to be changed?
My issue appears to have been with the WSDL or at least how I generated the client. Instead of generating the Web Service and the Web Service Client simultaneously, I instead just generated the Web Service first and deployed it to Tomcat. It seems that Axis generated a slightly different WSDL that worked for my purpose.
So instead of generating the client based off of the original WSDL, I based it off of the WSDL generated by Axis which was at http://localhost:8080/WeatherService/services/WeatherServiceSOAP?wsdl
in my case.
For those interested, here is the Axis generated WSDL.
<wsdl:definitions xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://www.example.org/WeatherService/" xmlns:intf="http://www.example.org/WeatherService/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.example.org/WeatherService/">
<!--
WSDL created by Apache Axis version: 1.4
Built on Apr 22, 2006 (06:55:48 PDT)
-->
<wsdl:types>
<schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.example.org/WeatherService/">
<element name="GetCurrentTemperatureRq">
<complexType>
<sequence>
<element name="city" type="xsd:string" />
</sequence>
</complexType>
</element>
<element name="GetCurrentTemperatureRs">
<complexType>
<sequence>
<element name="temperature" type="xsd:string" />
</sequence>
</complexType>
</element>
</schema>
</wsdl:types>
<wsdl:message name="GetCurrentTemperatureResponse">
<wsdl:part element="impl:GetCurrentTemperatureRs" name="GetCurrentTemperatureRs"></wsdl:part>
</wsdl:message>
<wsdl:message name="GetCurrentTemperatureRequest">
<wsdl:part element="impl:GetCurrentTemperatureRq" name="GetCurrentTemperatureRq"></wsdl:part>
</wsdl:message>
<wsdl:portType name="WeatherServicePortType">
<wsdl:operation name="GetCurrentTemperature" parameterOrder="GetCurrentTemperatureRq">
<wsdl:input message="impl:GetCurrentTemperatureRequest" name="GetCurrentTemperatureRequest"></wsdl:input>
<wsdl:output message="impl:GetCurrentTemperatureResponse" name="GetCurrentTemperatureResponse"></wsdl:output>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="WeatherServiceSOAPSoapBinding" type="impl:WeatherServicePortType">
<wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
<wsdl:operation name="GetCurrentTemperature">
<wsdlsoap:operation soapAction="http://www.example.org/WeatherService/GetCurrentTemperature" />
<wsdl:input name="GetCurrentTemperatureRequest">
<wsdlsoap:body use="literal" />
</wsdl:input>
<wsdl:output name="GetCurrentTemperatureResponse">
<wsdlsoap:body use="literal" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="WeatherService">
<wsdl:port binding="impl:WeatherServiceSOAPSoapBinding" name="WeatherServiceSOAP">
<wsdlsoap:address location="http://localhost:8080/WeatherService/services/WeatherServiceSOAP" />
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.