camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mabahma <maba...@hotmail.com>
Subject Re: Camel CXF Payload mode
Date Wed, 08 Jun 2016 06:47:32 GMT
Thank you all

it was a poblem of authentication

i added a PasswordAutehntication class ..

CamelContext context = new DefaultCamelContext();
                context.addRoutes(new RouteBuilder() {
                            public void configure() throws Exception {


----> 	Authenticator.setDefault(new NTLMAuthenticator());   

<<NTLMAuthenticator  

NTLMAuthenticator extends Authenticator {

    private final static String NTLM_DOMAIN = &quot;domain&quot;;
    private final static String NTLM_SEPARATOR = &quot;\\&quot;;
    private final static String NTLM_USER = &quot;user&quot;;
    private final static String NTLM_PASSWORD = &quot;pass&quot;;

    @Override
    public PasswordAuthentication getPasswordAuthentication() {
        return new PasswordAuthentication(NTLM_DOMAIN + NTLM_SEPARATOR 
+ NTLM_USER, NTLM_PASSWORD.toCharArray());
    }
}


>>

          from("direct:test")
                             
         .setHeader("operationNamespace",
constant("urn:microsoft-dynamics-schemas/page/calculator"))
         .setHeader("operationName", constant("compute"))
        .setHeader("SOAPAction",
constant("urn:microsoft-dynamics-schemas/page/calculator:compute"))
                       
  .
to("cxf://http://localhost:9080/WS/calculator?wsdlURL=classpath:test.wsdl&
dataFormat=PAYLOAD")
                               
                             
                             }
                        });
                       
                        context.start();
                       
     String soap = "<soap:Envelope
xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\"><soap:Body><compute
xmlns=\"urn:microsoft-dynamics-schemas/page/calculator\"><No>8545</No></compute></soap:Body></soap:Envelope>";
     
                                 
                        Endpoint endpoint =
context.getEndpoint("direct:test");
                        Exchange exchange = endpoint.createExchange();
                        ProducerTemplate template =
exchange.getContext().createProducerTemplate();
                       
                     // send to default endpoint
                     template.sendBody(endpoint,soap);


******************** 

Do you know how to implement PasswordAuthentication in a spring camel xml
configuration ??

Many thanks



--
View this message in context: http://camel.465427.n5.nabble.com/Camel-CXF-Payload-mode-tp5783530p5783610.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Mime
View raw message