Uploaded image for project: 'Red Hat Fuse'
  1. Red Hat Fuse
  2. ENTESB-12312

Problem with Olingo2 and authenticated metadata

    XMLWordPrintable

Details

    • Bug
    • Status: Done
    • Major
    • Resolution: Done
    • fuse-7.4-GA
    • fuse-7.6-ER1
    • Camel

    Description

      • Problem with Olingo2 and authenticated metadata
        • I was failed to config Basic Authorization on camel-olingo2. For details, please refer to the sample code and the camel route (1).
        • I'm using the CamelOlingo2.endpointHttpHeaders header. But when the component is retrieving the metadata it is ignoring the header and it is not able to authenticate.
      • The similar problem was fixed on Olingo4 : [CAMEL-13464] Problem with Olingo4 and authenticated metadata
      • (1) The sample source code, the camel route, and the stack trace:
        @Component("Util")
        public class Util {
        	public void addUsernamePasswordCredentials(String username, String password, Exchange exchange) {
        		final String auth = Base64.encodeBase64String(String.format("%s:%s", username, password).getBytes(StandardCharsets.UTF_8));
        		final Map<String, Object> map = new HashMap<>();
        		map.put("Authorization", "Basic " + auth);
        		exchange.getMessage().getHeaders().put("CamelOlingo2.endpointHttpHeaders", map);
        }
        }
        
                <route id="simple-route">
                    <from id="route-timer" uri="timer://foo?period=10000"/>
                    <bean ref="Util" method="addUsernamePasswordCredentials('DEMO_USER', ‘demo')"/>
                    <to id="_to1" uri="olingo2://read/makerdata"/>
                    <log id="route-log" message=">>> ${body}"/>
                </route>
        
        Stacktrace
        ---------------------------------------------------------------------------------------------------------------------------------------
        org.apache.camel.RuntimeCamelException: Error reading EDM: Unauthorized
        	at org.apache.camel.component.olingo2.Olingo2AppWrapper.getEdm(Olingo2AppWrapper.java:94)
        	at org.apache.camel.component.olingo2.Olingo2Endpoint.interceptProperties(Olingo2Endpoint.java:169)
        	at org.apache.camel.component.olingo2.Olingo2Producer.process(Olingo2Producer.java:58)
        	at org.apache.camel.processor.SendProcessor.process(SendProcessor.java:148)
        	at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:548)
        	at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:201)
        
        

      Attachments

        Activity

          People

            rhn-support-tasato Tadayoshi Sato
            rhn-support-tyamashi Tomonari Yamashita
            Zheng Feng Zheng Feng
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: