Creating a Dispatch object - 7.3

Talend ESB Service Developer Guide

Version
7.3
Language
English
Product
Talend Data Fabric
Talend Data Services Platform
Talend ESB
Talend MDM Platform
Talend Open Studio for ESB
Talend Real-Time Big Data Platform
Module
Talend ESB
Talend Runtime
Content
Design and Development
Installation and Upgrade
Last publication date
2023-04-17

About this task

To create a Dispatch object do the following:

Procedure

  1. Create a Service object to represent the wsdl:service element defining the service on which the Dispatch object will make invocations.
  2. Create the Dispatch object using the Service object's createDispatch() method.
    public Dispatch<T> createDispatch(QName portName, 
       java.lang.Class<T> type, Service.Mode mode) throws WebServiceException;
    Note:

    If you are using JAXB objects the method signature for createDispatch() is:

    public Dispatch<T> createDispatch(QName portName, 
       javax.xml.bind.JAXBContext context, Service.Mode mode)
       throws WebServiceException;

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);
   ...
  }
}