Skip to main content

Oneway invocation

When a request does not generate a response, you make remote invocations using the Dispatch object's invokeOneWay() .

void invokeOneWay(T msg)
throws WebServiceException;

The type of object used to package the request is determined when the Dispatch object is created. For example if the Dispatch object is created using createDispatch(portName, DOMSource.class, Service.Mode.PAYLOAD) the request would be packaged into a DOMSource object.

Information noteNote: When using JAXB objects, the response and the request can be of any type the provided JAXBContext object can marshal and unmarshal. Also, the response and the request can be different JAXB objects.

The code below makes a one way invocation on a remote service using a JAXB object.

// Creating a JAXBContext and an Unmarshaller for the request
JAXBContext jbc = JAXBContext.newInstance("org.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);

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 – please let us know!