jochenr commented on issue #5218:
URL: https://github.com/apache/camel-quarkus/issues/5218#issuecomment-1730918810

   
   Hi @ppalaga ,
   
   now I know what is happening and what's causing the issue.
   
   I initialize my service with that code
   
   ```
                final URL serviceUrl = 
Thread.currentThread().getContextClassLoader().getResource("wsdl/ContactService.wsdl");
                final Service service = Service.create(serviceUrl, 
ContactService.SERVICE, new AddressingFeature(true, true), new 
WSRMConfigRMFeature());
   
                ContactWS port = service.getPort(ContactWS.class);
                BindingProvider bp = (BindingProvider) port;
   
                Map<String, Object> requestContext = bp.getRequestContext();
   
                // set target address
                requestContext.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, 
getServerHttpUrl() + WS_BASE_PATH);
   ```
   
   So, I'm not using the onlilne WSDL, but one that is packaged inside my 
application.
   
   The WSDL has a default address location inside the port definition of the 
service definition like that:
   
   ```
        <wsdl:service name="ContactService">
                <wsdl:port binding="tns:ContactServiceSoapBinding" 
name="ContactServicePort">
                        <!-- working -->
                        <!--
                        <soap:address 
location="http://localhost:8180/cxfservices/contact"; />
                        -->
   
                        <!-- also working -->
                        <!--
                        <soap:address 
location="https://localhost:8543/cxfservices/contact"; />
                        -->
   
                        <!-- NOT Working, because override from code does not 
work any more! -->
                        
                        <soap:address 
location="https://nowhere.com:8080/mustgetoverridden"; />
                        
                </wsdl:port>
        </wsdl:service>
   ```
   
   For that default address I always set an URL that is not existing, so thet 
the application is forced to override it.
   I want to prevent that someone is calling the service for a wrong 
staging-level or a wrong tenant.
   
   Meanwhilem I noticed that CXF is trying to use the address from the WSDL 
instead of the one I set in the code with:
   ```
   requestContext.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, 
getServerHttpUrl() + WS_BASE_PATH);
   ```
   
   I built two additional reproducers:
   
   
https://github.com/jochenr/my-camel-quarkus-projects/tree/main/camel-quarkus-cxf-soap-wssecurity-wsrm
   and
   
https://github.com/jochenr/my-camel-quarkus-projects/tree/main/camel-quarkus-cxf-soap-wsrm
   
   
   You can make them both work by just changing the
   ```
        <wsdl:service name="ContactService">
                <wsdl:port binding="tns:ContactServiceSoapBinding" 
name="ContactServicePort">                   
                        <soap:address location="...." />
                </wsdl:port>
        </wsdl:service>
   ```
   mentionad above.
   
   The 
   
https://github.com/jochenr/my-camel-quarkus-projects/tree/main/camel-quarkus-cxf-soap-wssecurity-wsrm
   example shows also the problem that the test just hangs.
   
   The
   
https://github.com/jochenr/my-camel-quarkus-projects/tree/main/camel-quarkus-cxf-soap-wsrm
   example at least shows the issue and fals.
   
   
   Another thing I noticed:
   If you look at the test class(es) I print out the line
   ```
   logger.info("SOAP Call from ContactTest will call:\t" + getServerHttpUrl() + 
WS_BASE_PATH);
   ```
   in the constructor.
   If you look at the console you see that this line is printed out 6 times. 
Why??
   
   
   Hope you now have a better starting point to fix the bug.
   It should be in CXF, not in Camel nor in Quarkus, isn't it?
   
   Thank you & best regards,
   
   
   
   
   
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@camel.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to