FileDocCategorySizeDatePackage
PingProvider.javaAPI DocExample4285Tue May 29 16:58:10 BST 2007wsrm.dispatch.server

PingProvider

public class PingProvider extends Object implements Provider

Fields Summary
private static final String
helloResponse
Constructors Summary
Methods Summary
private java.lang.StringgetSOAPMessageAsString(javax.xml.soap.SOAPMessage msg)

	ByteArrayOutputStream baos = null;
	String s = null;
        try {
	    baos = new ByteArrayOutputStream();
            msg.writeTo(baos);
	    s = baos.toString();
        } catch(Exception e) {
            e.printStackTrace();
        }
	return s;
    
public javax.xml.soap.SOAPMessageinvoke(javax.xml.soap.SOAPMessage req)


         
	System.out.println("invoke: Request: " + getSOAPMessageAsString(req));
        SOAPMessage res = null;
	try {
            res = makeSOAPMessage(helloResponse);
	} catch (Exception e) {
	    System.out.println("Exception: occurred " + e);
	}
	System.out.println("invoke: Response: " + getSOAPMessageAsString(res));
        return res;
    
private javax.xml.soap.SOAPMessagemakeSOAPMessage(java.lang.String msg)

	try {
            MessageFactory factory = MessageFactory.newInstance();
            SOAPMessage message = factory.createMessage();
            message.getSOAPPart().setContent((Source)new StreamSource(new StringReader(msg)));
            message.saveChanges();
            return message;
	}
	catch (Exception e) {
	    return null;
	}