Creating a Dispatch object
About this task
To create a Dispatch object do the following:
Procedure
Results
The following table describes the parameters for createDispatch() .
Parameter |
Description |
---|---|
portName |
Specifies the QName of the wsdl:port element that represent the service provider on which the Dispatch object will make invocations. |
type |
Specifies the data type of the objects used by the Dispatch object. |
mode |
Specifies the usage mode for the Dispatch object. |
The code below creates a Dispatch object that works with DOMSource objects in payload mode.
package com.mycompany.demo;
import javax.xml.namespace.QName;
import javax.xml.ws.Service;
public class Client {
public static void main(String args[]) {
QName serviceName = new QName("http://org.apache.cxf",
"stockQuoteReporter");
Service s = Service.create(serviceName);
QName portName = new QName("http://org.apache.cxf",
"stockQuoteReporterPort");
Dispatch<DOMSource> dispatch = s.createDispatch(portName,
DOMSource.class,
Service.Mode.PAYLOAD);
...
}
}