You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by kdesin <ka...@gmail.com> on 2012/06/24 07:58:08 UTC

XML/HTTP without SOAP in CXF

Hi all,

Please let me know if  it is possible to send an XML as a string over a http
connection and get back the response in a XML (as a String) without using
any parsing mechanism?

Is it feasible in Apache CXF ? or use of Streams/parsers is mandatory? Is
there a configuration in Apache CXF which does this for me if I provide the
content-type as text/xml?

I want to do this without using SOAP.

Saludos

Kartheek


-----
Saludos
Kartheek
--
View this message in context: http://cxf.547215.n5.nabble.com/XML-HTTP-without-SOAP-in-CXF-tp5710174.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: XML/HTTP without SOAP in CXF

Posted by kdesin <ka...@gmail.com>.
Hi Sergey,

Thanks for the reply.That answers my question however can you please
elaborate what is the disadvantage of  using the conduit config for the http
headers and why I should I go for a higher level API?

Saludos
Kartheek

-----
Saludos
Kartheek
--
View this message in context: http://cxf.547215.n5.nabble.com/XML-HTTP-without-SOAP-in-CXF-tp5710174p5710703.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: XML/HTTP without SOAP in CXF

Posted by kdesin <ka...@gmail.com>.
Hi Son,

I am new to this framework.Could you please elaborate or point to me any
sample code link



-----
Saludos
Kartheek
--
View this message in context: http://cxf.547215.n5.nabble.com/XML-HTTP-without-SOAP-in-CXF-tp5710174p5710457.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: XML/HTTP without SOAP in CXF

Posted by Son Tung Nguyen <sn...@cergy.itin.fr>.
I think you can use Interceptors to do this. ...
Le 29 juin 2012 06:39, "kdesin" <ka...@gmail.com> a écrit :

> Hi All/Sergey,
>
> To explain a bit more:
>
>  WebClient client =WebClient.create("myURL");
>         client.type("text/html");
>         client.accept("text/html");
>         HTTPClientPolicy hcp=new HTTPClientPolicy();
>         hcp.setConnectionTimeout(6000);
>         hcp.setCookie("hello");
>         Map<String, String> headers = new HashMap<String, String>();
>         WebClient.getConfig(client).getHttpConduit().setClient(hcp);
>
>
> System.out.println("Cookies:"+WebClient.getConfig(client).getHttpConduit().getCookies());
>         System.out.println("headers:"+client.getHeaders());
>         resp= client.get();
>
> *Output:*
>
> Cookies:{}
> headers:{Content-Type=[text/html], Accept=[text/html]}
>
> I want to understand how I can print the entire request header before
> sending the request to the remote service as I am unable to see any cookies
> being printed which I have set.I even used the requestContext method to set
> the headers in a HashMap but with no luck.
> Hope I am clear.
>
> -----
> Saludos
> Kartheek
> --
> View this message in context:
> http://cxf.547215.n5.nabble.com/XML-HTTP-without-SOAP-in-CXF-tp5710174p5710453.html
> Sent from the cxf-user mailing list archive at Nabble.com.
>

Re: XML/HTTP without SOAP in CXF

Posted by Sergey Beryozkin <sb...@gmail.com>.
Hi
On 29/06/12 05:39, kdesin wrote:
> Hi All/Sergey,
>
> To explain a bit more:
>
>   WebClient client =WebClient.create("myURL");
>           client.type("text/html");
>           client.accept("text/html");


>           HTTPClientPolicy hcp=new HTTPClientPolicy();
>           hcp.setConnectionTimeout(6000);
>           hcp.setCookie("hello");
>           Map<String, String>  headers = new HashMap<String, String>();
>           WebClient.getConfig(client).getHttpConduit().setClient(hcp);

It is possible to configure HTTPConduit to sent HTTP headers but I think 
you should prefer working with WebClient API because other conduits are 
already supported so it's better to work with a higher level API.
For example, you can do

