if (pname != null) { if (propertyValue != null) { proxy.addParameter(pname.getAttributeValue(), propertyValue); } else { proxy.addParameter(pname.getAttributeValue(), prop.getText().trim());
/** * Tests building a proxy service with an unreachable URI specified as the published wsdl url with the * 'enablePublishWSDLSafeMode' set to true. * * @throws URISyntaxException if an error occurs when converting the URI string to a URI */ public void testBuildAxisServiceWithUnreachableWsdlUriWithPublishWSDLSafeModeEnabled() throws Exception { SynapseConfiguration synCfg = new SynapseConfiguration(); AxisConfiguration axisCfg = new AxisConfiguration(); ProxyService proxyService = new ProxyService ("unreachableWsdlUriWithPublishWSDLSafeModeEnabledProxy"); proxyService.addParameter("enablePublishWSDLSafeMode", true); URI wsdlUri = new URI("http://invalid-host/SimpleStockService.wsdl"); proxyService.setWsdlURI(wsdlUri); Assert.assertNull("Axis service returned should be null", proxyService.buildAxisService(synCfg, axisCfg)); }
if (pname != null) { if (propertyValue != null) { proxy.addParameter(pname.getAttributeValue(), propertyValue); } else { proxy.addParameter(pname.getAttributeValue(), prop.getText().trim());
/** * Tests building a proxy service with an unreachable URI specified as the published wsdl url with the * 'enablePublishWSDLSafeMode' set to false. * * @throws Exception if an error occurs when converting the URI string to a URI */ public void testBuildAxisServiceWithUnreachableWsdlUriWithPublishWSDLSafeModeDisabled() throws Exception { SynapseConfiguration synCfg = new SynapseConfiguration(); AxisConfiguration axisCfg = new AxisConfiguration(); ProxyService proxyService = new ProxyService("unreachableWsdlUriWithPublishWSDLSafeModeDisabledProxy"); proxyService.addParameter("enablePublishWSDLSafeMode", false); URI wsdlUri = new URI("http://invalid-host/SimpleStockService.wsdl"); proxyService.setWsdlURI(wsdlUri); try { proxyService.buildAxisService(synCfg, axisCfg); Assert.fail("Axis service should not be built with malformed publish wsdl URI: " + wsdlUri); } catch (SynapseException e) { Assert.assertEquals("Unexpected exception thrown: " + e, "Error reading from wsdl URI", e.getMessage()); } }
/** * Tests building a proxy service with an unreachable endpoint specified as the published wsdl url with the * 'enablePublishWSDLSafeMode' set to true. * * @throws Exception if an error occurs when converting the URI string to a URI */ public void testBuildAxisServiceWithUnreachableWsdlEndpointWithPublishWSDLSafeModeDisabled() throws Exception { SynapseConfiguration synCfg = new SynapseConfiguration(); AxisConfiguration axisCfg = new AxisConfiguration(); ProxyService proxyService = new ProxyService("faultyPublishWsdlEndpointProxyWithPublishWSDLSafeModeDisabled"); proxyService.setPublishWSDLEndpoint("wsdlEndPoint"); AddressEndpoint wsdlEndpoint = new AddressEndpoint(); EndpointDefinition endpointDefinition = new EndpointDefinition(); endpointDefinition.setAddress((new URI("http://invalid-host/SimpleStockService.wsdl")).toString()); wsdlEndpoint.setDefinition(endpointDefinition); proxyService.addParameter("enablePublishWSDLSafeMode", false); synCfg.addEndpoint("wsdlEndPoint", wsdlEndpoint); try { proxyService.buildAxisService(synCfg, axisCfg); Assert.fail("Axis service built with an unreachable wsdl endpoint should throw fault"); } catch (SynapseException e) { Assert.assertTrue("Unexpected exception thrown: " + e, e.getMessage().contains("Error reading from wsdl URI")); } }
/** * Tests building a proxy service with an unreachable endpoint specified as the published wsdl url with the * 'enablePublishWSDLSafeMode' set to false. * * @throws Exception if an error occurs when converting the URI string to a URI */ public void testBuildAxisServiceWithUnreachableWsdlEndpointWithPublishWSDLSafeModeEnabled() throws Exception { MessageContext synCtx = new TestMessageContext(); SynapseConfiguration synCfg = new SynapseConfiguration(); synCtx.setConfiguration(synCfg); AxisConfiguration axisCfg = new AxisConfiguration(); ProxyService proxyService = new ProxyService("faultyPublishWsdlEndpointProxyWithPublishWSDLSafeModeEnabled"); proxyService.setPublishWSDLEndpoint("wsdlEndPoint"); AddressEndpoint wsdlEndpoint = new AddressEndpoint(); EndpointDefinition endpointDefinition = new EndpointDefinition(); endpointDefinition.setAddress((new URI("http://invalid-host/SimpleStockService.wsdl")).toString()); wsdlEndpoint.setDefinition(endpointDefinition); proxyService.addParameter("enablePublishWSDLSafeMode", true); synCfg.addEndpoint("wsdlEndPoint", wsdlEndpoint); Assert.assertNull("Axis service built with an unreachable wsdl endpoint be null", proxyService.buildAxisService(synCfg, axisCfg)); }