@Override protected OMElement serializeEndpoint(Endpoint endpoint) { if (!(endpoint instanceof AddressEndpoint)) { handleException("Invalid endpoint type."); } fac = OMAbstractFactory.getOMFactory(); OMElement endpointElement = fac.createOMElement("endpoint", SynapseConstants.SYNAPSE_OMNAMESPACE); AddressEndpoint addressEndpoint = (AddressEndpoint) endpoint; EndpointDefinition epAddress = addressEndpoint.getDefinition(); OMElement addressElement = serializeEndpointDefinition(epAddress); endpointElement.addChild(addressElement); // serialize the properties serializeProperties(addressEndpoint, endpointElement); //serialize attributes serializeCommonAttributes(endpoint, endpointElement); return endpointElement; }
@Override protected OMElement serializeEndpoint(Endpoint endpoint) { if (!(endpoint instanceof AddressEndpoint)) { handleException("Invalid endpoint type."); } fac = OMAbstractFactory.getOMFactory(); OMElement endpointElement = fac.createOMElement("endpoint", SynapseConstants.SYNAPSE_OMNAMESPACE); AddressEndpoint addressEndpoint = (AddressEndpoint) endpoint; EndpointDefinition epAddress = addressEndpoint.getDefinition(); OMElement addressElement = serializeEndpointDefinition(epAddress); endpointElement.addChild(addressElement); // serialize the properties serializeProperties(addressEndpoint, endpointElement); //serialize attributes serializeCommonAttributes(endpoint, endpointElement); return endpointElement; }
AddressEndpoint addressEndpoint = (AddressEndpoint) e; try { url = new URL(addressEndpoint.getDefinition().getAddress()); } catch (MalformedURLException e1) { String msg = "Mulformed URL in address endpoint";
AddressEndpoint addressEndpoint = (AddressEndpoint) e; try { url = new URL(addressEndpoint.getDefinition().getAddress()); } catch (MalformedURLException e1) { String msg = "Mulformed URL in address endpoint";
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()); }
public void testAddressEndpointSerialization() { String sendConfig = "<send 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>" + "</send>"; OMElement config1 = createOMElement(sendConfig); SendMediator send1 = (SendMediator) factory.createMediator(config1, new Properties()); OMElement config2 = serializer.serializeMediator(null, send1); SendMediator send2 = (SendMediator) factory.createMediator(config2, new Properties()); assertTrue("Top level endpoint should be a address endpoint.", send1.getEndpoint() instanceof AddressEndpoint); AddressEndpoint ep1 = (AddressEndpoint) send1.getEndpoint(); assertTrue("Top level endpoint should be a WSDL endpoint.", send2.getEndpoint() instanceof AddressEndpoint); AddressEndpoint ep2 = (AddressEndpoint) send2.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()); }
"http://localhost:9001/services/Service1".equals(addressEndpoint.getDefinition().getAddress()));
"http://localhost:9001/services/Service1".equals(addressEndpoint.getDefinition().getAddress()));
"http://localhost:9001/services/Service1".equals(addressEndpoint.getDefinition().getAddress()));
"http://localhost:9001/services/Service1".equals(addressEndpoint.getDefinition().getAddress()));
url = new URL(((AddressEndpoint) (ep)).getDefinition().getAddress() + "?wsdl"); } else if (ep instanceof WSDLEndpoint) { url = new URL(((WSDLEndpoint) (ep)).getWsdlURI());
assertTrue(ep1.isInitialized()); assertEquals(1, registry.getHitCount()); assertEquals("http://test.url", ((AddressEndpoint) ep1).getDefinition().getAddress()); assertTrue(ep4.isInitialized()); assertEquals(2, registry.getHitCount()); assertEquals("http://test2.url", ((AddressEndpoint) ep4).getDefinition().getAddress()); assertTrue(ep1 != ep4); assertTrue(!ep1.isInitialized());