client.cookie(Cookie.valueOf("a=b"));
or
client.header("Cookie", "a=b");


>
> System.out.println("Cookies:"+WebClient.getConfig(client).getHttpConduit().getCookies());
>           System.out.println("headers:"+client.getHeaders());
>           resp= client.get();
>
> *Output:*
>
> Cookies:{}

HTTPConduit.getCookies returns the Set-Cookie values from the response.

You can also get them from WebClient.getResponse()

Cheers, Sergey

> headers:{Content-Type=[text/html], Accept=[text/html]}
>
> I want to understand how I can print the entire request header before
> sending the request to the remote service as I am unable to see any cookies
> being printed which I have set.I even used the requestContext method to set
> the headers in a HashMap but with no luck.
> Hope I am clear.
>
> -----
> Saludos
> Kartheek
> --
> View this message in context: http://cxf.547215.n5.nabble.com/XML-HTTP-without-SOAP-in-CXF-tp5710174p5710453.html
> Sent from the cxf-user mailing list archive at Nabble.com.


-- 
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/

Blog: http://sberyozkin.blogspot.com

Re: XML/HTTP without SOAP in CXF

Posted by kdesin <ka...@gmail.com>.
Hi All/Sergey,

To explain a bit more:

 WebClient client =WebClient.create("myURL");
         client.type("text/html");
         client.accept("text/html");
         HTTPClientPolicy hcp=new HTTPClientPolicy();
         hcp.setConnectionTimeout(6000);
         hcp.setCookie("hello");        
         Map<String, String> headers = new HashMap<String, String>();
         WebClient.getConfig(client).getHttpConduit().setClient(hcp);        
        
System.out.println("Cookies:"+WebClient.getConfig(client).getHttpConduit().getCookies());
         System.out.println("headers:"+client.getHeaders());
         resp= client.get();

*Output:*

Cookies:{}
headers:{Content-Type=[text/html], Accept=[text/html]}

I want to understand how I can print the entire request header before
sending the request to the remote service as I am unable to see any cookies
being printed which I have set.I even used the requestContext method to set
the headers in a HashMap but with no luck.
Hope I am clear.

-----
Saludos
Kartheek
--
View this message in context: http://cxf.547215.n5.nabble.com/XML-HTTP-without-SOAP-in-CXF-tp5710174p5710453.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: XML/HTTP without SOAP in CXF

Posted by Sergey Beryozkin <sb...@gmail.com>.
On 28/06/12 13:29, kdesin wrote:
> Hi all,
>
> I am able to use the  WebClient.getConfig(client).getHttpConduit().<methods>
> to get the conduit for a WebClient.
>
> and additionally I did this in my config file:
>
> <http-conf:conduit name="*.http-conduit">
>        		<http-conf:client ConnectionTimeout="6000000"
> ReceiveTimeout="6000000" Cookie="Hello"/>   	      		
> </http-conf:conduit>
> 		
> So when I post to my service provider,I would like to capture the request
> headers so that I can validate that the custom header configuration has been
> sent.
>
> Please let me know if I can capture them or let me know if this is the
> correct approach?
Please review a JAXRS Basics section:
http://cxf.apache.org/docs/jax-rs-basics.html

You can use either an HttpHeader parameter annotation or HttpHeaders context

Sergey
>
> Saludos
> Kartheek
>
> -----
> Saludos
> Kartheek
> --
> View this message in context: http://cxf.547215.n5.nabble.com/XML-HTTP-without-SOAP-in-CXF-tp5710174p5710406.html
> Sent from the cxf-user mailing list archive at Nabble.com.


-- 
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/

Blog: http://sberyozkin.blogspot.com

Re: XML/HTTP without SOAP in CXF

Posted by kdesin <ka...@gmail.com>.
Hi all,

I am able to use the  WebClient.getConfig(client).getHttpConduit().<methods>
to get the conduit for a WebClient.

