Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

...

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

Constructing request messages

...

Code Block
T invoke(T msg)
 throws WebServiceException;

...

Code Block
// Creating a DOMSource Object for the request
DocumentBuilder db = DocumentBuilderFactory.newDocumentBuilder();
Document requestDoc = db.newDocument();
Element root = requestDoc.createElementNS("http://org.apache.cxf/stockExample",
   "getStockPrice");
root.setNodeValue("DOW");
DOMSource request = new DOMSource(requestDoc);

// Dispatch disp created previously
DOMSource response = disp.invoke(request);

...

Code Block
Response <T> invokeAsync(T msg)
 throws WebServiceException;

...

Code Block
Future<?> invokeAsync(T msg, AsyncHandler<T> handler)
 throws WebServiceException;

...

Code Block
void invokeOneWay(T msg)
 throws WebServiceException;

...

  • The javax.xml.ws.handler.MessageContext.WSDL_OPERATION property of the request context is set with the operation QName.
  • The addressing feature is enabled (in the bus or at the endpoint) and there is a matching operation to the payload element.
  • The "find.dispatch.operation" property of the request context is set to Boolean.TRUE and there is a matching operation to the payload element. This property is not set by default.Determining the correct operation will affect the processing such as setting the correct SOAPAction or WS-Addressing's Action.