Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-16932

Configuration properties (AS2Configuration) of an AS2 client endpoint are ignored

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 3.11.0
    • 3.12.0
    • camel-as2
    • None
    • Unknown

    Description

      Code snippet - creation of endpoint:

      private Endpoint configureAs2ClientEndpoint() throws Exception {
      
      org.apache.http.entity.ContentType contentTypeEdifact =
       org.apache.http.entity.ContentType.create("application/edifact", (Charset) null);
      
      String methodName = "send";
       AS2ApiName as2ApiNameClient = AS2ApiName.CLIENT;
      
      AS2Configuration endpointConfiguration = new AS2Configuration();
       endpointConfiguration.setApiName(as2ApiNameClient);
       endpointConfiguration.setMethodName(methodName);
       endpointConfiguration.setRequestUri("/as2/HttpReceiver");
       endpointConfiguration.setAs2MessageStructure(AS2MessageStructure.PLAIN);
      
      endpointConfiguration.setAs2Version(as2Version);
       endpointConfiguration.setAs2To("mendelsontestAS2");
       endpointConfiguration.setAs2From("mycompanyAS2");
       endpointConfiguration.setEdiMessageType(contentTypeEdifact);
       endpointConfiguration.setFrom("dk2kEdi");
       //endpointConfiguration.setTargetPortNumber(8080);
       //endpointConfiguration.setTargetHostname("testas2.mendelson-e-c.com");
      
      AS2Component as2Component = new AS2Component();
       as2Component.setCamelContext(camelContext);
       as2Component.setConfiguration(endpointConfiguration);
      
      Endpoint clientEndpoint = as2Component.createEndpoint("as2://client/send?targetHostName=testas2.mendelson-e-c.com" +
       "&targetPortNumber=8080" + // http
       "&inBody=ediMessage" +
       "&requestUri=/as2/HttpReceiver");
      
      return clientEndpoint;
       }
      

      When I invoke this endpoint in a route, I get an exception:

      org.apache.camel.RuntimeCamelException: Missing properties for send, need one or more from [as2MessageStructure, subject, ediMessageTransferEncoding, encryptingCertificateChain, ediMessageContentType, encryptingAlgorithm, requestUri, signingPrivateKey, signedReceiptMicAlgorithms, as2To, as2From, signingAlgorithm, compressionAlgorithm, from, signingCertificateChain, dispositionNotificationTo]
       at org.apache.camel.support.component.AbstractApiProducer.findMethod(AbstractApiProducer.java:151)
       at org.apache.camel.support.component.AbstractApiProducer.process(AbstractApiProducer.java:71)
       at org.apache.camel.processor.SendProcessor.process(SendProcessor.java:172)
       at org.apache.camel.processor.errorhandler.RedeliveryErrorHandler$SimpleTask.run(RedeliveryErrorHandler.java:463)
       at org.apache.camel.impl.engine.DefaultReactiveExecutor$Worker.schedule(DefaultReactiveExecutor.java:179)
       at org.apache.camel.impl.engine.DefaultReactiveExecutor.scheduleMain(DefaultReactiveExecutor.java:64)
       at org.apache.camel.processor.Pipeline.process(Pipeline.java:184)
       at org.apache.camel.impl.engine.CamelInternalProcessor.process(CamelInternalProcessor.java:398)
       at org.apache.camel.component.jetty.CamelContinuationServlet.doService(CamelContinuationServlet.java:245)
       at org.apache.camel.http.common.CamelServlet.service(CamelServlet.java:130)
       at javax.servlet.http.HttpServlet.service(HttpServlet.java:733)
       at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:791)
       at org.eclipse.jetty.servlet.ServletHandler$ChainEnd.doFilter(ServletHandler.java:1626)
       at org.apache.camel.component.jetty.MultiPartFilter.doFilter(MultiPartFilter.java:50)
       at org.apache.camel.component.jetty.CamelFilterWrapper.doFilter(CamelFilterWrapper.java:45)
       at org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:193)
       at org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1601)
       at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:548)
       at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:233)
       at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1435)
       at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:188)
       at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:501)
       at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:186)
       at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1350)
       at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
       at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127)
       at org.eclipse.jetty.server.Server.handle(Server.java:516)
       at org.eclipse.jetty.server.HttpChannel.lambda$handle$1(HttpChannel.java:388)
       at org.eclipse.jetty.server.HttpChannel.dispatch(HttpChannel.java:633)
       at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:380)
       at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:273)
       at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:311)
       at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:105)
       at org.eclipse.jetty.io.ChannelEndPoint$1.run(ChannelEndPoint.java:104)
       at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:773)
       at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:905)
       at java.base/java.lang.Thread.run(Thread.java:832)
       

      Do I miss some configuration steps in the code snippet? I guess the entire endpointConfiguration is ignored and only a couple of settings from the uri aren't reported missing.

      Attachments

        1. image-2021-09-09-19-40-17-973.png
          240 kB
          Dmitrii Kriukov

        Activity

          People

            davsclaus Claus Ibsen
            dkryukov Dmitrii Kriukov
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: