Java Reference
In-Depth Information
/**
* Demonstrates simple Provider.
*/
@WebServiceProvider(
serviceName="GatewayService",
portName="GatewayPort",
targetNamespace="http://ns.soacookbook.com/gateway",
wsdlLocation="WEB-INF/wsdl/Gateway.wsdl")
@ServiceMode(Mode.MESSAGE)
public class MyProvider implements Provider<SOAPMessage> {
private static final Logger LOGGER =
Logger.getLogger(MyProvider.class);
public MyProvider() {
LOGGER.debug("Created provider instance.");
}
public SOAPMessage invoke(SOAPMessage request) {
SOAPMessage response = null;
try {
LOGGER.debug("Received request:\n");
//Dump request to console
request.writeTo(System.out);
LOGGER.debug("Building SOAP Response.");
String user = request.getSOAPBody().getTextContent();
response = createResponse(user);
} catch (SOAPException ex) {
ex.printStackTrace();
} catch (IOException ex) {
ex.printStackTrace();
}
return response;
}
public SOAPMessage createResponse(String user)
throws SOAPException, IOException {
LOGGER.debug("Creating SOAP Response for user: " + user);
//Create a response message
MessageFactory mf = MessageFactory.newInstance();
Search WWH ::




Custom Search