Hi,

Your getMessageBody() method should return a StringSource, could you try it again?

Freeman

On 2010-5-18, at 下午10:30, Aditya Laddha wrote:


Thanks for prompt replies. Calling the cxf-nmr from nmr/client worked

But I am not able to call the sayHi method. it is giving following error.

ERROR:  'Source object passed to ''{0}'' has no contents.'

From the nmr/client I tried calling as below
e.getIn().setBody(getMessageBody());

and getMessageBody() method returns following string.
public String getMessageBody() {
return "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
"<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/ envelope/\">" +
"<soap:Body>" +
"<ns2:sayHi xmlns:ns2=\"http://cxf.examples.servicemix.apache.org/ \">" +
"<arg0>DATATOSENT</arg0>" +
"</ns2:sayHi>" +
"</soap:Body>" +
"</soap:Envelope>";
}

I also tried sending as jbi message as below
public String getMessageBody() {
return  "<jbi:message
xmlns:jbi='http://java.sun.com/xml/ns/jbi/wsdl-11-wrapper' "+
       "xmlns:msg='http://cxf.examples.servicemix.apache.org/'>"+
       "<jbi:part>"+
"<ns2:sayHi xmlns:ns2='http://cxf.examples.servicemix.apache.org/' >"
+
       "<arg0></arg0>"+
       "</ns2:sayHi>" +
       "</jbi:part>"+
       "</jbi:message>";
}


Please let us know how to package the message to call the sayHi Method of
cxf-nmr?

Thanks a ton,
Aditya


Freeman Fang wrote:

Hi,

You needn't give endpointName here.
The nmr endpoint name should be HelloWorld which follow nmr: prefix.

If you use "nmr:list" command, you can see the HelloWorld nmr endpoint
name in the list after you install examples-cxf-nmr feature.

Freeman
On 2010-5-18, at 下午9:16, Aditya Laddha wrote:


Thanks for comment cxf-nmr is deployed correctly.

How to give endpointname to cxf-nmr and use that to call from nmr/
client?

I have given an endpoint name to cxf-nmr as follows

<jaxws:endpoint id="helloWorld"
implementor="org.apache.servicemix.examples.cxf.HelloWorldImpl"
endpointName="MyHelloWorld"
address="nmr:HelloWorld" />


and changed the nmr/client to call the above end point as below
Reference ref =
nmr
.getEndpointRegistry().lookup(ServiceHelper.createMap(Endpoint.NAME,
"MyHelloWorld"));

It is giving the error as below.
org.apache.servicemix.nmr.api.ServiceMixException: Could not dispatch
exchange. No matching endpoints.
      at
org
.apache
.servicemix .nmr.core.FlowRegistryImpl.dispatch(FlowRegistryImpl.java:
110)
      at
org .apache.servicemix.nmr.core.ChannelImpl.dispatch(ChannelImpl.java:
286)
      at
org .apache.servicemix.nmr.core.ChannelImpl.sendSync(ChannelImpl.java:
141)
      at
org .apache.servicemix.nmr.core.ChannelImpl.sendSync(ChannelImpl.java:
127)
      at
org .apache.servicemix.nmr.examples.nmr.client.Client.run(Client.java:
88)
      at java.lang.Thread.run(Thread.java:619)


I also tried to change the cxf-nmr as follows
<osgi:service ref="helloWorld">
      <osgi:interfaces>
          <value>org.apache.servicemix.nmr.api.Endpoint</value>
      </osgi:interfaces>
      <osgi:service-properties>
          <entry key="NAME">
              <value>h1End</value>
          </entry>
      </osgi:service-properties>
  </osgi:service>

  <jaxws:endpoint id="helloWorld"
        implementor="org.apache.servicemix.examples.cxf.HelloWorldImpl"
      endpointName="MyHelloWorld"
        address="nmr:HelloWorld" />

and called from nmr/client as follows
Reference ref =
nmr
.getEndpointRegistry().lookup(ServiceHelper.createMap(Endpoint.NAME,
"h1End"));

This also gives the same exception
org.apache.servicemix.nmr.api.ServiceMixException: Could not dispatch
exchange. No matching endpoints.
      at
org
.apache
.servicemix .nmr.core.FlowRegistryImpl.dispatch(FlowRegistryImpl.java:
110)
      at