and additionally I did this in my config file:

<http-conf:conduit name="*.http-conduit"> 
      		<http-conf:client ConnectionTimeout="6000000"
ReceiveTimeout="6000000" Cookie="Hello"/>  	      		 
</http-conf:conduit>
		
So when I post to my service provider,I would like to capture the request
headers so that I can validate that the custom header configuration has been
sent.

Please let me know if I can capture them or let me know if this is the
correct approach?

Saludos
Kartheek

-----
Saludos
Kartheek
--
View this message in context: http://cxf.547215.n5.nabble.com/XML-HTTP-without-SOAP-in-CXF-tp5710174p5710406.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: XML/HTTP without SOAP in CXF

Posted by ja...@gmail.com.
What about simple front end? We have even used jaxws client with xformat
binding to output xml using jaxws client proxies. No soap envelope. You
might be able to generate a simple front end or jaxws with xformat binding
from your service providers xsd...

Sent from my Galaxy S2
On Jun 27, 2012 8:12 PM, "kdesin" <ka...@gmail.com> wrote:

> Thanks Glenn.The link does help.This will be our last option.
>
> However our requirement is to build a services layer which has a
> combination
> of JAX-WS and XML over HTTPS services.
>
> CXF works great for JAX-WS services but is it possible to use CXF(without
> adding any other libs/tools) for XML/HTTPs services and use the conduit
> features?
>
> If it is not possible then we have to explore other options.
>
> Please help.
>
> Saludos
> Kartheek
>
> -----
> Saludos
> Kartheek
> --
> View this message in context:
> http://cxf.547215.n5.nabble.com/XML-HTTP-without-SOAP-in-CXF-tp5710174p5710356.html
> Sent from the cxf-user mailing list archive at Nabble.com.
>

Re: XML/HTTP without SOAP in CXF

Posted by kdesin <ka...@gmail.com>.
Thanks Glenn.The link does help.This will be our last option.

However our requirement is to build a services layer which has a combination
of JAX-WS and XML over HTTPS services.

CXF works great for JAX-WS services but is it possible to use CXF(without
adding any other libs/tools) for XML/HTTPs services and use the conduit
features?

If it is not possible then we have to explore other options.

Please help.

Saludos
Kartheek

-----
Saludos
Kartheek
--
View this message in context: http://cxf.547215.n5.nabble.com/XML-HTTP-without-SOAP-in-CXF-tp5710174p5710356.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: XML/HTTP without SOAP in CXF

Posted by Glen Mazza <gm...@talend.com>.
Oh I see...one other option to consider might be Apache HTTP Components, 
in particular take a look at the "Custom SSL Context" example they have 
here: http://hc.apache.org/httpcomponents-client-ga/examples.html (I'm 
sure they have the timeout feature if you ask them).  It could be that 
what you need to do is so simple that CXF may just be unnecessary overhead.

Glen


On 06/26/2012 12:39 PM, kdesin wrote:
> Hi Glenn/all,
>
> We would love to do that at the service provider level as well but
> unfortunately we have no control over the service provider implementation as
> they are a 3rd party vendor for our client and it is very evidently pointed
> out  that there will be no change at their end.
>
> In our analysis we were able to get the response from the remote
> servlet(service) in XML using WebClient but in a real time application we
> would definitely need to set the connection parameters like timeOut,etc.
>
> Though we see that CXF does support pure XML/https transport,we are trying
> to find a way to utilize the conduit features in our scenario.Any example or
> link would definitely be of much help for us at this juncture.
>
> Since we do not have a WSDL we are stuck at a point to define the conduit in
> the first place itself.
>
> Saludos
> Kartheek
>
> -----
> Saludos
> Kartheek
> --
> View this message in context: http://cxf.547215.n5.nabble.com/XML-HTTP-without-SOAP-in-CXF-tp5710174p5710332.html
> Sent from the cxf-user mailing list archive at Nabble.com.


