/** * Add a simple header containing some text to be sent with interactions. * * @param headerName name of header to add * @param headerText text content for header * @throws AxisFault in case of error */ public void addStringHeader(QName headerName, String headerText) throws AxisFault { if (headerName.getNamespaceURI() == null || "".equals(headerName.getNamespaceURI())) { throw new AxisFault( "Failed to add string header, you have to have namespaceURI for the QName"); } OMElement omElement = OMAbstractFactory.getOMFactory().createOMElement(headerName, null); omElement.setText(headerText); addHeader(omElement); }
/** * Add a simple header containing some text to be sent with interactions. * * @param headerName name of header to add * @param headerText text content for header * @throws AxisFault in case of error */ public void addStringHeader(QName headerName, String headerText) throws AxisFault { if (headerName.getNamespaceURI() == null || "".equals(headerName.getNamespaceURI())) { throw new AxisFault( "Failed to add string header, you have to have namespaceURI for the QName"); } OMElement omElement = OMAbstractFactory.getOMFactory().createOMElement(headerName, null); omElement.setText(headerText); addHeader(omElement); }
private void silentAddHeader(final DocumentFragment header, final ServiceClient serviceClient) { final Node node = header.getFirstChild(); if (node instanceof Element) { try { serviceClient.addHeader(XMLUtils.toOM((Element) node)); } catch (final Exception t) { soapContext.getLogger().log(Level.WARNING, "Can't parse the custom additional header and add it to be sent over SOAP", t); } } }
public void publish(String topic, OMElement element) throws AxisFault{ log.debug("published element to "+ topic ); EventBrokerServiceStub service = new EventBrokerServiceStub(configurationContext, brokerUrl+"/publish/"+topic); configureCookie(service._getServiceClient()); ServiceClient serviceClient = service._getServiceClient(); OMElement header = fac.createOMElement(new QName(TOPIC_HEADER_NS, TOPIC_HEADER_NAME)); header.setText(topic); serviceClient.addHeader(header); serviceClient.getOptions().setTo(new EndpointReference(brokerUrl+"/publish")); //serviceClient.getOptions().setTo(new EndpointReference(brokerUrl)); serviceClient.getOptions().setAction("urn:publish"); serviceClient.sendRobust(element); }
public void publish(String topic, OMElement element) throws AxisFault { log.debug("published element to "+ topic ); EventBrokerServiceStub service = new EventBrokerServiceStub(configurationContext, backendUrl +"/publish/"+topic); configureCookie(service._getServiceClient()); ServiceClient serviceClient = service._getServiceClient(); OMElement header = omFactory.createOMElement(new QName(TOPIC_HEADER_NS, TOPIC_HEADER_NAME)); header.setText(topic); serviceClient.addHeader(header); serviceClient.getOptions().setTo(new EndpointReference(backendUrl+"/publish")); //serviceClient.getOptions().setTo(new EndpointReference(brokerUrl)); serviceClient.getOptions().setAction("urn:publish"); serviceClient.sendRobust(element); }
public void publish(String topic, OMElement element) throws AxisFault { log.debug("published element to "+ topic ); EventBrokerServiceStub service = new EventBrokerServiceStub(configurationContext, backendUrl +"/publish/"+topic); configureCookie(service._getServiceClient()); ServiceClient serviceClient = service._getServiceClient(); OMElement header = omFactory.createOMElement(new QName(TOPIC_HEADER_NS, TOPIC_HEADER_NAME)); header.setText(topic); serviceClient.addHeader(header); serviceClient.getOptions().setTo(new EndpointReference(backendUrl+"/publish")); //serviceClient.getOptions().setTo(new EndpointReference(brokerUrl)); serviceClient.getOptions().setAction("urn:publish"); serviceClient.sendRobust(element); }
protected void sendNotification(OMElement topicHeader, OMElement tenantDomainHeader, OMElement payload, String endpoint) throws AxisFault { // The parameter args is used as a mechanism to pass any argument into this method, which // is used by the implementations that extend the behavior of the default Carbon Event // Dispatcher. ServiceClient serviceClient = new ServiceClient(); Options options = new Options(); options.setTo(new EndpointReference(endpoint)); options.setAction(EventingConstants.WSE_PUBLISH); serviceClient.setOptions(options); serviceClient.addHeader(topicHeader); if (tenantDomainHeader != null){ serviceClient.addHeader(tenantDomainHeader); } serviceClient.fireAndForget(payload); }
public void unsubscribe(String subscriptionID) throws RemoteException{ log.debug("Unsubscribed to "+ subscriptionID); EventBrokerServiceStub service = new EventBrokerServiceStub(configurationContext, brokerUrl); configureCookie(service._getServiceClient()); ServiceClient serviceClient = service._getServiceClient(); OMElement header = fac.createOMElement(new QName(WSE_EVENTING_NS, WSE_EN_IDENTIFIER)); header.setText(subscriptionID); serviceClient.addHeader(header); service.unsubscribe(new OMElement[]{}); }
public void unsubscribe(String subscriptionID) throws RemoteException { log.debug("Unsubscribed to "+ subscriptionID); EventBrokerServiceStub service = new EventBrokerServiceStub(configurationContext, backendUrl); configureCookie(service._getServiceClient()); ServiceClient serviceClient = service._getServiceClient(); OMElement header = omFactory.createOMElement(new QName(WSE_EVENTING_NS, WSE_EN_IDENTIFIER)); header.setText(subscriptionID); serviceClient.addHeader(header); service.unsubscribe(new OMElement[]{}); }
public void unsubscribe(String subscriptionID) throws RemoteException { log.debug("Unsubscribed to "+ subscriptionID); EventBrokerServiceStub service = new EventBrokerServiceStub(configurationContext, backendUrl); configureCookie(service._getServiceClient()); ServiceClient serviceClient = service._getServiceClient(); OMElement header = omFactory.createOMElement(new QName(WSE_EVENTING_NS, WSE_EN_IDENTIFIER)); header.setText(subscriptionID); serviceClient.addHeader(header); service.unsubscribe(new OMElement[]{}); }
public static void setHeaders(String soapAction, String destination, ServiceClient client, OMElement... customHeaders) throws AxisFault { SOAPFactory soapfactory = OMAbstractFactory.getSOAP11Factory(); SOAPHeaderBlock msgId = soapfactory.createSOAPHeaderBlock("MessageID", NameSpaceConstants.WSA_NS); msgId.setText(UUIDGenerator.getUUID()); SOAPHeaderBlock to = soapfactory.createSOAPHeaderBlock("To", NameSpaceConstants.WSA_NS); to.setText(destination); SOAPHeaderBlock action = soapfactory.createSOAPHeaderBlock("Action", NameSpaceConstants.WSA_NS); action.setText(soapAction); client.addHeader(action); client.addHeader(msgId); client.addHeader(to); for (OMElement h : customHeaders) { try { client.addHeader(org.apache.axiom.om.util.ElementHelper.toSOAPHeaderBlock(h, soapfactory)); } catch (Exception e) { throw AxisFault.makeFault(e); } } } }
public void renewSubscription(String subscriptionID, long time) throws RemoteException{ log.debug("Renewed subscription "+ subscriptionID + " " + time); EventBrokerServiceStub service = new EventBrokerServiceStub(configurationContext, brokerUrl); configureCookie(service._getServiceClient()); ServiceClient serviceClient = service._getServiceClient(); OMElement header = fac.createOMElement(new QName(WSE_EVENTING_NS, WSE_EN_IDENTIFIER)); header.setText(subscriptionID); serviceClient.addHeader(header); Calendar calendar = new GregorianCalendar(); calendar.setTimeInMillis(time); ExpirationType expirationType = new ExpirationType(); expirationType.setObject(calendar); RenewResponse renewOp = service.renewOp(expirationType, null); //TODO I think there is nothing to do with renewOp response }
public static void setHeaders(String soapAction, String destination, ServiceClient client, OMElement... customHeaders) throws AxisFault { SOAPFactory soapfactory = OMAbstractFactory.getSOAP11Factory(); SOAPHeaderBlock msgId = soapfactory.createSOAPHeaderBlock("MessageID", NameSpaceConstants.WSA_NS); msgId.setText(UUIDGenerator.getUUID()); SOAPHeaderBlock to = soapfactory.createSOAPHeaderBlock("To", NameSpaceConstants.WSA_NS); to.setText(destination); SOAPHeaderBlock action = soapfactory.createSOAPHeaderBlock("Action", NameSpaceConstants.WSA_NS); action.setText(soapAction); client.addHeader(action); client.addHeader(msgId); client.addHeader(to); for (OMElement h : customHeaders) { try { client.addHeader(org.apache.axiom.om.util.ElementHelper.toSOAPHeaderBlock(h, soapfactory)); } catch (Exception e) { throw AxisFault.makeFault(e); } } } }
protected void sendNotification(OMElement topicHeader, OMElement payload, String endpoint) throws AxisFault { // The parameter args is used as a mechanism to pass any argument into this method, which // is used by the implementations that extend the behavior of the default Carbon Event // Dispatcher. ServiceClient serviceClient = new ServiceClient(); Options options = new Options(); options.setTo(new EndpointReference(endpoint)); options.setAction(EventingConstants.WSE_PUBLISH); serviceClient.setOptions(options); serviceClient.addHeader(topicHeader); serviceClient.fireAndForget(payload); } }
protected void sendNotification(OMElement topicHeader, OMElement payload, String endpoint) throws AxisFault { // The parameter args is used as a mechanism to pass any argument into this method, which // is used by the implementations that extend the behavior of the default Carbon Event // Dispatcher. ServiceClient serviceClient = new ServiceClient(); Options options = new Options(); options.setTo(new EndpointReference(endpoint)); options.setAction(EventingConstants.WSE_PUBLISH); serviceClient.setOptions(options); serviceClient.addHeader(topicHeader); serviceClient.fireAndForget(payload); } }
public void setClientSessionID(String id) { SOAPFactory soapFactory = OMAbstractFactory.getSOAP12Factory(); OMNamespace synNamespace = soapFactory. createOMNamespace("http://ws.apache.org/namespaces/synapse", "syn"); SOAPHeaderBlock header = soapFactory.createSOAPHeaderBlock("ClientID", synNamespace); header.setText(id); client.addHeader(header); }
public void setClientSessionID(String id) { SOAPFactory soapFactory = OMAbstractFactory.getSOAP12Factory(); OMNamespace synNamespace = soapFactory. createOMNamespace("http://ws.apache.org/namespaces/synapse", "syn"); SOAPHeaderBlock header = soapFactory.createSOAPHeaderBlock("ClientID", synNamespace); header.setText(id); client.addHeader(header); }
public void setClientSessionID(String id) { SOAPFactory soapFactory = OMAbstractFactory.getSOAP12Factory(); OMNamespace synNamespace = soapFactory. createOMNamespace("http://ws.apache.org/namespaces/synapse", "syn"); SOAPHeaderBlock header = soapFactory.createSOAPHeaderBlock("ClientID", synNamespace); header.setText(id); client.addHeader(header); }
private ServiceClient createServiceClient(OMElement message) throws AxisFault { String uuid = UUIDGenerator.getUUID(); ServiceClient client = new ServiceClient(); if (client.getAxisConfiguration().getModule(WsmgCommonConstants.AXIS_MODULE_NAME_ADDRESSING) != null) { client.engageModule(WsmgCommonConstants.AXIS_MODULE_NAME_ADDRESSING); } else { SOAPHeaderBlock msgId = soapfactory.createSOAPHeaderBlock("MessageID", NameSpaceConstants.WSA_NS); msgId.setText(uuid); SOAPHeaderBlock to = soapfactory.createSOAPHeaderBlock("To", NameSpaceConstants.WSA_NS); to.setText(opts.getTo().getAddress()); SOAPHeaderBlock action = soapfactory.createSOAPHeaderBlock("Action", NameSpaceConstants.WSA_NS); action.setText(message.getNamespace().getNamespaceURI() + "/" + message.getLocalName()); client.addHeader(action); client.addHeader(msgId); client.addHeader(to); } opts.setMessageId(uuid); opts.setAction(message.getNamespace().getNamespaceURI() + "/" + message.getLocalName()); opts.setProperty(org.apache.axis2.transport.http.HTTPConstants.CHUNKED, Boolean.FALSE); opts.setTimeOutInMilliSeconds(getTimeoutInMilliSeconds()); client.setOptions(opts); return client; }
private void launchWorkflow(String experimentId, String workflowGraph, NameValue[] inputs, WorkflowContextHeaderBuilder builder) throws AiravataAPIInvocationException { try { builder.getWorkflowMonitoringContext().setExperimentId(experimentId); WorkflowInterpretorStub stub = new WorkflowInterpretorStub(getClient().getAiravataManager().getWorkflowInterpreterServiceURL().toString()); OMElement wchOMElement = AXIOMUtil.stringToOM(XMLUtil.xmlElementToString(builder .getXml())); wchOMElement.addAttribute("submissionUser", builder.getSubmissionUser(), wchOMElement.getNamespace()); stub._getServiceClient().addHeader( wchOMElement); stub.launchWorkflow(workflowGraph, experimentId, inputs); } catch (AxisFault e) { e.printStackTrace(); } catch (XMLStreamException e) { e.printStackTrace(); } catch (RemoteException e) { e.printStackTrace(); } }