private String printEndpointAddress() { if(this.definition != null && this.definition.getAddress() != null) { return " with address " + MessageHelper.maskURLPassword(this.definition.getAddress()); } else { return " "; } } }
EndpointDefinition definition = new EndpointDefinition(); String traceValue = trace.getAttributeValue(); if (XMLConfigConstants.TRACE_ENABLE.equals(traceValue)) { definition.setTraceState(SynapseConstants.TRACING_ON); } else if (XMLConfigConstants.TRACE_DISABLE.equals(traceValue)) { definition.setTraceState(SynapseConstants.TRACING_OFF); definition.setTraceState(SynapseConstants.TRACING_UNSET); String method = optimize.getAttributeValue().trim(); if ("mtom".equalsIgnoreCase(method)) { definition.setUseMTOM(true); } else if ("swa".equalsIgnoreCase(method)) { definition.setUseSwa(true); definition.setCharSetEncoding(encoding.getAttributeValue()); definition.setAddressingOn(true); if (SynapseConstants.ADDRESSING_VERSION_FINAL.equals(versionValue) || SynapseConstants.ADDRESSING_VERSION_SUBMISSION.equals(versionValue)) { definition.setAddressingVersion(version.getAttributeValue()); } else { handleException("Unknown value for the addressing version. Possible values " + if (useSepList != null) { if ("true".equals(useSepList.trim().toLowerCase())) { definition.setUseSeparateListener(true);
endpointDefinition.getAspectConfiguration(); if (endpointDefinition.isUseSwa()) { element.addAttribute(fac.createOMAttribute("optimize", null, "swa")); } else if (endpointDefinition.isUseMTOM()) { element.addAttribute(fac.createOMAttribute("optimize", null, "mtom")); if (endpointDefinition.getCharSetEncoding() != null) { element.addAttribute(fac.createOMAttribute( "encoding", null, endpointDefinition.getCharSetEncoding())); if (endpointDefinition.isAddressingOn()) { OMElement addressing = fac.createOMElement( "enableAddressing", SynapseConstants.SYNAPSE_OMNAMESPACE); if (endpointDefinition.getAddressingVersion() != null) { addressing.addAttribute(fac.createOMAttribute( "version", null, endpointDefinition.getAddressingVersion())); if (endpointDefinition.isUseSeparateListener()) { addressing.addAttribute(fac.createOMAttribute("separateListener", null, "true")); if (endpointDefinition.isSecurityOn()) { OMElement sec = fac.createOMElement("enableSec", SynapseConstants.SYNAPSE_OMNAMESPACE); if (endpointDefinition.getWsSecPolicyKey() != null) { if (!endpointDefinition.isDynamicPolicy()) { sec.addAttribute(fac.createOMAttribute( "policy", null, endpointDefinition.getWsSecPolicyKey()));
/** * Create a Endpoint for a given URL * * @param endpointUrl URL * @param se synapse environment * @return AddressEndpoint address endpoint */ private Endpoint getEndpointFromURL(String endpointUrl, SynapseEnvironment se) { AddressEndpoint endpoint = new AddressEndpoint(); EndpointDefinition def = new EndpointDefinition(); def.setAddress(endpointUrl.trim()); endpoint.setDefinition(def); endpoint.init(se); return endpoint; }
public void init(SynapseEnvironment synapseEnvironment) { ConfigurationContext cc = ((Axis2SynapseEnvironment) synapseEnvironment).getAxis2ConfigurationContext(); if (!initialized) { // The check for clustering environment ClusteringAgent clusteringAgent = cc.getAxisConfiguration().getClusteringAgent(); if (clusteringAgent != null && clusteringAgent.getStateManager() != null) { isClusteringEnabled = Boolean.TRUE; } else { isClusteringEnabled = Boolean.FALSE; } context = new EndpointContext(getName(), getDefinition(), isClusteringEnabled, cc, metricsMBean); } initialized = true; if (children != null) { for (Endpoint e : children) { e.init(synapseEnvironment); } } contentAware = definition != null && ((definition.getFormat() != null && !definition.getFormat().equals(SynapseConstants.FORMAT_REST)) || definition.isSecurityOn() || definition.isReliableMessagingOn() || definition.isAddressingOn() || definition.isUseMTOM()|| definition.isUseSwa()); }
endpointDefinition = new EndpointDefinition(); endpointDefinition.setAddress(serviceURL); ((AddressEndpoint) endpoint).setDefinition(endpointDefinition); isWrappingEndpointCreated = true; endpointDefinition = new EndpointDefinition(); ((DefaultEndpoint) endpoint).setDefinition(endpointDefinition); isWrappingEndpointCreated = true; endpointDefinition.setSecurityOn(true); if (wsSecPolicyKey != null) { endpointDefinition.setWsSecPolicyKey(wsSecPolicyKey); } else { if (inboundWsSecPolicyKey != null) { endpointDefinition.setInboundWsSecPolicyKey(inboundWsSecPolicyKey); endpointDefinition.setOutboundWsSecPolicyKey(outboundWsSecPolicyKey);
separateListener = endpoint.isUseSeparateListener(); wsSecurityEnabled = endpoint.isSecurityOn(); wsSecPolicyKey = endpoint.getWsSecPolicyKey(); inboundWsSecPolicyKey = endpoint.getInboundWsSecPolicyKey(); outboundWsSecPolicyKey = endpoint.getOutboundWsSecPolicyKey(); wsAddressingEnabled = endpoint.isAddressingOn(); wsAddressingVersion = endpoint.getAddressingVersion(); if (endpoint != null && endpoint.getAddress() != null) { to = endpoint.getAddress(synapseOutMessageContext); } else { to = synapseOutMessageContext.getTo().toString(); "] [sec = " + wsSecurityEnabled + (endpoint != null ? "] [mtom = " + endpoint.isUseMTOM() + "] [swa = " + endpoint.isUseSwa() + "] [format = " + endpoint.getFormat() + "] [force soap11=" + endpoint.isForceSOAP11() + "] [force soap12=" + endpoint.isForceSOAP12() + "] [pox=" + endpoint.isForcePOX() + "] [get=" + endpoint.isForceGET() + "] [encoding=" + endpoint.getCharSetEncoding() : "") + "] [to=" + to + "]"); if (endpoint.getCharSetEncoding() != null) { strCharSetEncoding = ";" + endpoint.getCharSetEncoding(); if (SynapseConstants.FORMAT_POX.equals(endpoint.getFormat())) {
public void serializeEndpointDefinition(EndpointDefinition endpointDefinition, OMElement element) { if (endpointDefinition.getTraceState() == SynapseConstants.TRACING_ON) { element.addAttribute(fac.createOMAttribute(XMLConfigConstants.TRACE_ATTRIB_NAME, null, XMLConfigConstants.TRACE_ENABLE)); } else if (endpointDefinition.getTraceState() == SynapseConstants.TRACING_OFF) { element.addAttribute(fac.createOMAttribute(XMLConfigConstants.TRACE_ATTRIB_NAME, null, XMLConfigConstants.TRACE_DISABLE)); endpointDefinition.getAspectConfiguration(); if (endpointDefinition.isUseSwa()) { element.addAttribute(fac.createOMAttribute("optimize", null, "swa")); } else if (endpointDefinition.isUseMTOM()) { element.addAttribute(fac.createOMAttribute("optimize", null, "mtom")); if (endpointDefinition.getCharSetEncoding() != null) { element.addAttribute(fac.createOMAttribute( "encoding", null, endpointDefinition.getCharSetEncoding())); if (endpointDefinition.isAddressingOn()) { OMElement addressing = fac.createOMElement( "enableAddressing", SynapseConstants.SYNAPSE_OMNAMESPACE); if (endpointDefinition.getAddressingVersion() != null) { addressing.addAttribute(fac.createOMAttribute( "version", null, endpointDefinition.getAddressingVersion())); if (endpointDefinition.isUseSeparateListener()) { addressing.addAttribute(fac.createOMAttribute("separateListener", null, "true"));
separateListener = endpoint.isUseSeparateListener(); wsSecurityEnabled = endpoint.isSecurityOn(); wsSecPolicyKey = endpoint.getWsSecPolicyKey(); inboundWsSecPolicyKey = endpoint.getInboundWsSecPolicyKey(); outboundWsSecPolicyKey = endpoint.getOutboundWsSecPolicyKey(); wsAddressingEnabled = endpoint.isAddressingOn(); wsAddressingVersion = endpoint.getAddressingVersion(); if (endpoint != null && endpoint.getAddress() != null) { to = endpoint.getAddress(synapseOutMessageContext); } else { to = synapseOutMessageContext.getTo().toString(); "] [sec = " + wsSecurityEnabled + (endpoint != null ? "] [mtom = " + endpoint.isUseMTOM() + "] [swa = " + endpoint.isUseSwa() + "] [format = " + endpoint.getFormat() + "] [force soap11=" + endpoint.isForceSOAP11() + "] [force soap12=" + endpoint.isForceSOAP12() + "] [pox=" + endpoint.isForcePOX() + "] [get=" + endpoint.isForceGET() + "] [encoding=" + endpoint.getCharSetEncoding() : "") + "] [to=" + to + "]"); if (SynapseConstants.FORMAT_POX.equals(endpoint.getFormat())) { axisOutMsgCtx.setDoingREST(true); axisOutMsgCtx.setProperty(org.apache.axis2.Constants.Configuration.MESSAGE_TYPE,
if (endpoint.getFormat() != null) { String format = endpoint.getFormat(); if (SynapseConstants.FORMAT_POX.equals(format)) { axisOutMsgCtx.setDoingREST(true); if (endpoint.isUseMTOM()) { axisOutMsgCtx.setDoingMTOM(true); } else if (endpoint.isUseSwa()) { axisOutMsgCtx.setDoingSwA(true); if (endpoint.getCharSetEncoding() != null) { axisOutMsgCtx.setProperty(Constants.Configuration.CHARACTER_SET_ENCODING, endpoint.getCharSetEncoding()); if (endpoint.isHTTPEndpoint()) { axisOutMsgCtx.setProperty( Constants.Configuration.HTTP_METHOD, boolean isRest = SynapseConstants.FORMAT_REST.equals(endpoint.getFormat()) | axisInMsgCtx.isDoingREST(); if (!isRest && !endpoint.isForceSOAP11() && !endpoint.isForceSOAP12()) { isRest = isRequestRest(axisInMsgCtx); if (endpoint.getAddress() != null) { String address = endpoint.getAddress(synapseInMsgCtx); if (isRest && restURLPostfix != null && !"".equals(restURLPostfix)) { address = getEPRWithRestURLPostfix(restURLPostfix, address);
if (endpoint.getFormat() != null) { String format = endpoint.getFormat(); if (SynapseConstants.FORMAT_POX.equals(format)) { axisOutMsgCtx.setDoingREST(true); if (endpoint.isUseMTOM()) { axisOutMsgCtx.setDoingMTOM(true); axisOutMsgCtx.setProperty( } else if (endpoint.isUseSwa()) { axisOutMsgCtx.setDoingSwA(true); axisOutMsgCtx.setProperty( if (endpoint.getCharSetEncoding() != null) { axisOutMsgCtx.setProperty(Constants.Configuration.CHARACTER_SET_ENCODING, endpoint.getCharSetEncoding()); boolean isRest = SynapseConstants.FORMAT_REST.equals(endpoint.getFormat()) | axisInMsgCtx.isDoingREST(); if (!isRest && !endpoint.isForceSOAP11() && !endpoint.isForceSOAP12()) { isRest = isRequestRest(axisInMsgCtx); if (endpoint.getAddress() != null) { String address = endpoint.getAddress(synapseInMsgCtx); if (isRest && restURLPostfix != null && !"".equals(restURLPostfix)) { address = getEPRWithRestURLPostfix(restURLPostfix, address); if (endpoint.getTimeoutDuration() > 0) { int endpointTimeout = (int) endpoint.getTimeoutDuration(); axisOutMsgCtx.setProperty(HTTPConstants.CONNECTION_TIMEOUT, endpointTimeout);
endpointDefinition = new EndpointDefinition(); endpointDefinition.setAddress(serviceURL); endpointDefinition.addSuspendErrorCode(-1); endpointDefinition.addTimeoutErrorCode(-1); ((AddressEndpoint) endpoint).setDefinition(endpointDefinition); isWrappingEndpointCreated = true; endpointDefinition = new EndpointDefinition(); ((DefaultEndpoint) endpoint).setDefinition(endpointDefinition); isWrappingEndpointCreated = true; endpointDefinition.setSecurityOn(true); if (wsSecPolicyKey != null) { endpointDefinition.setWsSecPolicyKey(wsSecPolicyKey); } else { if (inboundWsSecPolicyKey != null) { endpointDefinition.setInboundWsSecPolicyKey(inboundWsSecPolicyKey); endpointDefinition.setOutboundWsSecPolicyKey(outboundWsSecPolicyKey);
endpointDefinition.setAddress(serviceURL); if (SynapseConstants.FORMAT_SOAP11.equals(format)) { endpointDefinition.setForceSOAP11(true); } else if (SynapseConstants.FORMAT_SOAP12.equals(format)) { endpointDefinition.setForceSOAP12(true); } else if (SynapseConstants.FORMAT_REST.equals(format)){ endpointDefinition.setForceREST(true); } else if (SynapseConstants.FORMAT_GET.equals(format)){ endpointDefinition.setForceGET(true); } else { handleException("format value '" + format + "' not yet implemented"); endpointDefinition.setFormat(format);
if (endpointDefinition.getAddress() != null) { endpointReferenceValue = endpointDefinition.getAddress(); } else if (axisInMsgCtx.getTo() != null) { endpointReferenceValue = axisInMsgCtx.getTo().getAddress(); null, configurationContext.getAxisConfiguration(), endpointDefinition.isAddressingOn() | endpointDefinition.isReliableMessagingOn(), endpointDefinition.isReliableMessagingOn(), endpointDefinition.isSecurityOn(), false);
/** * * @param to get an endpoint to send the information * @param member The member to which an EP has to be created * @param synCtx synapse context * @return the created endpoint */ private Endpoint getEndpoint(EndpointReference to, Member member, MessageContext synCtx) { AddressEndpoint endpoint = new AddressEndpoint(); endpoint.setEnableMBeanStats(false); endpoint.setName("DLB:" + member.getHostName() + ":" + member.getPort() + ":" + UUID.randomUUID()); EndpointDefinition definition = new EndpointDefinition(); definition.setSuspendMaximumDuration(10000); definition.setReplicationDisabled(true); definition.setAddress(to.getAddress()); endpoint.setDefinition(definition); endpoint.init((SynapseEnvironment) ((Axis2MessageContext) synCtx).getAxis2MessageContext(). getConfigurationContext().getAxisConfiguration(). getParameterValue(SynapseConstants.SYNAPSE_ENV)); return endpoint; }
public void testContextProperties() throws Exception { SynapseXPath xpath = new SynapseXPath("$ctx:timeout"); AbstractEndpoint endpoint = new AddressEndpoint(); EndpointDefinition definition = new EndpointDefinition(); endpoint.setDefinition(definition); definition.setDynamicTimeoutExpression(xpath); MessageContext synCtx = new TestMessageContext(); synCtx.setProperty("timeout", "90000"); assertEquals(Long.valueOf((String) xpath.evaluate(synCtx)).longValue(), endpoint.getDefinition().evaluateDynamicEndpointTimeout(synCtx)); }
/** * Should this mediator perform tracing? True if its explicitly asked to * trace, or its parent has been asked to trace and it does not reject it * * @param msgCtx the current message * @return true if tracing should be performed */ protected boolean isTraceOn(MessageContext msgCtx) { return (definition.getAspectConfiguration() != null && definition.getAspectConfiguration().isTracingEnabled()); }
public void testAddressEndpointSerialization() { String callConfig = "<call xmlns=\"http://ws.apache.org/ns/synapse\">" + "<endpoint>" + "<address uri='http://localhost:9000/services/MyService1'>" + "<enableAddressing/>" + "<timeout>" + "<duration>60</duration>" + "<responseAction>discard</responseAction>" + "</timeout>" + "</address>" + "</endpoint>" + "</call>"; OMElement config1 = createOMElement(callConfig); CallMediator call1 = (CallMediator) factory.createMediator(config1, new Properties()); OMElement config2 = serializer.serializeMediator(null, call1); CallMediator call2 = (CallMediator) factory.createMediator(config2, new Properties()); assertTrue("Top level endpoint should be a address endpoint.", call1.getEndpoint() instanceof AddressEndpoint); AddressEndpoint ep1 = (AddressEndpoint) call1.getEndpoint(); assertTrue("Top level endpoint should be a address endpoint.", call2.getEndpoint() instanceof AddressEndpoint); AddressEndpoint ep2 = (AddressEndpoint) call2.getEndpoint(); assertEquals("Address URI is not serialized properly", ep1.getDefinition().getAddress(), ep2.getDefinition().getAddress()); assertEquals( "Addressing information is not serialized properly", ep1.getDefinition().isAddressingOn(), ep2.getDefinition().isAddressingOn()); }
endpoint.setEnableMBeanStats(false); endpoint.setName("DYNAMIC_RECIPIENT_LIST_EP_" + UUID.randomUUID()); EndpointDefinition definition = new EndpointDefinition(); definition.setReplicationDisabled(true); definition.setAddress(url); endpoint.setDefinition(definition); endpoint.init(env);
if (endpointDefinition.getAddress() != null) { endpointReferenceValue = endpointDefinition.getAddress(); } else if (axisInMsgCtx.getTo() != null) { endpointReferenceValue = axisInMsgCtx.getTo().getAddress(); configurationContext.getAxisConfiguration(), endpointDefinition.isAddressingOn(), endpointDefinition.isSecurityOn(), false); anonymousService.getParent().addParameter(SynapseConstants.HIDDEN_SERVICE_PARAM, "true"); ServiceGroupContext serviceGroupContext = new ServiceGroupContext(configurationContext, (AxisServiceGroup) anonymousService.getParent()); ((AbstractEndpoint) endpoint).getDefinition().getAddress());