public void run() { client.getOptions().setAction(operation); try { long t1 = System.currentTimeMillis(); for (long i=0; i < iterations; i++) { OMElement response2 = client.sendReceive(msg); OMElement loadElement = response2.getFirstChildWithName(new QName("load")); System.out.println(invokerName + ": " + loadElement.toString()); } long t2 = System.currentTimeMillis(); System.out.println("================================================================"); System.out.println(invokerName + " completed requests."); System.out.println("================================================================"); runningTime = t2 - t1; } catch (AxisFault axisFault) { System.out.println(axisFault.getMessage()); } } }
public NfeConsulta2Stub(final org.apache.axis2.context.ConfigurationContext configurationContext, final java.lang.String targetEndpoint, final boolean useSeparateListener) throws org.apache.axis2.AxisFault { this.populateAxisService(); this.populateFaults(); this._serviceClient = new org.apache.axis2.client.ServiceClient(configurationContext, this._service); this._serviceClient.getOptions().setTo(new org.apache.axis2.addressing.EndpointReference(targetEndpoint)); this._serviceClient.getOptions().setUseSeparateListener(useSeparateListener); this._serviceClient.getOptions().setSoapVersionURI(org.apache.axiom.soap.SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI); }
private static void fillSOAPEnvelope(MessageContext messageContext, OMElement xmlPayload, ServiceClient serviceClient) throws AxisFault { messageContext.setServiceContext(serviceClient.getServiceContext()); SOAPFactory soapFactory = getSOAPFactory(serviceClient.getOptions()); SOAPEnvelope envelope = soapFactory.getDefaultEnvelope(); if (xmlPayload != null) { envelope.getBody().addChild(xmlPayload); } serviceClient.addHeadersToEnvelope(envelope); messageContext.setEnvelope(envelope); }
public synchronized OMElement deliverMessage(OMElement notificationMessage, String type, EndpointReference brokerLocationEPR, long timeout) throws AxisFault { ServiceClient client = createServiceClient(type, notificationMessage, brokerLocationEPR, timeout, null); OMElement ret = client.sendReceive(notificationMessage); client.cleanup(); client.cleanupTransport(); return ret; }
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 synchronized OMElement deliverMessage(OMElement notificationMessage, String type, EndpointReference brokerLocationEPR, long timeout) throws AxisFault { ServiceClient client = createServiceClient(type, notificationMessage, brokerLocationEPR, timeout, null); OMElement ret = client.sendReceive(notificationMessage); client.cleanupTransport(); return ret; }
org.apache.axis2.client.OperationClient _operationClient = _serviceClient.createClient(_operations[0].getName()); _operationClient.getOptions().setAction("urn:deleteEmployee"); _operationClient.getOptions().setExceptionToBeThrownOnSOAPFault(true); _messageContext = new org.apache.axis2.context.MessageContext(); env = toEnvelope(getFactory(_operationClient.getOptions().getSoapVersionURI()), deleteEmployee9, optimizeContent(new javax.xml.namespace.QName("http://ws.wso2.org/dataservice/samples/batch_request_sample", "deleteEmployee")),new javax.xml.namespace.QName("http://ws.wso2.org/dataservice/samples/batch_request_sample", "deleteEmployee")); _serviceClient.addHeadersToEnvelope(env); _messageContext.setEnvelope(env); if (_messageContext.getTransportOut() != null) { _messageContext.getTransportOut().getSender().cleanup(_messageContext);
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 performInstallation(String actionType) throws Exception { try { ServiceClient client = provAdminStub._getServiceClient(); client.engageModule("addressing"); // IMPORTANT Options options = client.getOptions(); options.setUseSeparateListener(true); options.setTransportInProtocol(Constants.TRANSPORT_HTTP); provAdminStub.startperformProvisioningAction(actionType, callback); handleCallback(); } catch (AxisFault e) { if (e.getFaultCode() != null) { handleException(bundle.getString(e.getFaultCode().getLocalPart()), e); } else { handleException(bundle.getString("failed.perform.prov.action"), e); } } }
QName rstQn = new QName("requestSecurityToken"); client.getServiceContext().setProperty(RAMPART_POLICY, issuerPolicy); client.getOptions().setSoapVersionURI(this.soapVersion); if(this.addressingNs != null) { client.getOptions().setProperty(AddressingConstants.WS_ADDRESSING_VERSION, this.addressingNs); client.engageModule("addressing"); client.engageModule("rampart"); OMElement response = client.sendReceive(rstQn, createRenewRequest(tokenType,tokenId));
public OMElement subscribe(EndpointReference eventSinkReferenceEPR, OMElement filterEl, boolean useNotfy, long expireTime) throws AxisFault { OMElement message = createMessageEl(eventSinkReferenceEPR, filterEl, expireTime); ServiceClient serviceClient = createServiceClient(message); OMElement responseMessage = serviceClient.sendReceive(message); serviceClient.cleanup(); serviceClient.cleanupTransport(); if (responseMessage == null) { throw AxisFault.makeFault(new RuntimeException("no response recieved for subscription message")); } OMElement responseSubscriptionsManagerElement = responseMessage.getFirstChildWithName(new QName( NameSpaceConstants.WSE_NS.getNamespaceURI(), "SubscriptionManager")); return responseSubscriptionsManagerElement; }
public WSUserStoreManager(String serverUrl, String cookie, ConfigurationContext configCtxt) throws UserStoreException { try { stub = new RemoteUserStoreManagerServiceStub(configCtxt, serverUrl + SERVICE_NAME); ServiceClient client = stub._getServiceClient(); Options option = client.getOptions(); option.setManageSession(true); option.setProperty(org.apache.axis2.transport.http.HTTPConstants.COOKIE_STRING, cookie); } catch (AxisFault e) { handleException(e.getMessage(), e); } }
public void setInvokerName(String invokerName) { this.invokerName = invokerName; if (statefull) { client.getOptions().setManageSession(true); client.getOptions().setAction("setClientName"); OMElement cName = fac.createOMElement("cName", null); cName.setText(invokerName); try { OMElement response = client.sendReceive(cName); System.out.println(response.getText()); } catch (AxisFault axisFault) { axisFault.printStackTrace(); } } }
private ServiceClient createServiceClient(OMElement message) throws AxisFault { String uuid = UUIDGenerator.getUUID(); Options opts = new Options(); opts.setProperty(org.apache.axis2.transport.http.HTTPConstants.CHUNKED, Boolean.FALSE); opts.setTo(msgBoxEndPointReference); opts.setMessageId(uuid); opts.setAction(message.getNamespace().getNamespaceURI() + "/" + message.getLocalName()); opts.setTimeOutInMilliSeconds(getTimeoutInMilliSeconds()); ServiceClient client = new ServiceClient(); try { client.engageModule(WsmgCommonConstants.AXIS_MODULE_NAME_ADDRESSING); if (logger.isDebugEnabled()) logger.debug("Addressing module engaged"); } catch (AxisFault e) { if (logger.isDebugEnabled()) logger.debug("Addressing module not engaged :" + e); } client.setOptions(opts); return client; } }
public ServiceInvoker(String epr, String operation) { this.operation = operation; Options options = new Options(); options.setTo(new EndpointReference(epr)); options.setAction(operation); try { ConfigurationContext configContext = ConfigurationContextFactory. createConfigurationContextFromFileSystem("client_repo", null); client = new ServiceClient(configContext, null); options.setTimeOutInMilliSeconds(10000000); client.setOptions(options); client.engageModule("addressing"); } catch (AxisFault axisFault) { axisFault.printStackTrace(); } fac = OMAbstractFactory.getOMFactory(); msg = fac.createOMElement("SampleMsg", null); OMElement load = fac.createOMElement("load", null); load.setText("1000"); msg.addChild(load); }
public SAMLSSOConfigServiceClient(String cookie, String backendServerURL, ConfigurationContext configCtx) throws AxisFault { try { String serviceURL = backendServerURL + "IdentitySAMLSSOConfigService"; stub = new IdentitySAMLSSOConfigServiceStub(configCtx, serviceURL); ServiceClient client = stub._getServiceClient(); Options option = client.getOptions(); option.setManageSession(true); option.setProperty(org.apache.axis2.transport.http.HTTPConstants.COOKIE_STRING, cookie); } catch (AxisFault ex) { log.error("Error generating stub for IdentitySAMLSSOConfigService", ex); throw new AxisFault("Error generating stub for IdentitySAMLSSOConfigService", ex); } }
public static void main(String[] args) throws AxisFault { String axis2_xml = CLIENT_REPO_PATH + File.separator + "client_axis2.xml"; ConfigurationContext configContext = ConfigurationContextFactory.createConfigurationContextFromFileSystem(CLIENT_REPO_PATH,axis2_xml); Options clientOptions = new Options (); clientOptions.setTo(new EndpointReference (toEPR)); ServiceClient serviceClient = new ServiceClient (configContext,null); clientOptions.setAction("urn:wsrm:Ping"); serviceClient.setOptions(clientOptions); serviceClient.fireAndForget(getPingOMBlock("ping1")); serviceClient.fireAndForget(getPingOMBlock("ping2")); clientOptions.setProperty(SandeshaClientConstants.LAST_MESSAGE, "true"); serviceClient.fireAndForget(getPingOMBlock("ping3")); serviceClient.cleanup(); }
@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 and get the response arrayList.add(0, client.sendReceive(payload)); } catch (AxisFault e) { log.error(e.getMessage(), e); } } });
private static MessageContext sendReceive(OMElement llomElement, ServiceClient serviceClient) throws AxisFault { MessageContext messageContext = new MessageContext(); fillSOAPEnvelope(messageContext, llomElement, serviceClient); OperationClient operationClient = serviceClient.createClient(ServiceClient.ANON_OUT_IN_OP); operationClient.addMessageContext(messageContext); operationClient.execute(true); MessageContext response = operationClient .getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE); if (serviceClient.getOptions().isCallTransportCleanup()) { response.getEnvelope().build(); serviceClient.cleanupTransport(); return response; } else { return response; } }
private ServiceClient createServiceClient(OMElement message) throws AxisFault { String soapAction = message.getNamespace().getNamespaceURI() + "/" + message.getLocalName(); Options opts = CommonRoutines.getOptions(soapAction, getTimeoutInMilliSeconds(), brokerEndpointRef); ServiceClient client = new ServiceClient(); CommonRoutines.setHeaders(soapAction, brokerEndpointRef.getAddress(), client); client.setOptions(opts); return client; }