Hi,

My comment inline.
On 2010-6-1, at 上午4:24, Amigo_ wrote:



Freeman Fang wrote:


On 2010-5-30, at 下午11:54, Amigo_ wrote:


Hi,

I need to invoke external web service from SE. I've generated codes
for
client using Apache CXF, but any invocations are blocked by
servicemix.

I've searched this forum and I've read that there should a binding
component
between my SE and WS, but I can hardly find any tutorials. I will be
very
glad if someone could post any links to tutorials or just clues
explaining
how to ensure communication with external ws over servicemix.

Hi,
In your case you need a cxf bc provider endpoint, so the flow looks like

SE-->cxf bc providier--> external ws,

You may need take a look at CxfBcProviderTest to get details about how
it works.

[1]https://svn.apache.org/repos/asf/servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/java/org/apache/servicemix/cxfbc/CxfBcProviderTest.java

Freeman


Thanks for reply, but I can't make this works yet. I've searched internet
and found similar post with link to this CxfBcProviderTest.java.

So we need to create raw SOAP message in order to pass data instead
of
directly deal with a JavaBean

No, you needn't create raw soap message yourself.
The raw soap message you saw in the test case is just a simple way to invoke the cxf se, it's not the key point of that test case. The key point of that test case is cxf se can hold proxy of cxf bc provider so
that you can invoke external webservice

I assume I have to define cxf bc provider and managed to communicate with my
generated from wsdl cxf client. I added to my bundle-context.xml -
cxfbc:provider and it looks like:

<beans xmlns="http://www.springframework.org/schema/beans";
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xmlns:osgi="http://www.springframework.org/schema/osgi";
        xmlns:camel-osgi="http://camel.apache.org/schema/osgi";
xmlns:cxfbc="http://servicemix.apache.org/cxfbc/1.0";
        xsi:schemaLocation="
      http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
      http://www.springframework.org/schema/osgi
http://www.springframework.org/schema/osgi/spring-osgi.xsd
      http://camel.apache.org/schema/osgi
http://camel.apache.org/schema/osgi/camel-osgi.xsd
      http://servicemix.apache.org/cxfbc/1.0
http://servicemix.apache.org/cxfbc/1.0/servicemix-cxf-bc.xsd";>

<camel-osgi:camelContext xmlns="http://camel.apache.org/schema/ spring">
                <route>
                        <from 
uri="timer://myTimer?fixedRate=true&amp;period=30000" />
                        <bean ref="translator" method="translate" />
                </route>
        </camel-osgi:camelContext>

        <bean class="com.amigo.cxf.TranslatorClient" id="translator" />

<cxfbc:provider wsdl="http://localhost:9090/Translator/translate? WSDL"
                locationURI="http://localhost:9090/Translator/translate";
                endpoint="tns:translatorSOAP" service="translatorSOAP">
        </cxfbc:provider>

</beans>
One obvious problem I can tell now is you need add
<bean class="org.apache.servicemix.common.osgi.EndpointExporter" />
when you use jbi endpoint in osgi container.
You may need take a look at cxf-wsdl-first-osgi-package example shipped with kit to get idea how jbi endpoint works with osgi package.

Freeman

But when I run this I got error:

22:18:02,423 | ERROR | myTimer | BusFactory | ache.cxf.common.logging.LogUtils 361 | Failed to instantiate bus factory.
java.lang.ClassCastException: class org.apache.cxf.bus.CXFBusFactory
        at java.lang.Class.asSubclass(Class.java:3039)
        at org.apache.cxf.BusFactory.newInstance(BusFactory.java:164)
        at org.apache.cxf.BusFactory.newInstance(BusFactory.java:140)
        at org.apache.cxf.BusFactory.getDefaultBus(BusFactory.java:69)
        at org.apache.cxf.BusFactory.getThreadDefaultBus(BusFactory.java:106)
        at org.apache.cxf.BusFactory.getThreadDefaultBus(BusFactory.java:97)
        at
org .apache .cxf.jaxws.spi.ProviderImpl.createServiceDelegate(ProviderImpl.java: 64)
        at javax.xml.ws.Service.<init>(Service.java:36)
...


--
View this message in context: 
http://old.nabble.com/Invoking-external-web-service-from-SE-tp28722871p28734772.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.



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

Reply via email to