You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Philroc <ph...@free.fr> on 2012/12/06 12:52:17 UTC

Connecting to MS Exchanger Service using CXF

Hello,
I am trying to connect to an Exchange Web Service to retrieve e-mails and
process them, using Apache Camel CXF.

Here's my (very coarse) code so far:

from(
"cxf://https://mymailserver.com/ews?"
+ "wsdlURL=https://mymailsever.com/ews/Services.wsdl&"
+ "serviceClass=com.mycompany.MyEndPoint&"
+ "serviceName=GetInboxRules").process(new MyWSProcessor()).to("log:foo");

When I run it, I get an "401" error from the server, which means that I need
to authenticate. How do I do that? Should I pass "loginname" and "password"
parameters in the cxf string?
Furthermore, do I need a serviceClass? If so, can anyone provide a simple
example of a service class?
Last but not least, does anyone have sample code which shows how to process
the data returned by any method (eg, GetInboxRules here) in MS Exchange's
WSDL?
Many thanks.
Philroc









--
View this message in context: http://camel.465427.n5.nabble.com/Connecting-to-MS-Exchanger-Service-using-CXF-tp5723701.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Connecting to MS Exchanger Service using CXF

Posted by Willem jiang <wi...@gmail.com>.
If you are using spring to load the camel context, you could configure the authentication information like this[1]

[1]http://cxf.apache.org/docs/client-http-transport-including-ssl-support.html#ClientHTTPTransport%28includingSSLsupport%29-BasicAuthentication  

--  
Willem Jiang

Red Hat, Inc.
FuseSource is now part of Red Hat
Web: http://www.fusesource.com | http://www.redhat.com
Blog: http://willemjiang.blogspot.com (http://willemjiang.blogspot.com/) (English)
          http://jnn.iteye.com (http://jnn.javaeye.com/) (Chinese)
Twitter: willemjiang  
Weibo: 姜宁willem





On Thursday, December 6, 2012 at 10:36 PM, Philroc wrote:

> I don't plan to access the MS Exchange WS in MyWSProcessor, because I access
> it using the from("cxf:...") command.
>  
> My intent is to process email attachments in the processor, extract data
> from them, and store them in a database. For instance,
>  
>  
>  
> I didn't create the web service proxy. Why do I need to create one? How
> should I do it?
>  
> I will try setting the username and password via the AuthorizationPolicy.
>  
> Philroc
>  
>  
>  
>  
>  
>  
>  
> --
> View this message in context: http://camel.465427.n5.nabble.com/Connecting-to-MS-Exchanger-Service-using-CXF-tp5723701p5723708.html
> Sent from the Camel - Users mailing list archive at Nabble.com (http://Nabble.com).




Re: Connecting to MS Exchanger Service using CXF

Posted by Willem jiang <wi...@gmail.com>.
It's used to create the WS client proxy for you in the CXF internal.

I think I can do some enhancement on the camel-cxf to support you setup the properties which could be use to setup the authentication policy without using spring.
Here is the JIRA[1] for it, you can setup your own configurer to setup the ClientFactoryBean as you want.

Before that you still need to follow the CXF http client configuration which I showed you.

[1]https://issues.apache.org/jira/browse/CAMEL-5853  

--  
Willem Jiang

Red Hat, Inc.
FuseSource is now part of Red Hat
Web: http://www.fusesource.com | http://www.redhat.com
Blog: http://willemjiang.blogspot.com (http://willemjiang.blogspot.com/) (English)
          http://jnn.iteye.com (http://jnn.javaeye.com/) (Chinese)
Twitter: willemjiang  
Weibo: 姜宁willem





On Thursday, December 6, 2012 at 10:59 PM, Philroc wrote:

> Hi again,
>  
> what exactly is the "client factory bean"?
>  
> Philroc
>  
>  
>  
> --
> View this message in context: http://camel.465427.n5.nabble.com/Connecting-to-MS-Exchanger-Service-using-CXF-tp5723701p5723709.html
> Sent from the Camel - Users mailing list archive at Nabble.com (http://Nabble.com).




Re: Connecting to MS Exchanger Service using CXF

Posted by Philroc <ph...@free.fr>.
Hi again,

what exactly is the "client factory bean"?

Philroc



--
View this message in context: http://camel.465427.n5.nabble.com/Connecting-to-MS-Exchanger-Service-using-CXF-tp5723701p5723709.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Connecting to MS Exchanger Service using CXF

Posted by Philroc <ph...@free.fr>.
I don't plan to access the MS Exchange WS in MyWSProcessor, because I access
it using the from("cxf:...") command.

My intent is to process email attachments in the processor, extract data
from them, and store them in a database. For instance,



I didn't create the web service proxy. Why do I need to create one?  How
should I do it?

I will try setting the username and password via the AuthorizationPolicy.

Philroc







--
View this message in context: http://camel.465427.n5.nabble.com/Connecting-to-MS-Exchanger-Service-using-CXF-tp5723701p5723708.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Connecting to MS Exchanger Service using CXF

Posted by Willem jiang <wi...@gmail.com>.
Hi,

Do you try to access the MS Exchanger WebService in the MyWSProcessor?
How did you create the web service client proxy?
CXF Client support to set the username and password by setting the AuthorizationPolicy on the ClientFactoryBean.

--  
Willem Jiang

Red Hat, Inc.
FuseSource is now part of Red Hat
Web: http://www.fusesource.com | http://www.redhat.com
Blog: http://willemjiang.blogspot.com (http://willemjiang.blogspot.com/) (English)
          http://jnn.iteye.com (http://jnn.javaeye.com/) (Chinese)
Twitter: willemjiang  
Weibo: 姜宁willem





On Thursday, December 6, 2012 at 7:52 PM, Philroc wrote:

> Hello,
> I am trying to connect to an Exchange Web Service to retrieve e-mails and
> process them, using Apache Camel CXF.
>  
> Here's my (very coarse) code so far:
>  
> from(
> "cxf://https://mymailserver.com/ews?"
> + "wsdlURL=https://mymailsever.com/ews/Services.wsdl&"
> + "serviceClass=com.mycompany.MyEndPoint&"
> + "serviceName=GetInboxRules").process(new MyWSProcessor()).to("log:foo");
>  
> When I run it, I get an "401" error from the server, which means that I need
> to authenticate. How do I do that? Should I pass "loginname" and "password"
> parameters in the cxf string?
> Furthermore, do I need a serviceClass? If so, can anyone provide a simple
> example of a service class?
> Last but not least, does anyone have sample code which shows how to process
> the data returned by any method (eg, GetInboxRules here) in MS Exchange's
> WSDL?
> Many thanks.
> Philroc
>  
>  
>  
>  
>  
>  
>  
>  
>  
> --
> View this message in context: http://camel.465427.n5.nabble.com/Connecting-to-MS-Exchanger-Service-using-CXF-tp5723701.html
> Sent from the Camel - Users mailing list archive at Nabble.com (http://Nabble.com).