ConfigurationContext ctx = ConfigurationContextFactory.createConfigurationContextFromFileSystem("repository", null); NetWS_0Stub stub = new NetWS_0Stub(ctx, aEndPoint); ServiceClient client = stub._getServiceClient(); Options options = new Options(); options.setTo(new EndpointReference(aEndPoint)); //Added chunking property: options.setProperty(org.apache.axis2.transport.http.HTTPConstants.CHUNKED, Boolean.FALSE); client.setOptions(options); //Engaged rampart module: client.engageModule("rampart"); return stub;
ConfigurationContext ctx = ConfigurationContextFactory.createConfigurationContextFromFileSystem("clientrepo", null); ServiceClient sc = new ServiceClient(ctx, null); sc.engageModule("rampart"); // create option object Options opts = new Options(); // setting target EPR opts.setTo(new EndpointReference(serviceUrl); opts.setAction("urn:something"); try { opts.setProperty(RampartMessageData.KEY_RAMPART_POLICY, loadPolicy("policy.xml")); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } sc.setOptions(opts); OMElement res = sc.sendReceive(payload);
client.getOptions().setProperty(AddressingConstants.WS_ADDRESSING_VERSION, this.addressingNs); client.engageModule("addressing"); client.engageModule("rampart");
private ServiceClient createServiceClient() throws AxisFault { String uuid = UUIDGenerator.getUUID(); Options opts = new Options(); opts.setProperty(org.apache.axis2.transport.http.HTTPConstants.CHUNKED, Boolean.FALSE); opts.setTo(new EndpointReference(this.msgBoxEndPointReference)); opts.setMessageId(uuid); opts.setAction(NameSpaceConstants.MSG_BOX.getNamespaceURI() + "/" + "createMsgBox"); 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; }
private ServiceClient createServiceClient() throws AxisFault { String uuid = UUIDGenerator.getUUID(); Options opts = new Options(); opts.setProperty(org.apache.axis2.transport.http.HTTPConstants.CHUNKED, Boolean.FALSE); opts.setTo(new EndpointReference(this.msgBoxEndPointReference)); opts.setMessageId(uuid); opts.setAction(NameSpaceConstants.MSG_BOX.getNamespaceURI() + "/" + "createMsgBox"); 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; }
private ServiceClient createServiceClient() 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(NameSpaceConstants.MSG_BOX.getNamespaceURI() + "/" + "storeMessages"); 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; } }
private ServiceClient createServiceClient() 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(NameSpaceConstants.MSG_BOX.getNamespaceURI() + "/" + "storeMessages"); 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; } }
private ServiceClient getServiceClient(QName rstQn, String issuerAddress) throws AxisFault { AxisService axisService = new AxisService("SecurityTokenService" + UUIDGenerator.getUUID()); axisService.setClientSide(true); AxisOperation operation = new OutInAxisOperation(rstQn); axisService.addOperation(operation); ServiceClient client = new ServiceClient(this.configCtx, axisService); if (this.options != null) { client.setOptions(options); } //Set the action client.getOptions().setAction(action); client.getOptions().setTo(new EndpointReference(issuerAddress)); client.engageModule("rampart"); return client; }
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; } }
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; } }
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; } }
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 void removeAllFeaturesWithProperty(String key, String value) throws Exception { try { ServiceClient client = provAdminStub._getServiceClient(); client.engageModule("addressing"); // IMPORTANT Options options = client.getOptions(); options.setUseSeparateListener(true); options.setTransportInProtocol(Constants.TRANSPORT_HTTP); if ("org.wso2.carbon.p2.category.type".equals(key) && "server".equalsIgnoreCase(value)) { provAdminStub.startremoveAllServerFeatures(callback); handleCallback(); } else if ("org.wso2.carbon.p2.category.type".equals(key) && "console".equalsIgnoreCase(value)) { provAdminStub.startremoveAllConsoleFeatures(callback); handleCallback(); } } catch (AxisFault e) { if (e.getFaultCode() != null) { handleException(bundle.getString(e.getFaultCode().getLocalPart()), e); } else { handleException(bundle.getString("failed.remove.server.console.features"), e); } } }
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 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 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); } } }
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 ProfileHistory[] getProfileHistory() throws Exception { try { ServiceClient client = provAdminStub._getServiceClient(); client.engageModule("addressing"); // IMPORTANT Options options = client.getOptions(); options.setUseSeparateListener(true); options.setTransportInProtocol(Constants.TRANSPORT_HTTP); provAdminStub.startgetProfileHistory(callback); handleCallback(); } catch (AxisFault e) { if (e.getFaultCode() != null) { handleException(bundle.getString(e.getFaultCode().getLocalPart()), e); } else { handleException(bundle.getString("failed.get.profile.history"), e); } } return profileHistories; }
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 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; }