-- 
Glen Mazza
Talend Community Coders
coders.talend.com
blog: www.jroller.com/gmazza


Re: XML/HTTP without SOAP in CXF

Posted by kdesin <ka...@gmail.com>.
Hi Glenn/all,

We would love to do that at the service provider level as well but
unfortunately we have no control over the service provider implementation as
they are a 3rd party vendor for our client and it is very evidently pointed
out  that there will be no change at their end.

In our analysis we were able to get the response from the remote
servlet(service) in XML using WebClient but in a real time application we
would definitely need to set the connection parameters like timeOut,etc.

Though we see that CXF does support pure XML/https transport,we are trying
to find a way to utilize the conduit features in our scenario.Any example or
link would definitely be of much help for us at this juncture.

Since we do not have a WSDL we are stuck at a point to define the conduit in
the first place itself.

Saludos
Kartheek

-----
Saludos
Kartheek
--
View this message in context: http://cxf.547215.n5.nabble.com/XML-HTTP-without-SOAP-in-CXF-tp5710174p5710332.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: XML/HTTP without SOAP in CXF

Posted by Glen Mazza <gm...@talend.com>.
Kartheek, hopefully someone else can answer your questions positively, 
but keep in mind that SOAP *is* fully XML, it's just that your web 
service provider would need to trim out the outer SOAP envelope to just 
get the SOAP body contents (the "payload" in JAX-WS terminology) which 
will contain the XML you care about.  (Your provider may need to parse 
the XML anyway if you're using XML over HTTP, so it's not much a bigger 
deal to use SOAP instead.)  There's libraries like SAAJ that make that 
parsing easy.

You'll probably want to use the Provider interface if you go this route 
(we have a sample in the CXF distribution: 
http://svn.apache.org/viewvc/cxf/trunk/distribution/src/main/release/samples/jaxws_dispatch_provider/) 
to more easily get at the inner XML message; also look at links #2 and 
#11 here for an introduction to SOAP:  
http://www.jroller.com/gmazza/entry/blog_article_index.  Alternatively, 
if you can create a baby WSDL taking a string input, that string will be 
your XML and you're as good to go with link #2 as if you're using XML 
over HTTP.

Glen

On 06/26/2012 08:32 AM, kdesin wrote:
> Thanks for giving all the inputs and I was to able to get the response from
> the remote service.
>
> However I am yet to harness features supported in CXF.
>
> My actual requirement is to talk with a service that takes only XML over
> HTTPS.
>
> a) Does CXF supports a front end programming model to create a client
> service that communicates using XML over https. No fancy SOAP / ReST.
> b) How do I use data binding, protocol binding and conduit to control in
> above scenario as the apache docs speak mostly about WSDL/REST type services
> for these features.
>
> (Adding the certificate to the cacerts keystore solved the certificate
> problem)
>
> Saludos
> Kartheek
>
> -----
> Saludos
> Kartheek
> --
> View this message in context: http://cxf.547215.n5.nabble.com/XML-HTTP-without-SOAP-in-CXF-tp5710174p5710311.html
> Sent from the cxf-user mailing list archive at Nabble.com.


-- 
Glen Mazza
Talend Community Coders
coders.talend.com
blog: www.jroller.com/gmazza


Re: XML/HTTP without SOAP in CXF

Posted by kdesin <ka...@gmail.com>.
Thanks for giving all the inputs and I was to able to get the response from
the remote service. 

However I am yet to harness features supported in CXF.

My actual requirement is to talk with a service that takes only XML over
HTTPS.  

a) Does CXF supports a front end programming model to create a client
service that communicates using XML over https. No fancy SOAP / ReST.
b) How do I use data binding, protocol binding and conduit to control in
above scenario as the apache docs speak mostly about WSDL/REST type services
for these features.

