You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by intalio314 <in...@ahristov.com> on 2008/01/17 08:12:32 UTC

:-/ Can't get a simple connection to work

Hi

I've tried to make a simple http -> pojo bean connection to no avail, using
the JBI deployment scheme. Basically, I have one SA with two SUs: 

SU1 contains the Echo POJO from servicemix.apache.org/servicemix-bean.html,
and the jbi.xml file is :
<jbi xmlns="..." version="1.0">
  <services binding-component="false" xmlns:tns="ServiceURI">
    <consumes service-name="tns:ServiceBean" endpoint-name="bean"/>
  </services>
</jbi>

and xbean.xml is:
<beans xmlns:tns="ServiceURI"
       xmlns:bean="...">
  <bean:endpoint service="tns:ServiceBean" endpoint="bean"
beanName="serviceBean"/>
  <bean id="serviceBean" class="test.Echo"/>
</beans>

SU2 contains only the XML files. jbi.xml is
<jbi xmlns="..." version="1.0">
  <services binding-component="false" xmlns:tns="ServiceURI">
    <consumes service-name="tns:ServiceHTTP" endpoint-name="http"/>
  </services>
</jbi>

and xbeanx.xml is
<beans xmlns:http="..."
       xmlns:tns="ServiceURI"
       >
  <http:endpoint service="tns:ServiceHTTP"
                 endpoint="http"
                 targetService ="tns:ServiceBean"
                 targetEndpoint ="bean"
                 role="consumer" 
                 locationURI="http:// localhost:8192/examples/Test"
                 defaultMep="(...)/in-out"
                 soap="true" />
</beans>

(I have removed the URLs of the namespaces because of the sdpam filter)

The SA contains both SUs, each of them deployed on the appropriate component
(SU1 on servicemix-bean, SU2 on servicemix-http)

Everything deploys fine, no errors anywhere, but then when I try to access
the above URL (locationURI) or the above URL plus ?wsdl, I get a 404 and no
errors or traces or other hints anywhere. Changing the log level to DEBUG
I've seen jetty saying that "chain = null", but I don't exactly understand
why.

Any help is welcome. Thanks in advance!
-- 
View this message in context: http://www.nabble.com/%3A---Can%27t-get-a-simple-connection-to-work-tp14903524s12049p14903524.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: :-/ Can't get a simple connection to work

Posted by Bruce Snyder <br...@gmail.com>.
On Jan 17, 2008 5:33 AM, intalio314 <in...@ahristov.com> wrote:
>
>
> gnodet wrote:
> >
> > Sure, good idea.
> >
>
> Maybe a "getting started from zero and without any third party tools" :-) ?.
> I didn't use maven and I did everything from scratch right down to creating
> the deployment packages by hand, which I always find more useful if you want
> to understand why things are the way they are instead of copying and pasting
> ready-made templates.

We've started creating tutorials here:

http://servicemix.apache.org/tutorials.html

The idea is to continue to build up on these based on various use cases.

Bruce
-- 
perl -e 'print unpack("u30","D0G)U8V4\@4VYY9&5R\"F)R=6-E+G-N>61E<D\!G;6%I;\"YC;VT*"
);'

Apache ActiveMQ - http://activemq.org/
Apache Camel - http://activemq.org/camel/
Apache ServiceMix - http://servicemix.org/
Apache Geronimo - http://geronimo.apache.org/

Blog: http://bruceblog.org/

Re: :-/ Can't get a simple connection to work

Posted by intalio314 <in...@ahristov.com>.

gnodet wrote:
> 
> Sure, good idea.
> 

Maybe a "getting started from zero and without any third party tools" :-) ?.
I didn't use maven and I did everything from scratch right down to creating
the deployment packages by hand, which I always find more useful if you want
to understand why things are the way they are instead of copying and pasting
ready-made templates.

Cheers

-- 
View this message in context: http://www.nabble.com/%3A---Can%27t-get-a-simple-connection-to-work-tp14903524s12049p14917906.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: :-/ Can't get a simple connection to work

