/** * Directly invoke an anonymous operation with a Robust In-Only MEP. This method just sends your * supplied XML and possibly receives a fault. For more control, you can instead create a client * for the operation and use that client to execute the send. * * @param elem XML to send * @throws AxisFault if something goes wrong while sending, or if a fault is received in * response (per the Robust In-Only MEP). * @see #createClient(QName) */ public void sendRobust(OMElement elem) throws AxisFault { sendRobust(ANON_ROBUST_OUT_ONLY_OP, elem); }
/** * Directly invoke an anonymous operation with a Robust In-Only MEP. This method just sends your * supplied XML and possibly receives a fault. For more control, you can instead create a client * for the operation and use that client to execute the send. * * @param elem XML to send * @throws AxisFault if something goes wrong while sending, or if a fault is received in * response (per the Robust In-Only MEP). * @see #createClient(QName) */ public void sendRobust(OMElement elem) throws AxisFault { sendRobust(ANON_ROBUST_OUT_ONLY_OP, elem); }
public void invokeRobust(QName opName, Object [] args) throws AxisFault { OMElement omElement = BeanUtil.getOMElement(opName, args, null, false, null); //call the underline implementation if (notNullService) { super.sendRobust(opName, omElement); } else { super.sendRobust(omElement); } } }
public void invokeRobust(QName opName, Object [] args) throws AxisFault { OMElement omElement = BeanUtil.getOMElement(opName, args, null, false, null); //call the underline implementation if (notNullService) { super.sendRobust(opName, omElement); } else { super.sendRobust(omElement); } } }
@Override public void run() { try { // Create a service client ServiceClient client = new ServiceClient(); // Set the endpoint address client.getOptions().setTo( new EndpointReference(endPointReferance)); // Make the request client.sendRobust(payload); isWSSuccessful = true; } catch (AxisFault e) { log.error(e.getMessage(), e); } } });
public void sendRobust(String userName, String password, String endpointReference, String operation, OMElement payload, String securityPolicyPath, String userCertAlias, String encryptionUser, String keyStorePath, String keyStorePassword) throws FileNotFoundException, AxisFault, XMLStreamException { ServiceClient sc = getServiceClient(userName, password, endpointReference, operation, securityPolicyPath, userCertAlias, encryptionUser, keyStorePath, keyStorePassword); if (log.isDebugEnabled()) { log.debug("payload :" + payload); log.debug("Security Policy Path :" + securityPolicyPath); log.debug("Operation :" + operation); log.debug("username :" + userName); log.debug("password :" + password); } log.info("Endpoint reference :" + endpointReference); try { sc.sendRobust(payload); } catch (AxisFault axisFault) { log.error("AxisFault : " + axisFault.getMessage()); throw axisFault; } finally { sc.cleanupTransport(); } }
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, 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); }
/** * Publishes a message to a topic. The message should be XML structured. * * @param topic The name of the topic which the message should be published. * @param messageContent The message content. * @throws BrokerClientException */ public void publish(String topic, String messageContent) throws BrokerClientException { try { StAXOMBuilder builder = new StAXOMBuilder(new ByteArrayInputStream(messageContent.getBytes())); OMElement message = builder.getDocumentElement(); 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().setAction("urn:publish"); serviceClient.sendRobust(message); } catch (XMLStreamException e) { throw new BrokerClientException("Unable to convert message to OMElement. Make sure the message is an XML " + "message. :" + e.getMessage(), e); } catch (AxisFault e) { throw new BrokerClientException("Error while publishing message : " + e.getMessage(), e); } }
public void sendRobust(String userName, String password, String endpointReference, String operation, OMElement payload, int securityScenarioNo) throws AxisFault, XPathExpressionException, FileNotFoundException, XMLStreamException { if (securityScenarioNo == 1) { Assert.assertTrue(endpointReference.startsWith("https:"), "Endpoint reference should be https"); } AutomationContext autoContext = new AutomationContext(); String keyPath = FrameworkPathUtil.getSystemResourceLocation() + File.separator + autoContext.getConfigurationValue("//keystore/fileName/text()"); String securityPolicyPath = FrameworkPathUtil.getSystemResourceLocation() + File.separator + "security" + File.separator + "policies" + File.separator + "scenario" + securityScenarioNo + "-policy.xml"; ServiceClient sc = getServiceClient(userName, password, endpointReference, operation, securityPolicyPath, "wso2carbon", "wso2carbon", keyPath, "wso2carbon"); try { sc.sendRobust(payload); log.info("Request Sent"); } finally { sc.cleanupTransport(); } }
@Override public void execute() { try { OMElement payload = this.extractInputPayload(); if (SERVICE_MEP_IN_OUT.equals(this.getServiceMEP())) { OMElement data = this.getServiceClient().sendReceive(payload); if (this.getServicePayloadHandler() != null) { this.getServicePayloadHandler().handleServiceResult(this, data); } } else { this.getServiceClient().sendRobust(payload); } this.taskCount++; } catch (Exception e) { log.error("Error in executing web service call task: " + e.getMessage(), e); } }
option.setProperty(HTTPConstants.REUSE_HTTP_CLIENT, Constants.VALUE_TRUE); option.setProperty(HTTPConstants.CACHED_HTTP_CLIENT, httpClient); client.sendRobust(AXIOMUtil.stringToOM(body)); } catch (AxisFault axisFault) { log.error("Policy publish fails due : " + axisFault.getMessage(), axisFault);
soapHeaders); client.sendRobust(message);
client.sendRobust(messageEl);
client.sendRobust(messageEl);
public void destroy() throws AxisFault { String uuid = UUIDGenerator.getUUID(); opts.setMessageId(uuid); OMElement message = factory.createOMElement("Destroy", NameSpaceConstants.WSRL_NS); opts.setAction(message.getNamespace().getNamespaceURI() + "/" + message.getLocalName()); opts.setTimeOutInMilliSeconds(getTimeoutInMilliSeconds()); 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(this.resourceEndpointReference.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); } client.setOptions(opts); client.sendRobust(message); }
client.sendRobust(message);
public void destroy() throws AxisFault { String uuid = UUIDGenerator.getUUID(); opts.setMessageId(uuid); OMElement message = factory.createOMElement("Destroy", NameSpaceConstants.WSRL_NS); opts.setAction(message.getNamespace().getNamespaceURI() + "/" + message.getLocalName()); opts.setTimeOutInMilliSeconds(getTimeoutInMilliSeconds()); 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(this.resourceEndpointReference.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); } client.setOptions(opts); try { client.sendRobust(message); } catch (AxisFault axisFault) { axisFault.printStackTrace(); //To change body of catch statement use File | Settings | File Templates. }finally { client.cleanup(); client.cleanupTransport(); } }
client.sendRobust(message); } catch (AxisFault axisFault) {