Skip to main content

Generated service class

The next example shows the typical outline a generated service class, ServiceName , which extends the javax.xml.ws.Service base class.

Outline of a Generated Service Class

public class ServiceName extends javax.xml.ws.Service {
   ...
   public ServiceName(URL wsdlLocation, QName serviceName) { } 
   public ServiceName() { }
   public Greeter getPortName() { }
   ...
}

The ServiceName class above defines the following methods:

  • Constructor methods - the following forms of constructor are defined:

    • ServiceName(URL wsdlLocation, QName serviceName) constructs a service object based on the data in the serviceName service in the WSDL contract that is obtainable from wsdlLocation .

    • ServiceName() is the default constructor, which constructs a service object based on the service name and WSDL contract that were provided at the time the stub code was generated (for example, when running the CXF wsdl2java command). Using this constructor presupposes that the WSDL contract remains available at its original location.

  • get_PortName_() methods - for every PortName port defined on the ServiceName service, CXF generates a corresponding get_PortName_() method in Java. Therefore, a wsdl:service element that defines multiple ports will generate a service class with multiple get_PortName_() methods.

Did this page help you?

If you find any issues with this page or its content – a typo, a missing step, or a technical error – let us know how we can improve!