On 2010-6-3, at 上午4:09, Amigo_ wrote:



Freeman Fang wrote:

Hi,

My comment inline.
On 2010-6-2, at 上午2:41, Amigo_ wrote:



Freeman Fang wrote:

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


Hi, thanks for reply. I followed carefully this example and have
made some
changes to my bundle-context.xml It looks now like this:

<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";
        xmlns:cxfse="http://servicemix.apache.org/cxfse/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/spring
http://camel.apache.org/schema/spring/camel-spring.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
     http://servicemix.apache.org/cxfse/1.0
http://servicemix.apache.org/cxfse/1.0/servicemix-cxf-se.xsd";>

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

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

        <import resource="classpath:META-INF/cxf/cxf.xml" />
        <import resource="classpath:META-INF/cxf/cxf-extension-http-
jetty.xml" />
        <import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
        <import resource="classpath:META-INF/cxf/cxf-extension-http-
binding.xml" />
        <import resource="classpath:META-INF/cxf/cxf-extension-http-
jetty.xml" />

You have two
<import resource="classpath:META-INF/cxf/cxf-extension-http-
jetty.xml" />
here, you should replace one with
<import resource="classpath:META-INF/cxf/cxf-extension-http.xml" />

Freeman


Hi, thanks again for reply. I updated that path, but unfortunately it still
doesn't work. I have got an error about not having Provider
org.apache.axis2.jaxws.spi.Provider. I have fresh
This error is caused by you install wrong jaxws-api bundle.
You should use the one from servicemix, org.apache.servicemix.specs.jaxws-api-2.1. Could you check your bundle list? I guess there's a geronimo jaxws-api bundle, which shouldn't be there.

Freeman
apache-servicemix-4.2.0-fuse-01-00 installation with installed 2. additional
bundles:
org.apache.cxf/cxf-rt-frontend-jaxws
org.apache.geronimo.specs/geronimo-ws-metadata_2.0_spec
Do I need to install any others additional bundles or features?

Exeception stack:
Caused by: javax.xml.ws.spi.FactoryFinder$ConfigurationError: Provider
org.apache.axis2.jaxws.spi.Provider not found
        at javax.xml.ws.spi.FactoryFinder$2.run(FactoryFinder.java:135)
at javax.xml.ws.spi.FactoryFinder.doPrivileged(FactoryFinder.java: 273)
        at javax.xml.ws.spi.FactoryFinder.newInstance(FactoryFinder.java:122)
        at javax.xml.ws.spi.FactoryFinder.access$200(FactoryFinder.java:42)
        at javax.xml.ws.spi.FactoryFinder$3.run(FactoryFinder.java:264)
at javax.xml.ws.spi.FactoryFinder.doPrivileged(FactoryFinder.java: 273)
        at javax.xml.ws.spi.FactoryFinder.find(FactoryFinder.java:165)
        at javax.xml.ws.spi.Provider.provider(Provider.java:39)
        at javax.xml.ws.Service.<init>(Service.java:36)
at com.amigo.cxf.Translator_Service.<init>(Translator_Service.java: 52) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at
sun .reflect .NativeConstructorAccessorImpl .newInstance(NativeConstructorAccessorImpl.java:57)
        at
sun .reflect .DelegatingConstructorAccessorImpl .newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:532)
at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java: 100)
        ... 28 more


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



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

Reply via email to