(Adding the certificate to the cacerts keystore solved the certificate
problem)

Saludos
Kartheek

-----
Saludos
Kartheek
--
View this message in context: http://cxf.547215.n5.nabble.com/XML-HTTP-without-SOAP-in-CXF-tp5710174p5710311.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: XML/HTTP without SOAP in CXF

Posted by Sergey Beryozkin <sb...@gmail.com>.
Hi,

have a look here

http://cxf.apache.org/docs/secure-jax-rs-services.html#SecureJAX-RSServices-Configuringclients

Sergey

On 26/06/12 09:45, Himanshu Gupta wrote:
> Try adding your server certificate (on which https is based) to the jdk
> default keystore on the web client ... that is at /jre/lib/security/cacerts
> ...  May be this works.
>
> If yes, then you could use any keystore with this certificate to set it as
> a default keystore using the  -Djavax.net.ssl.*keyStore ...*
> *
> *
> Cheers ..
>
>
> On Tue, Jun 26, 2012 at 7:16 AM, kdesin<ka...@gmail.com>  wrote:
>
>> Hi Sergey,
>>
>>
>> I have achieved my requirement using the WebClient API and with the inputs
>> from this forum.
>>
>>
>> Thanks for that.
>>
>>
>> Currently I am facing problem to post to a https URL.(Every thing works
>> fine
>> if I post to the same URL without the secure scheme..i.e without https)
>>
>>
>>
>> Is there any additional config to be done for posting to secure scheme.
>>
>>
>> *Stack Trace:*
>>
>> javax.net.ssl.SSLHandshakeException: SSLHandshakeException invoking
>> https://myURL/path: sun.security.validator.ValidatorException: No trusted
>> certificate found
>>         sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
>> Method)
>>
>>
>> sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
>>
>>
>> sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
>>         java.lang.reflect.Constructor.newInstance(Constructor.java:494)
>>
>>
>> org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.mapException(HTTPConduit.java:1457)
>>
>>
>> org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1442)
>>
>> org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:56)
>>
>> org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:658)
>>
>>
>> org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:62)
>>
>>
>> org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:262)
>>
>>
>> org.apache.cxf.jaxrs.client.WebClient.doChainedInvocation(WebClient.java:795)
>>         org.apache.cxf.jaxrs.client.WebClient.doInvoke(WebClient.java:743)
>>         org.apache.cxf.jaxrs.client.WebClient.doInvoke(WebClient.java:717)
>>         org.apache.cxf.jaxrs.client.WebClient.invoke(WebClient.java:262)
>>         org.apache.cxf.jaxrs.client.WebClient.post(WebClient.java:271)
>>         com.rest.test.MyClass.myMethod(MyClass.java:158)
>>         sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>
>>
>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>>
>>
>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>>         java.lang.reflect.Method.invoke(Method.java:585)
>>
>>
>> org.apache.cxf.service.invoker.AbstractInvoker.performInvocation(AbstractInvoker.java:180)
>>
>>
>> org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:96)
>>         org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:167)
>>         org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:94)
>>
>>
>> org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:58)
>>
>>
>> org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:94)
>>
>>
>> org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:262)
>>
>>
>> org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:122)
>>
>>
>> org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:211)
>>
>>
>> org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:213)
>>
>>
>> org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:154)
>>
>>
>> org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpringServlet.java:129)
>>
>>
>> org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:187)
>>
>>
>> org.apache.cxf.transport.servlet.AbstractHTTPServlet.doGet(AbstractHTTPServlet.java:115)
>>         javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
>>
>>
>> org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:166)
>>
>>
>> org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
>>
>>
>> Saludos
>> Kartheek
>>
>> -----
>> Saludos
>> Kartheek
>> --
>> View this message in context:
>> http://cxf.547215.n5.nabble.com/XML-HTTP-without-SOAP-in-CXF-tp5710174p5710286.html
>> Sent from the cxf-user mailing list archive at Nabble.com.
>>
>
>
>