Posted by Guillaume Nodet <gn...@gmail.com>.
Sure, good idea.
I guess the problem is to find a relevant place in the wiki :-(

On Jan 17, 2008 1:01 PM, intalio314 <in...@ahristov.com> wrote:

>
>
>
> gnodet wrote:
> >
> > What did the target component put in the Out response ?
> > If you send a copy of the In message, it may already be consumed (being
> an
> > xml document based on the socket input stream), hence the Stream Closed
> > exception.
> >
>
> I used the examples in the servicemix-bean docs, namely (relevant parts
> only):
>
> Echo example :
>            MessageUtil.transferInToOut(exchange, exchange);
>            channel.send(exchange);
>
> Message Processing example:
>
>            NormalizedMessage message = exchange.getMessage("in");
>            Source content = message.getContent();
>            message.setContent(content);
>            exchange.setMessage(message, "out");
>            channel.send(exchange);
>
> They both fail. But what you said gave me a clue, so I tried with:
>
>                NormalizedMessage msg = exchange.createMessage();
>                String test = "<content>Sample Result</content>";
>                Source src = new StreamSource(new StringReader(test));
>                msg.setContent(src);
>                exchange.setMessage(msg, "out");
>                channel.send(exchange);
>
> And this works! (and in the process I just found that SMX defines a new
> StringSource(test) which comes handy, too).
>
> So thanks again. Would it be considered useful if I wrote a small article
> on
> the whole issue?
>
>
> Cheers
> --
> View this message in context:
> http://www.nabble.com/%3A---Can%27t-get-a-simple-connection-to-work-tp14903524s12049p14917351.html
> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>
>


-- 
Cheers,
Guillaume Nodet
------------------------
Blog: http://gnodet.blogspot.com/

Re: :-/ Can't get a simple connection to work

Posted by intalio314 <in...@ahristov.com>.


gnodet wrote:
> 
> What did the target component put in the Out response ?
> If you send a copy of the In message, it may already be consumed (being an
> xml document based on the socket input stream), hence the Stream Closed
> exception.
> 

I used the examples in the servicemix-bean docs, namely (relevant parts
only):

Echo example : 
            MessageUtil.transferInToOut(exchange, exchange);
            channel.send(exchange);

Message Processing example:

            NormalizedMessage message = exchange.getMessage("in");
            Source content = message.getContent();
            message.setContent(content);
            exchange.setMessage(message, "out");
            channel.send(exchange);

They both fail. But what you said gave me a clue, so I tried with:

      		NormalizedMessage msg = exchange.createMessage();
      		String test = "<content>Sample Result</content>";
      		Source src = new StreamSource(new StringReader(test));
      		msg.setContent(src);
      		exchange.setMessage(msg, "out");
      		channel.send(exchange);      		

And this works! (and in the process I just found that SMX defines a new
StringSource(test) which comes handy, too).

So thanks again. Would it be considered useful if I wrote a small article on
the whole issue? 


Cheers
-- 
View this message in context: http://www.nabble.com/%3A---Can%27t-get-a-simple-connection-to-work-tp14903524s12049p14917351.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: :-/ Can't get a simple connection to work

Posted by Guillaume Nodet <gn...@gmail.com>.
What did the target component put in the Out response ?
If you send a copy of the In message, it may already be consumed (being an
xml document based on the socket input stream), hence the Stream Closed
exception.

On Jan 17, 2008 12:24 PM, intalio314 <in...@ahristov.com> wrote:

>
> Thanks, I managed to get it working with http:consumer (didn't know this
> existed). With http:endpoint it failed always with 404.
>
> However, when trying to send a result (using the source code of the Echo
> or
> Listener bean examples from the docs, and without writing a marshaller
> class), I get a:
>
> com.ctc.wstx.exc.WstxIOException: Stream closed
>        at com.ctc.wstx.stax.WstxInputFactory.doCreateSR(
> WstxInputFactory.java:548)
>        at com.ctc.wstx.stax.WstxInputFactory.createSR(
> WstxInputFactory.java:604)
>        at com.ctc.wstx.stax.WstxInputFactory.createSR(
> WstxInputFactory.java:660)
>        at
> com.ctc.wstx.stax.WstxInputFactory.createXMLStreamReader(
> WstxInputFactory.java:331)
>        at
> org.apache.servicemix.jbi.jaxp.StAXSourceTransformer.toXMLStreamReader(
> StAXSourceTransformer.java:86)
>        at
> org.apache.servicemix.http.endpoints.DefaultHttpConsumerMarshaler.sendOut(
> DefaultHttpConsumerMarshaler.java:78)
>        at
> org.apache.servicemix.http.endpoints.HttpConsumerEndpoint.sendOut(
> HttpConsumerEndpoint.java:392)
>        (... more stuff ...)
>
>
> This only happens with the in-out MEP, in-only works fine.
>
> Cheers
> --
> View this message in context:
> http://www.nabble.com/%3A---Can%27t-get-a-simple-connection-to-work-tp14903524s12049p14916813.html
> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>
>


-- 
Cheers,
Guillaume Nodet
------------------------
Blog: http://gnodet.blogspot.com/

Re: :-/ Can't get a simple connection to work

Posted by intalio314 <in...@ahristov.com>.
Thanks, I managed to get it working with http:consumer (didn't know this
existed). With http:endpoint it failed always with 404.

However, when trying to send a result (using the source code of the Echo or
Listener bean examples from the docs, and without writing a marshaller
class), I get a:

com.ctc.wstx.exc.WstxIOException: Stream closed
	at com.ctc.wstx.stax.WstxInputFactory.doCreateSR(WstxInputFactory.java:548)
	at com.ctc.wstx.stax.WstxInputFactory.createSR(WstxInputFactory.java:604)
	at com.ctc.wstx.stax.WstxInputFactory.createSR(WstxInputFactory.java:660)
	at
com.ctc.wstx.stax.WstxInputFactory.createXMLStreamReader(WstxInputFactory.java:331)
	at
org.apache.servicemix.jbi.jaxp.StAXSourceTransformer.toXMLStreamReader(StAXSourceTransformer.java:86)
	at
org.apache.servicemix.http.endpoints.DefaultHttpConsumerMarshaler.sendOut(DefaultHttpConsumerMarshaler.java:78)
	at
org.apache.servicemix.http.endpoints.HttpConsumerEndpoint.sendOut(HttpConsumerEndpoint.java:392)
	(... more stuff ...)


This only happens with the in-out MEP, in-only works fine.

Cheers
-- 
View this message in context: http://www.nabble.com/%3A---Can%27t-get-a-simple-connection-to-work-tp14903524s12049p14916813.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: :-/ Can't get a simple connection to work

Posted by Guillaume Nodet <gn...@gmail.com>.
Just use the uri with the trailing '/' and without the '?wsdl'.
Something around
   http:// localhost:8192/examples/Test/

You may still receive an error, but it should not be a 404.
Probably an error saying that the 'GET' method is not supported.

If you want to use plain http, i'd recommend using the newer endpoint.
Look at this tutorial for more informations:

http://servicemix.apache.org/704-intermediate-configuring-the-http-consumer-su.html

On Jan 17, 2008 11:10 AM, intalio314 <in...@ahristov.com> wrote:

>
>
> gnodet wrote:
> >
> > I thought you were looking for the WSDL and had a 404, which is to be
> > expected if you don't use any wsdl at all.
> > If the http endpoint works with jsr181, it will also work with
> > servicemix-bean.
> >
>
> It works for SOAP requests, but not for plain HTTP GET/POST requests (or,
> to
> be more specific, maybe it does, but I haven't been able to configure it
> properly or call it properly).
>
> In the configuration in the original post, I was getting a 404 for almost
> any URL I could think of. The WSDL was just a particular case that also
> didn't work. Is there a particular URL syntax for servicemix-http in order
> to invoke the service using GET/POST binding and not SOAP binding? Jetty
> said that the http endpoint of the service (as configured in the original
> post) was "known" (and the url presented matched the one in locationURI),
> but invoking or any other variation it always gave a 404.
>
> Cheers
>
>
>
> --
> View this message in context:
> http://www.nabble.com/%3A---Can%27t-get-a-simple-connection-to-work-tp14903524s12049p14915684.html
> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>
>


-- 
Cheers,
Guillaume Nodet
------------------------
Blog: http://gnodet.blogspot.com/

Re: :-/ Can't get a simple connection to work

Posted by intalio314 <in...@ahristov.com>.

gnodet wrote:
> 
> I thought you were looking for the WSDL and had a 404, which is to be
> expected if you don't use any wsdl at all.
> If the http endpoint works with jsr181, it will also work with
> servicemix-bean.
> 

It works for SOAP requests, but not for plain HTTP GET/POST requests (or, to
be more specific, maybe it does, but I haven't been able to configure it
properly or call it properly). 

In the configuration in the original post, I was getting a 404 for almost
any URL I could think of. The WSDL was just a particular case that also
didn't work. Is there a particular URL syntax for servicemix-http in order
to invoke the service using GET/POST binding and not SOAP binding? Jetty
said that the http endpoint of the service (as configured in the original
post) was "known" (and the url presented matched the one in locationURI),
but invoking or any other variation it always gave a 404.

Cheers



-- 
View this message in context: http://www.nabble.com/%3A---Can%27t-get-a-simple-connection-to-work-tp14903524s12049p14915684.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: :-/ Can't get a simple connection to work

Posted by Guillaume Nodet <gn...@gmail.com>.
I thought you were looking for the WSDL and had a 404, which is to be
expected if you don't use any wsdl at all.
If the http endpoint works with jsr181, it will also work with
servicemix-bean.

On Jan 17, 2008 10:41 AM, intalio314 <in...@ahristov.com> wrote:

>
>
>
> gnodet wrote:
> >
> > ServiceMix does not require any wsdl, it's all optional, so you can just
> > receive an incoming http request and send it to servicemix-bean without
> > any
> > wsdl anywhere.
> >
>
> Ugh!? Now I'm confused. I understood from your first answer that my
> attempt
> at http-to-bean communication wasn't working because I was lacking a WSDL.
> I tried setting soap to false and invoking the URL (without attempting to
> get any kind of WSDL) and it just didn't make it to the bean : 404 all the
> time.
>
> Cheers
>
> --
> View this message in context:
> http://www.nabble.com/%3A---Can%27t-get-a-simple-connection-to-work-tp14903524s12049p14915332.html
> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>
>


-- 
Cheers,
Guillaume Nodet
------------------------
Blog: http://gnodet.blogspot.com/

Re: :-/ Can't get a simple connection to work

Posted by intalio314 <in...@ahristov.com>.


gnodet wrote:
> 
> ServiceMix does not require any wsdl, it's all optional, so you can just
> receive an incoming http request and send it to servicemix-bean without
> any
> wsdl anywhere.
> 

Ugh!? Now I'm confused. I understood from your first answer that my attempt
at http-to-bean communication wasn't working because I was lacking a WSDL.  
I tried setting soap to false and invoking the URL (without attempting to
get any kind of WSDL) and it just didn't make it to the bean : 404 all the
time.

Cheers

-- 
View this message in context: http://www.nabble.com/%3A---Can%27t-get-a-simple-connection-to-work-tp14903524s12049p14915332.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: :-/ Can't get a simple connection to work

Posted by Guillaume Nodet <gn...@gmail.com>.
ServiceMix does not require any wsdl, it's all optional, so you can just
receive an incoming http request and send it to servicemix-bean without any
wsdl anywhere.

On Jan 17, 2008 10:19 AM, intalio314 <in...@ahristov.com> wrote:

>
>
>
> gnodet wrote:
> >
> > I don't see any reference to a WSDL anywhere in your files.
> > WSDL will only be generated from POJOs by servicemix-jsr181 and
> > servicemix-cxf-se AFAIK.
> > If you use servicemix-bean, you'd have to write your WSDL and associated
> > it
> > (either on the servicemix-bean endpoint or the servicemix-http one).
> >
>
>
> Thanks, that (using jsr181 instead of bean) definitely worked. Is there
> any
> way, however, to feed into the system normal HTTP requests (non SOAP)
> without having to write a WSDL anywhere by hand  (I guess I'm too
> influenced
> by Mule's approach)?.
>
>
>
> --
> View this message in context:
> http://www.nabble.com/%3A---Can%27t-get-a-simple-connection-to-work-tp14903524s12049p14914941.html
> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>
>


-- 
Cheers,
Guillaume Nodet
------------------------
Blog: http://gnodet.blogspot.com/

Re: :-/ Can't get a simple connection to work

Posted by intalio314 <in...@ahristov.com>.


gnodet wrote:
> 
> I don't see any reference to a WSDL anywhere in your files.
> WSDL will only be generated from POJOs by servicemix-jsr181 and
> servicemix-cxf-se AFAIK.
> If you use servicemix-bean, you'd have to write your WSDL and associated
> it
> (either on the servicemix-bean endpoint or the servicemix-http one).
> 


Thanks, that (using jsr181 instead of bean) definitely worked. Is there any
way, however, to feed into the system normal HTTP requests (non SOAP)
without having to write a WSDL anywhere by hand  (I guess I'm too influenced
by Mule's approach)?. 



-- 
View this message in context: http://www.nabble.com/%3A---Can%27t-get-a-simple-connection-to-work-tp14903524s12049p14914941.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: :-/ Can't get a simple connection to work

Posted by Guillaume Nodet <gn...@gmail.com>.
I don't see any reference to a WSDL anywhere in your files.
WSDL will only be generated from POJOs by servicemix-jsr181 and
servicemix-cxf-se AFAIK.
If you use servicemix-bean, you'd have to write your WSDL and associated it
(either on the servicemix-bean endpoint or the servicemix-http one).

On Jan 17, 2008 8:12 AM, intalio314 <in...@ahristov.com> wrote:

>
> Hi
>
> I've tried to make a simple http -> pojo bean connection to no avail,
> using
> the JBI deployment scheme. Basically, I have one SA with two SUs:
>
> SU1 contains the Echo POJO from servicemix.apache.org/servicemix-bean.html
> ,
> and the jbi.xml file is :
> <jbi xmlns="..." version="1.0">
>  <services binding-component="false" xmlns:tns="ServiceURI">
>    <consumes service-name="tns:ServiceBean" endpoint-name="bean"/>
>  </services>
> </jbi>
>
> and xbean.xml is:
> <beans xmlns:tns="ServiceURI"
>       xmlns:bean="...">
>  <bean:endpoint service="tns:ServiceBean" endpoint="bean"
> beanName="serviceBean"/>
>  <bean id="serviceBean" class="test.Echo"/>
> </beans>
>
> SU2 contains only the XML files. jbi.xml is
> <jbi xmlns="..." version="1.0">
>  <services binding-component="false" xmlns:tns="ServiceURI">
>    <consumes service-name="tns:ServiceHTTP" endpoint-name="http"/>
>  </services>
> </jbi>
>
> and xbeanx.xml is
> <beans xmlns:http="..."
>       xmlns:tns="ServiceURI"
>       >
>  <http:endpoint service="tns:ServiceHTTP"
>                 endpoint="http"
>                 targetService ="tns:ServiceBean"
>                 targetEndpoint ="bean"
>                 role="consumer"
>                 locationURI="http:// localhost:8192/examples/Test"
>                 defaultMep="(...)/in-out"
>                 soap="true" />
> </beans>
>
> (I have removed the URLs of the namespaces because of the sdpam filter)
>
> The SA contains both SUs, each of them deployed on the appropriate
> component
> (SU1 on servicemix-bean, SU2 on servicemix-http)
>
> Everything deploys fine, no errors anywhere, but then when I try to access
> the above URL (locationURI) or the above URL plus ?wsdl, I get a 404 and
> no
> errors or traces or other hints anywhere. Changing the log level to DEBUG
> I've seen jetty saying that "chain = null", but I don't exactly understand
> why.
>
> Any help is welcome. Thanks in advance!
> --
> View this message in context:
> http://www.nabble.com/%3A---Can%27t-get-a-simple-connection-to-work-tp14903524s12049p14903524.html
> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>
>


-- 
Cheers,
Guillaume Nodet
------------------------
Blog: http://gnodet.blogspot.com/