You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by SofiAs <so...@gmail.com> on 2010/01/20 17:37:01 UTC

accessing cxfbc-provider from a POJO

Hi,

I want to call(invoke) a cxfbc-provder which accesses external webservice
from my pojo which is deployed in bean.   The pojo looks something like

        InOut dsExchange1 = jbiClient.createInOutExchange();
        dsExchange1.setService(new
QName("http://www.webserviceX.NET","country"));
        dsExchange1.setInterfaceName(new
QName("http://www.webserviceX.NET","country"));
        dsExchange1.setOperation(new
QName("http://www.webserviceX.NET","GetGMTbyCountry"));
        dsExchange1.getInMessage().setContent(new StreamSource(new
StringReader(
         "<GetGMTbyCountry xmlns=\"http://www.webserviceX.NET">  
        <CountryName>Canada</CountryName>    
        </GetGMTbyCountry>")));
     
        jbiClient.send(dsExchange1);

       AND HERE IS THE CXF xbean
      <cxfbc:provider
          wsdl="classpath:gmt.wsdl"
          locationURI="http://localhost:8192/GetGMTbyCountry"
          service="webservicex:country"
          endpoint="countrySoap12"
          interfaceName="webservicex:country"
          useJBIWrapper="false"
         />
  
I am getting NULL as a response. Can you PLEASE HELP?      
-- 
View this message in context: http://old.nabble.com/accessing-cxfbc-provider-from-a-POJO-tp27244693p27244693.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: accessing cxfbc-provider from a POJO

Posted by SofiAs <so...@gmail.com>.

Okay another problem now, 
I am trying to get the "In" message from a bean and keep it on a file
sender. 
The routing goes fine. but it couldn't write the message on the file. 

Here is some part form the pojo.

                DeliveryChannel channel1 = context.getDeliveryChannel();
		InOnly dsExchange3=jbiClient.createInOnlyExchange();
		dsExchange3.setService(new
QName("http://project/integration","fileSender"));
	
dsExchange3.getInMessage().setContent(exchange.getMessage("in").getContent());
                jbiClient.send(dsExchange3);

Do I have to do some XML processing? 

      ERROR - FileComponent                  - An error occured while
writing file
C:\apache-servicemix-3.3.1\samples\received\servicemix-4734755648828
790750.xml, deleting the invalid file
ERROR - FileComponent                  - Error processing exchange InOnly[
  id: ID:192.168.8.3-126519033ee-2:7
  status: Active
  role: provider
  service: {http://project/integration}receiver
  endpoint: receiverEnd
  in: Unable to display: java.io.IOException: Stream closed
]
javax.jbi.messaging.MessagingException:
javax.xml.transform.TransformerException
: java.io.IOException: Stream closed
        at
org.apache.servicemix.components.util.DefaultFileMarshaler.writeMessa
geContent(DefaultFileMarshaler.java:153)
-- 
View this message in context: http://old.nabble.com/accessing-cxfbc-provider-from-a-POJO-tp27244693p27260133.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: accessing cxfbc-provider from a POJO

Posted by SofiAs <so...@gmail.com>.
Thanks!

I solved my problem. I just removed the URL and the main error was when
setting the interfaceName it should have been the same as the endpoint.
countrySoap12.
-- 
View this message in context: http://old.nabble.com/accessing-cxfbc-provider-from-a-POJO-tp27244693p27259908.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: accessing cxfbc-provider from a POJO

Posted by Freeman Fang <fr...@gmail.com>.
On 2010-1-21, at 上午12:37, SofiAs wrote:

>
> Hi,
>
> I want to call(invoke) a cxfbc-provder which accesses external  
> webservice
> from my pojo which is deployed in bean.   The pojo looks something  
> like
>
>        InOut dsExchange1 = jbiClient.createInOutExchange();
>        dsExchange1.setService(new
> QName("http://www.webserviceX.NET","country"));
>        dsExchange1.setInterfaceName(new
> QName("http://www.webserviceX.NET","country"));
>        dsExchange1.setOperation(new
> QName("http://www.webserviceX.NET","GetGMTbyCountry"));
>        dsExchange1.getInMessage().setContent(new StreamSource(new
> StringReader(
>         "<GetGMTbyCountry xmlns=\"http://www.webserviceX.NET">
>        <CountryName>Canada</CountryName>
>        </GetGMTbyCountry>")));
>
Hi,

This message payload has no jbi wrapper , also has no soap envelop.
I can't see your wsdl for cxf bc provider, but if the message payload  
is just soap body content, you can add useSOAPEnvelope="false" flag to  
your cxf bc provider configuration also.

Freeman
>        jbiClient.send(dsExchange1);
>
>       AND HERE IS THE CXF xbean
>      <cxfbc:provider
>          wsdl="classpath:gmt.wsdl"
>          locationURI="http://localhost:8192/GetGMTbyCountry"
>          service="webservicex:country"
>          endpoint="countrySoap12"
>          interfaceName="webservicex:country"
>          useJBIWrapper="false"
>         />
>
> I am getting NULL as a response. Can you PLEASE HELP?
> -- 
> View this message in context: http://old.nabble.com/accessing-cxfbc-provider-from-a-POJO-tp27244693p27244693.html
> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>


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