-- 
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/

Blog: http://sberyozkin.blogspot.com

Re: XML/HTTP without SOAP in CXF

Posted by Himanshu Gupta <hi...@gmail.com>.
Try adding your server certificate (on which https is based) to the jdk
default keystore on the web client ... that is at /jre/lib/security/cacerts
...  May be this works.

If yes, then you could use any keystore with this certificate to set it as
a default keystore using the  -Djavax.net.ssl.*keyStore ...*
*
*
Cheers ..


On Tue, Jun 26, 2012 at 7:16 AM, kdesin <ka...@gmail.com> wrote:

> Hi Sergey,
>
>
> I have achieved my requirement using the WebClient API and with the inputs
> from this forum.
>
>
> Thanks for that.
>
>
> Currently I am facing problem to post to a https URL.(Every thing works
> fine
> if I post to the same URL without the secure scheme..i.e without https)
>
>
>
> Is there any additional config to be done for posting to secure scheme.
>
>
> *Stack Trace:*
>
> javax.net.ssl.SSLHandshakeException: SSLHandshakeException invoking
> https://myURL/path: sun.security.validator.ValidatorException: No trusted
> certificate found
>        sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
> Method)
>
>
> sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
>
>
> sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
>        java.lang.reflect.Constructor.newInstance(Constructor.java:494)
>
>
> org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.mapException(HTTPConduit.java:1457)
>
>
> org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1442)
>
> org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:56)
>
> org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:658)
>
>
> org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:62)
>
>
> org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:262)
>
>
> org.apache.cxf.jaxrs.client.WebClient.doChainedInvocation(WebClient.java:795)
>        org.apache.cxf.jaxrs.client.WebClient.doInvoke(WebClient.java:743)
>        org.apache.cxf.jaxrs.client.WebClient.doInvoke(WebClient.java:717)
>        org.apache.cxf.jaxrs.client.WebClient.invoke(WebClient.java:262)
>        org.apache.cxf.jaxrs.client.WebClient.post(WebClient.java:271)
>        com.rest.test.MyClass.myMethod(MyClass.java:158)
>        sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>
>
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>
>
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>        java.lang.reflect.Method.invoke(Method.java:585)
>
>
> org.apache.cxf.service.invoker.AbstractInvoker.performInvocation(AbstractInvoker.java:180)
>
>
> org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:96)
>        org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:167)
>        org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:94)
>
>
> org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:58)
>
>
> org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:94)
>
>
> org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:262)
>
>
> org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:122)
>
>
> org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:211)
>
>
> org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:213)
>
>
> org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:154)
>
>
> org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpringServlet.java:129)
>
>
> org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:187)
>
>
> org.apache.cxf.transport.servlet.AbstractHTTPServlet.doGet(AbstractHTTPServlet.java:115)
>        javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
>
>
> org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:166)
>
>
> org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
>
>
> Saludos
> Kartheek
>
> -----
> Saludos
> Kartheek
> --
> View this message in context:
> http://cxf.547215.n5.nabble.com/XML-HTTP-without-SOAP-in-CXF-tp5710174p5710286.html
> Sent from the cxf-user mailing list archive at Nabble.com.
>



-- 
Himanshu Gupta.

Re: XML/HTTP without SOAP in CXF

Posted by kdesin <ka...@gmail.com>.
Hi Sergey,


I have achieved my requirement using the WebClient API and with the inputs
from this forum.


Thanks for that.


Currently I am facing problem to post to a https URL.(Every thing works fine
if I post to the same URL without the secure scheme..i.e without https)



Is there any additional config to be done for posting to secure scheme.


*Stack Trace:*

javax.net.ssl.SSLHandshakeException: SSLHandshakeException invoking
https://myURL/path: sun.security.validator.ValidatorException: No trusted
certificate found
        sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
