*/
public class NotifRequestUtils
{
public static XmlObject sendRequest(XmlObject requestDoc, String action, EndpointReference epr)
{
EnvelopeDocument requestEnvelopeDoc = createEnvelope();
Envelope requestEnvelope = requestEnvelopeDoc.getEnvelope();
addAddressingHeaders(requestEnvelope.getHeader(), action, epr);
XmlBeanUtils.addChildElement(requestEnvelope.getBody(), requestDoc);
try
{
URL endpointURL = new URL(epr.getAddress());
System.out.println("Sending Request to " + endpointURL.toString());
URI actionURI = new URI(action);
String response = SoapClient.sendRequest(endpointURL, requestEnvelopeDoc.newInputStream(), actionURI);
EnvelopeDocument responseEnvelopeDoc = (EnvelopeDocument) XmlObject.Factory.parse(response);
Envelope responseEnvelope = responseEnvelopeDoc.getEnvelope();
XmlObject[] responseBodyElems = XmlBeanUtils.getChildElements(responseEnvelope.getBody());
System.out.println("Recieved response from " + endpointURL.toString());
if (responseBodyElems.length == 0)
{
return null;