org .apache.servicemix.nmr.core.ChannelImpl.dispatch(ChannelImpl.java:
286)
      at
org .apache.servicemix.nmr.core.ChannelImpl.sendSync(ChannelImpl.java:
141)
      at
org .apache.servicemix.nmr.core.ChannelImpl.sendSync(ChannelImpl.java:
127)
      at
org .apache.servicemix.nmr.examples.nmr.client.Client.run(Client.java:
88)
      at java.lang.Thread.run(Thread.java:619)

How can I give a endpoingname to cxf-nmr and use it to call from nmr/
client?

Regards
-Aditya


Freeman Fang wrote:

Hi,

You should follow the README.txt to install that example, which means
you need use features:install.
Simply drop the jar to deploy folder isn't enough, as it need some
dependency features, such as cxf-nmr.

Freeman
On 2010-5-18, at 下午6:25, Aditya Laddha wrote:


Thanks for the comments. I was able to initialize the nmr and get
channel
now.

But :

I tried running the example cxf-nmr without any change. I copied the
compiled .jar file to deploy folder.
It gets installed but did not start automatically. so I have given
start
command. It gives following error

[ 510] [Active     ] [            ] [Started] [   60] Apache
ServiceMix NMR
Example:: NMR Client (1.2.0.fuse-01-00)
[ 517] [Installed  ] [            ] [       ] [   60] Apache
ServiceMix
Example :: CXF NMR (4.2.0.fuse-01-00)
ka...@root> start 517
The bundle could not be resolved. Reason: Missing Constraint:
Import-Package: META-INF.cxf.transport.nmr; version="0.0.0"

Please let me know what am I missing? Is there something wrong with
cxf-nmr
in (4.2.0.fuse-01-00)?

Regards,
-Aditya


Freeman Fang wrote:

Hi,

My comment inline
On 2010-5-14, at 下午9:30, Aditya Laddha wrote:


Hi All,

I am evaluating the service mix 4.2.

So I tried the following example.
examples\cxf-osgi

To check the performance of calling 2 services I created copy of
this
example as
examples\cxf-osgi1

and want to call "cxf-osgi1" from "cxf-osgi"

I tried
ComponentContext context;
DeliveryChannel channel;
to send the InOut message using "channel.sendSync(inOut);"
cxf-osgi expose jaxws:endpoint through osgi http service, so
basically
it handle incoming request from http transport, so you can't use
something like channel.sendSync(inOut)

But I am getting the channel or context as null.

What is the right way of calling the "cxf-osgi" example service
from
other
service?
How we can get the DeliveryChannel or ComponentContext in
"jaxws:endpoint"
service to call the other service?
If you expose jaxws:endpoint through NMR transport, then you can
use
some NMR client API(I believe it's what you want) to invoke it.
For how to expose jaxws:endpoint through NMR transport, take a look
at
cxf-nmr example we ship with kit.
For how to use NMR client API to invoke a nmr endpoint, take a look
at
nmr/client example we ship with kit.

Freeman

Thanks & Regards,
-Aditya
--
View this message in context:
http://old.nabble.com/How-to-get-the-DeliveryChannel-or-ComponentContext-in-%22jaxws%3Aendpoint%22-service-to-call-the-other-service--tp28559397p28559397.html
Sent from the ServiceMix - User mailing list archive at
Nabble.com.



--
Freeman Fang
------------------------
Open Source SOA: http://fusesource.com




--
View this message in context:
http://old.nabble.com/How-to-get-the-DeliveryChannel-or-ComponentContext-in-%22jaxws%3Aendpoint%22-service-to-call-the-other-service--tp28559397p28594063.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.



--
Freeman Fang
------------------------
Open Source SOA: http://fusesource.com




--
View this message in context:
http://old.nabble.com/How-to-get-the-DeliveryChannel-or-ComponentContext-in-%22jaxws%3Aendpoint%22-service-to-call-the-other-service--tp28559397p28595733.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.



--
Freeman Fang
------------------------
Open Source SOA: http://fusesource.com




--
View this message in context: 
http://old.nabble.com/How-to-get-the-DeliveryChannel-or-ComponentContext-in-%22jaxws%3Aendpoint%22-service-to-call-the-other-service--tp28559397p28596704.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.



--
Freeman Fang
------------------------
Open Source SOA: http://fusesource.com

Reply via email to