[ 
https://issues.apache.org/jira/browse/CONNECTORS-1635?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17027255#comment-17027255
 ] 

Karl Wright commented on CONNECTORS-1635:
-----------------------------------------

You're creating a brand-new ResourceResolver() in this fix.  Very probably you 
need to extend the one that is being used rather than creating something brand 
new, because I bet other methods in the resolver are going to help it resolve 
links in the wsdl.

In other words, you fixed one problem but the way you fixed it broke the 
ability to fetch the other referenced wsdl components.


> CSWS Connector: Issues with connecting to OpenText system
> ---------------------------------------------------------
>
>                 Key: CONNECTORS-1635
>                 URL: https://issues.apache.org/jira/browse/CONNECTORS-1635
>             Project: ManifoldCF
>          Issue Type: Bug
>    Affects Versions: ManifoldCF 2.15
>            Reporter: Jörn Franke
>            Assignee: Karl Wright
>            Priority: Major
>
> This is about the CSWS connector. It has the following issues:
>  * Cannot fetch WSDL from https URL, because CA are ignored. The reason is 
> that the underlying CXF framework uses for fetching the WSDL the library 
> WSDL4JAVA, which is a completely different mechanism compared to doing a web 
> service call within the CXF (the latter is correctly addressed by the 
> connector). See below on how to fix this.
>  * After fixing fetching WSD from a https URL, another issue occurs. It can 
> fetch correctly the WSDL, but included references not. The thing is that in 
> the error message a URL of the included reference is mentioned and this URL 
> is reachable and also the same server as the WSDL. So I have the theory that 
> something blocks the CXF request to fetch included files from a https URL.
>  
> Error trace for the second point:
> Caused by: org.apache.cxf.service.factory.ServiceConstructionException: 
> Failed to create service.
>      at 
> org.apache.cxf.wsdl11.WSDLServiceFactory.create(WSDLServiceFactory.java:169)
>      at 
> org.apache.cxf.wsdl.service.factory.ReflectionServiceFactoryBean.buildServiceFromWSDL(ReflectionServiceFactoryBean.java:408)
>      at 
> org.apache.cxf.wsdl.service.factory.ReflectionServiceFactoryBean.initializeServiceModel(ReflectionServiceFactoryBean.java:528)
>      at 
> org.apache.cxf.wsdl.service.factory.ReflectionServiceFactoryBean.create(ReflectionServiceFactoryBean.java:263)
>      at 
> org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.create(JaxWsServiceFactoryBean.java:199)
>      at 
> org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createEndpoint(AbstractWSDLBasedEndpointFactory.java:103)
>      at 
> org.apache.cxf.frontend.ClientFactoryBean.create(ClientFactoryBean.java:91)
>      at 
> org.apache.cxf.frontend.ClientProxyFactoryBean.create(ClientProxyFactoryBean.java:159)
>      at 
> org.apache.cxf.jaxws.JaxWsProxyFactoryBean.create(JaxWsProxyFactoryBean.java:142)
>      at org.apache.cxf.jaxws.ServiceImpl.createPort(ServiceImpl.java:492)
>      at org.apache.cxf.jaxws.ServiceImpl.getPort(ServiceImpl.java:358)
>      ... 51 more
>  Caused by: org.apache.ws.commons.schema.XmlSchemaException: Unable to locate 
> imported document at 'https://server:443/cws/services/Authentication?xsd=2', 
> relative to 
> '[https://server:443/cws/services/Authentication?wsdl#types1'|https://deref-web-02.de/mail/client/S_ilqmoKMFI/dereferrer/?redirectUrl=https%3A%2F%2Fd-darwin-dev5.escb.eu%3A443%2Fcws%2Fservices%2FAuthentication%3Fwsdl%23types1%27].
>      at 
> org.apache.cxf.catalog.CatalogXmlSchemaURIResolver.resolveEntity(CatalogXmlSchemaURIResolver.java:76)
>      at 
> org.apache.ws.commons.schema.SchemaBuilder.resolveXmlSchema(SchemaBuilder.java:684)
>      at 
> org.apache.ws.commons.schema.SchemaBuilder.handleImport(SchemaBuilder.java:538)
>      at 
> org.apache.ws.commons.schema.SchemaBuilder.handleSchemaElementChild(SchemaBuilder.java:1515)
>      at 
> org.apache.ws.commons.schema.SchemaBuilder.handleXmlSchemaElement(SchemaBuilder.java:658)
>      at 
> org.apache.ws.commons.schema.XmlSchemaCollection.read(XmlSchemaCollection.java:550)
>      at 
> org.apache.cxf.common.xmlschema.SchemaCollection.read(SchemaCollection.java:129)
>      at org.apache.cxf.wsdl11.SchemaUtil.extractSchema(SchemaUtil.java:141)
>      at org.apache.cxf.wsdl11.SchemaUtil.getSchemas(SchemaUtil.java:74)
>      at org.apache.cxf.wsdl11.SchemaUtil.getSchemas(SchemaUtil.java:66)
>      at org.apache.cxf.wsdl11.SchemaUtil.getSchemas(SchemaUtil.java:61)
>      at 
> org.apache.cxf.wsdl11.WSDLServiceBuilder.getSchemas(WSDLServiceBuilder.java:378)
>      at 
> org.apache.cxf.wsdl11.WSDLServiceBuilder.buildServices(WSDLServiceBuilder.java:345)
>      at 
> org.apache.cxf.wsdl11.WSDLServiceBuilder.buildServices(WSDLServiceBuilder.java:209)
>      at 
> org.apache.cxf.wsdl11.WSDLServiceFactory.create(WSDLServiceFactory.java:161)
>      ... 61 more
>  
>  
>  
> ---
> fixing https CAs for fetching WSDLs:
> // enable https for wsdl requests (this goes via WSDL4J)
>                  Bus bus = BusFactory.getThreadDefaultBus();
>              ResourceManager extension = 
> bus.getExtension(ResourceManager.class);
>             extension.addResourceResolver(new ResourceResolver() {
>                  @Override
>                  public <T> T resolve(String resourceName, Class<T> 
> resourceType) {
>                      return null;
>                  }
>                 @Override
>                  public InputStream getAsStream(String name) {
>                      try {
>                          if (!name.startsWith("https")) {
>                              return null;
>                          }
>                          //    SSLContext sslContext = 
> SSLContexts.custom().loadTrustMaterial(keystore.getTrustManagers()).build();
>                          SSLConnectionSocketFactory sslsf = new 
> SSLConnectionSocketFactory(keystore.getSecureSocketFactory(), 
> NoopHostnameVerifier.INSTANCE);
>                  
>                          final Registry<ConnectionSocketFactory> 
> socketFactoryRegistry = RegistryBuilder.<ConnectionSocketFactory> create()
>                          .register("https", sslsf)
>                          .register("http", new PlainConnectionSocketFactory())
>                          .build();
>                          final BasicHttpClientConnectionManager 
> connectionManager = new 
> BasicHttpClientConnectionManager(socketFactoryRegistry);
>                          final CloseableHttpClient httpClient = 
> HttpClients.custom()
>                          .setSSLSocketFactory(sslsf)
>                          .setConnectionManager(connectionManager)
>                  .        build();
>                          HttpGet get = new HttpGet(name);
>                          HttpResponse response = httpClient.execute(get);
>                          return response.getEntity().getContent();
>                      } catch (Exception e) {
>                          return null;
>                      }
>                  }
>              });
>   



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to