Method)
       
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
       
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
        java.lang.reflect.Constructor.newInstance(Constructor.java:494)
       
org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.mapException(HTTPConduit.java:1457)
       
org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1442)
       
org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:56)
       
org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:658)
       
org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:62)
       
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:262)
       
org.apache.cxf.jaxrs.client.WebClient.doChainedInvocation(WebClient.java:795)
        org.apache.cxf.jaxrs.client.WebClient.doInvoke(WebClient.java:743)
        org.apache.cxf.jaxrs.client.WebClient.doInvoke(WebClient.java:717)
        org.apache.cxf.jaxrs.client.WebClient.invoke(WebClient.java:262)
        org.apache.cxf.jaxrs.client.WebClient.post(WebClient.java:271)
        com.rest.test.MyClass.myMethod(MyClass.java:158)
        sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
       
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        java.lang.reflect.Method.invoke(Method.java:585)
       
org.apache.cxf.service.invoker.AbstractInvoker.performInvocation(AbstractInvoker.java:180)
       
org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:96)
        org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:167)
        org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:94)
       
org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:58)
       
org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:94)
       
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:262)
       
org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:122)
       
org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:211)
       
org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:213)
       
org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:154)
       
org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpringServlet.java:129)
       
org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:187)
       
org.apache.cxf.transport.servlet.AbstractHTTPServlet.doGet(AbstractHTTPServlet.java:115)
        javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
       
org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:166)
       
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)


Saludos
Kartheek

-----
Saludos
Kartheek
--
View this message in context: http://cxf.547215.n5.nabble.com/XML-HTTP-without-SOAP-in-CXF-tp5710174p5710286.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: XML/HTTP without SOAP in CXF

Posted by Sergey Beryozkin <sb...@gmail.com>.
On 24/06/12 18:32, kdesin wrote:
> Thanks Benson...I am new to CXF.
> Could you please be kind enough to elaborate it a bit more or point me to a
> relevant link?
>
Have a look at http://cxf.apache.org/docs/jax-rs.html.

You should be able to write:

WebClient client = WebClient.create(address);
client.accept("application/xml");
String myXML = client.get(String.class);

Sergey

> Saludos
> Kartheek
>
> -----
> Saludos
> Kartheek
> --
> View this message in context: http://cxf.547215.n5.nabble.com/XML-HTTP-without-SOAP-in-CXF-tp5710174p5710181.html
> Sent from the cxf-user mailing list archive at Nabble.com.


-- 
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/

Blog: http://sberyozkin.blogspot.com

Re: XML/HTTP without SOAP in CXF

Posted by kdesin <ka...@gmail.com>.
Thanks Benson...I am new to CXF.
Could you please be kind enough to elaborate it a bit more or point me to a
relevant link?

Saludos
Kartheek

-----
Saludos
Kartheek
--
View this message in context: http://cxf.547215.n5.nabble.com/XML-HTTP-without-SOAP-in-CXF-tp5710174p5710181.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: XML/HTTP without SOAP in CXF

Posted by Benson Margulies <bi...@gmail.com>.
Use the JAX-RS facilities.


On Sun, Jun 24, 2012 at 1:58 AM, kdesin <ka...@gmail.com> wrote:
> Hi all,
>
> Please let me know if  it is possible to send an XML as a string over a http
> connection and get back the response in a XML (as a String) without using
> any parsing mechanism?
>
> Is it feasible in Apache CXF ? or use of Streams/parsers is mandatory? Is
> there a configuration in Apache CXF which does this for me if I provide the
> content-type as text/xml?
>
> I want to do this without using SOAP.
>
> Saludos
>
> Kartheek
>
>
> -----
> Saludos
> Kartheek
> --
> View this message in context: http://cxf.547215.n5.nabble.com/XML-HTTP-without-SOAP-in-CXF-tp5710174.html
> Sent from the cxf-user mailing list archive at Nabble.com.