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" 
/>

        <cxfse:endpoint>
                <cxfse:pojo>
                        <bean class="com.amigo.cxf.Translator_Service" />
                </cxfse:pojo>
        </cxfse:endpoint>

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

        <bean class="org.apache.servicemix.common.osgi.EndpointExporter" />

</beans>

But unfortunately it still doesn't work. Now I have error about no conduit
initiatior. As far as I could searched in internet it could be caused by
lack of the cxf-rt-transports-http-jetty dependency - but i added. 
20:29:44,990 | ERROR | myTimer          | DefaultErrorHandler              |
rg.apache.camel.processor.Logger  248 | Failed delivery for exchangeId:
8a7feae2-5d6e-4e48-af34-1c8721c4dc97. Exhausted after delivery attempt: 1
caught: javax.xml.ws.soap.SOAPFaultException: No conduit initiator was found
for the namespace http://schemas.xmlsoap.org/soap/http.
javax.xml.ws.soap.SOAPFaultException: No conduit initiator was found for the
namespace http://schemas.xmlsoap.org/soap/http.
        at 
org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:146)
        at $Proxy142.translate(Unknown Source)
        at com.amigo.cxf.TranslatorClient.translate(TranslatorClient.java:28)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:616)
        at 
org.apache.camel.component.bean.MethodInfo.invoke(MethodInfo.java:214)
        at
org.apache.camel.component.bean.MethodInfo$1.proceed(MethodInfo.java:133)
        at
org.apache.camel.component.bean.BeanProcessor.process(BeanProcessor.java:137)
        at
org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:67)
        at
org.apache.camel.processor.DelegateProcessor.processNext(DelegateProcessor.java:53)
        at
org.apache.camel.processor.DelegateProcessor.proceed(DelegateProcessor.java:82)
        at
org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:93)
        at
org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:67)
        at
org.apache.camel.processor.RedeliveryErrorHandler.processExchange(RedeliveryErrorHandler.java:177)
        at
org.apache.camel.processor.RedeliveryErrorHandler.processErrorHandler(RedeliveryErrorHandler.java:143)
        at
org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:88)
        at
org.apache.camel.processor.DefaultErrorHandler.process(DefaultErrorHandler.java:49)
        at
org.apache.camel.processor.DefaultChannel.process(DefaultChannel.java:228)
        at
org.apache.camel.processor.UnitOfWorkProcessor.processNext(UnitOfWorkProcessor.java:66)
        at
org.apache.camel.processor.DelegateProcessor.process(DelegateProcessor.java:48)
        at
org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:67)
        at
org.apache.camel.component.timer.TimerConsumer.sendTimerExchange(TimerConsumer.java:103)
        at
org.apache.camel.component.timer.TimerConsumer$1.run(TimerConsumer.java:50)
        at java.util.TimerThread.mainLoop(Timer.java:534)
        at java.util.TimerThread.run(Timer.java:484)
Caused by: org.apache.cxf.BusException: No conduit initiator was found for
the namespace http://schemas.xmlsoap.org/soap/http.
        at
org.apache.cxf.transport.ConduitInitiatorManagerImpl.getConduitInitiator(ConduitInitiatorManagerImpl.java:112)
        at
org.apache.cxf.endpoint.AbstractConduitSelector.getSelectedConduit(AbstractConduitSelector.java:73)
        at
org.apache.cxf.endpoint.UpfrontConduitSelector.prepare(UpfrontConduitSelector.java:61)
        at
org.apache.cxf.endpoint.ClientImpl.prepareConduitSelector(ClientImpl.java:715)
        at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:478)
        at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:310)
        at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:262)
        at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:73)
        at 
org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:124)
        ... 26 more


My earlier error with org.apache.cxf.bus.CXFBusFactory was probably caused
by cxf-bundle - because my own web service after installation of this bundle
started to output same error, so uninstalled this bundle.
-- 
View this message in context: 
http://old.nabble.com/Invoking-external-web-service-from-SE-tp28722871p28745838.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.

Reply via email to