THIS IS A TEST INSTANCE. ALL YOUR CHANGES WILL BE LOST!!!!
...
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 |
---|
// Creating a JAXBContext and an Unmarshaller for the request JAXBContext jbc = JAXBContext.newInstance("com.mycompany.StockExample"); Unmarshaller u = jbc.createUnmarshaller(); // Read the request from disk File rf = new File("request.xml"); GetStockPrice request = (GetStockPrice)u.unmarshal(rf); // Dispatch disp created previously disp.invokeOneWay(request); |
Operation Determination
When using a Dispatch
client with a WSDL file, the operation name will be set under one of the following cases.
- 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.