You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@camel.apache.org by "Charles Moulliard (JIRA)" <ji...@apache.org> on 2009/03/06 16:48:44 UTC

[jira] Created: (CAMEL-1431) camel-cxf and spring DSL does not work very well

camel-cxf and spring DSL does not work very well
------------------------------------------------

                 Key: CAMEL-1431
                 URL: https://issues.apache.org/activemq/browse/CAMEL-1431
             Project: Apache Camel
          Issue Type: Sub-task
          Components: camel-cxf
    Affects Versions: 2.0-M1
            Reporter: Charles Moulliard


Hi,

Camel-cxf and camel works very well when the routing is defined like this :

public class ReportIncidentRoutes extends RouteBuilder {

    public void configure() throws Exception {
        // webservice response for OK
        OutputReportIncident OK = new OutputReportIncident();
        OK.setCode("0");

        // endpoint to our CXF webservice
        String cxfEndpoint = "cxf://http://localhost:8080/camel-example/incident"
                + "?serviceClass=org.apache.camel.example.reportincident.ReportIncidentEndpoint"
                + "&wsdlURL=wsdl/report_incident.wsdl";

        // first part from the webservice -> file backup
        from(cxfEndpoint)
            // we need to convert the CXF payload to InputReportIncident that FilenameGenerator and velocity expects
            .convertBodyTo(InputReportIncident.class)
            // return OK as response
            .transform(constant(OK));

    }

@ContextConfiguration
public class ReportIncidentRoutesTest extends AbstractJUnit4SpringContextTests  {
	
	private static final transient Log LOG = LogFactory.getLog(ReportIncidentRoutesTest.class);
	
    @Autowired
    protected CamelContext camelContext;

    // should be the same address as we have in our route
    private final static String ADDRESS = "http://localhost:8080/camel-example/incident";
    //private final static QName endpointName = new QName("http://reportincident.example.camel.apache.org", "ReportIncidentEndpoint"); 

    protected static ReportIncidentEndpoint createCXFClient() {
        // we use CXF to create a client for us as its easier than JAXWS and works
        JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
        factory.setServiceClass(ReportIncidentEndpoint.class);
        factory.setAddress(ADDRESS);
        //factory.setEndpointName(endpointName);
        return (ReportIncidentEndpoint) factory.create();
    }

    @Test
    public void testRendportIncident() throws Exception {
    	
    	assertNotNull(camelContext);

        // create input parameter
        InputReportIncident input = new InputReportIncident();
        input.setIncidentId("123");
        input.setIncidentDate("2008-08-18");
        input.setGivenName("Claus");
        input.setFamilyName("Ibsen");
        input.setSummary("Bla");
        input.setDetails("Bla bla");
        input.setEmail("davsclaus@apache.org");
        input.setPhone("0045 2962 7576");

        // create the webservice client and send the request
        ReportIncidentEndpoint client = createCXFClient();    
        OutputReportIncident out = client.reportIncident(input);

        // assert we got a OK back
        assertEquals("0", out.getCode());

    }
    

}


but not when the routing is defined in spring DSL

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xmlns:camel="http://camel.apache.org/schema/spring"
	xmlns:cxf="http://camel.apache.org/schema/cxf"
	xsi:schemaLocation=" http://www.springframework.org/schema/beans
		http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
		http://camel.apache.org/schema/osgi
		http://camel.apache.org/schema/osgi/camel-osgi.xsd
		http://camel.apache.org/schema/spring
		http://camel.apache.org/schema/spring/camel-spring.xsd
		http://camel.apache.org/schema/cxf
		http://camel.apache.org/schema/cxf/camel-cxf.xsd">
		
    <bean id="webService" class="org.apache.camel.example.reportincident.beans.WebService" />
	
	<bean id="OK" class="org.apache.camel.example.reportincident.OutputReportIncident">
		<property name="code" value="0"/>
	</bean>
	
    <!-- webservice endpoint  -->          
    <cxf:cxfEndpoint id="reportIncident"
                     address="http://localhost:8080/camel-example/incident"
                     wsdlURL="wsdl/report_incident.wsdl"
                     serviceClass="org.apache.camel.example.reportincident.ReportIncidentEndpoint"
                     xmlns:s="http://reportincident.example.camel.apache.org">
    </cxf:cxfEndpoint>
     

	<camelContext trace="true" xmlns="http://camel.apache.org/schema/osgi">
		<camel:package>org.apache.camel.example.reportincident.routing</camel:package>
		
		<!-- CXF route -->
		<camel:route>
			<camel:from uri="cxf:bean:reportIncident" />
			<camel:convertBodyTo type="org.apache.camel.example.reportincident.InputReportIncident" />
			<camel:transform>
			    <camel:method bean="OK" method="code"/>
			</camel:transform>
		</camel:route>
		 
		 
	</camelContext>
</beans>

In debugging mode, I see that the outputreportincident object is null when we call the method declared in the web service. So something happens with Spring & Cxf.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CAMEL-1431) camel-cxf and spring DSL does not work very well

Posted by "Charles Moulliard (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/CAMEL-1431?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=50467#action_50467 ] 

Charles Moulliard commented on CAMEL-1431:
------------------------------------------

I will remove it and retry

> camel-cxf and spring DSL does not work very well
> ------------------------------------------------
>
>                 Key: CAMEL-1431
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-1431
>             Project: Apache Camel
>          Issue Type: Sub-task
>          Components: camel-cxf
>    Affects Versions: 2.0-M1
>            Reporter: Charles Moulliard
>            Assignee: Willem Jiang
>
> Hi,
> Camel-cxf and camel works very well when the routing is defined like this :
> {code}
> public class ReportIncidentRoutes extends RouteBuilder {
>     public void configure() throws Exception {
>         // webservice response for OK
>         OutputReportIncident OK = new OutputReportIncident();
>         OK.setCode("0");
>         // endpoint to our CXF webservice
>         String cxfEndpoint = "cxf://http://localhost:8080/camel-example/incident"
>                 + "?serviceClass=org.apache.camel.example.reportincident.ReportIncidentEndpoint"
>                 + "&wsdlURL=wsdl/report_incident.wsdl";
>         // first part from the webservice -> file backup
>         from(cxfEndpoint)
>             // we need to convert the CXF payload to InputReportIncident that FilenameGenerator and velocity expects
>             .convertBodyTo(InputReportIncident.class)
>             // return OK as response
>             .transform(constant(OK));
>     }
> @ContextConfiguration
> public class ReportIncidentRoutesTest extends AbstractJUnit4SpringContextTests  {
> 	
> 	private static final transient Log LOG = LogFactory.getLog(ReportIncidentRoutesTest.class);
> 	
>     @Autowired
>     protected CamelContext camelContext;
>     // should be the same address as we have in our route
>     private final static String ADDRESS = "http://localhost:8080/camel-example/incident";
>     //private final static QName endpointName = new QName("http://reportincident.example.camel.apache.org", "ReportIncidentEndpoint"); 
>     protected static ReportIncidentEndpoint createCXFClient() {
>         // we use CXF to create a client for us as its easier than JAXWS and works
>         JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
>         factory.setServiceClass(ReportIncidentEndpoint.class);
>         factory.setAddress(ADDRESS);
>         //factory.setEndpointName(endpointName);
>         return (ReportIncidentEndpoint) factory.create();
>     }
>     @Test
>     public void testRendportIncident() throws Exception {
>     	
>     	assertNotNull(camelContext);
>         // create input parameter
>         InputReportIncident input = new InputReportIncident();
>         input.setIncidentId("123");
>         input.setIncidentDate("2008-08-18");
>         input.setGivenName("Claus");
>         input.setFamilyName("Ibsen");
>         input.setSummary("Bla");
>         input.setDetails("Bla bla");
>         input.setEmail("davsclaus@apache.org");
>         input.setPhone("0045 2962 7576");
>         // create the webservice client and send the request
>         ReportIncidentEndpoint client = createCXFClient();    
>         OutputReportIncident out = client.reportIncident(input);
>         // assert we got a OK back
>         assertEquals("0", out.getCode());
>     }
>     
> }
>  {code}
> but not when the routing is defined in spring DSL
>  {code}
> <?xml version="1.0" encoding="UTF-8"?>
> <beans xmlns="http://www.springframework.org/schema/beans"
> 	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> 	xmlns:camel="http://camel.apache.org/schema/spring"
> 	xmlns:cxf="http://camel.apache.org/schema/cxf"
> 	xsi:schemaLocation=" http://www.springframework.org/schema/beans
> 		http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
> 		http://camel.apache.org/schema/osgi
> 		http://camel.apache.org/schema/osgi/camel-osgi.xsd
> 		http://camel.apache.org/schema/spring
> 		http://camel.apache.org/schema/spring/camel-spring.xsd
> 		http://camel.apache.org/schema/cxf
> 		http://camel.apache.org/schema/cxf/camel-cxf.xsd">
> 		
>     <bean id="webService" class="org.apache.camel.example.reportincident.beans.WebService" />
> 	
> 	<bean id="OK" class="org.apache.camel.example.reportincident.OutputReportIncident">
> 		<property name="code" value="0"/>
> 	</bean>
> 	
>     <!-- webservice endpoint  -->          
>     <cxf:cxfEndpoint id="reportIncident"
>                      address="http://localhost:8080/camel-example/incident"
>                      wsdlURL="wsdl/report_incident.wsdl"
>                      serviceClass="org.apache.camel.example.reportincident.ReportIncidentEndpoint"
>                      xmlns:s="http://reportincident.example.camel.apache.org">
>     </cxf:cxfEndpoint>
>      
> 	<camelContext trace="true" xmlns="http://camel.apache.org/schema/osgi">
> 		<camel:package>org.apache.camel.example.reportincident.routing</camel:package>
> 		
> 		<!-- CXF route -->
> 		<camel:route>
> 			<camel:from uri="cxf:bean:reportIncident" />
> 			<camel:convertBodyTo type="org.apache.camel.example.reportincident.InputReportIncident" />
> 			<camel:transform>
> 			    <camel:method bean="OK" method="code"/>
> 			</camel:transform>
> 		</camel:route>
> 		 
> 		 
> 	</camelContext>
> </beans>
>  {code}
> In debugging mode, I see that the outputreportincident object is null when we call the method declared in the web service. So something happens with Spring & Cxf.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CAMEL-1431) camel-cxf and spring DSL does not work very well

Posted by "Willem Jiang (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/CAMEL-1431?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=50455#action_50455 ] 

Willem Jiang commented on CAMEL-1431:
-------------------------------------

Hi Charles,

Why are you still keeping the below part in the camel context ?
{code}
   <camel:package>org.apache.camel.example.reportincident.routing</camel:package>
{code}

Your camel context will  have 2 same routing rules.
Please remove it and try again.

Willem



> camel-cxf and spring DSL does not work very well
> ------------------------------------------------
>
>                 Key: CAMEL-1431
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-1431
>             Project: Apache Camel
>          Issue Type: Sub-task
>          Components: camel-cxf
>    Affects Versions: 2.0-M1
>            Reporter: Charles Moulliard
>            Assignee: Willem Jiang
>
> Hi,
> Camel-cxf and camel works very well when the routing is defined like this :
> {code}
> public class ReportIncidentRoutes extends RouteBuilder {
>     public void configure() throws Exception {
>         // webservice response for OK
>         OutputReportIncident OK = new OutputReportIncident();
>         OK.setCode("0");
>         // endpoint to our CXF webservice
>         String cxfEndpoint = "cxf://http://localhost:8080/camel-example/incident"
>                 + "?serviceClass=org.apache.camel.example.reportincident.ReportIncidentEndpoint"
>                 + "&wsdlURL=wsdl/report_incident.wsdl";
>         // first part from the webservice -> file backup
>         from(cxfEndpoint)
>             // we need to convert the CXF payload to InputReportIncident that FilenameGenerator and velocity expects
>             .convertBodyTo(InputReportIncident.class)
>             // return OK as response
>             .transform(constant(OK));
>     }
> @ContextConfiguration
> public class ReportIncidentRoutesTest extends AbstractJUnit4SpringContextTests  {
> 	
> 	private static final transient Log LOG = LogFactory.getLog(ReportIncidentRoutesTest.class);
> 	
>     @Autowired
>     protected CamelContext camelContext;
>     // should be the same address as we have in our route
>     private final static String ADDRESS = "http://localhost:8080/camel-example/incident";
>     //private final static QName endpointName = new QName("http://reportincident.example.camel.apache.org", "ReportIncidentEndpoint"); 
>     protected static ReportIncidentEndpoint createCXFClient() {
>         // we use CXF to create a client for us as its easier than JAXWS and works
>         JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
>         factory.setServiceClass(ReportIncidentEndpoint.class);
>         factory.setAddress(ADDRESS);
>         //factory.setEndpointName(endpointName);
>         return (ReportIncidentEndpoint) factory.create();
>     }
>     @Test
>     public void testRendportIncident() throws Exception {
>     	
>     	assertNotNull(camelContext);
>         // create input parameter
>         InputReportIncident input = new InputReportIncident();
>         input.setIncidentId("123");
>         input.setIncidentDate("2008-08-18");
>         input.setGivenName("Claus");
>         input.setFamilyName("Ibsen");
>         input.setSummary("Bla");
>         input.setDetails("Bla bla");
>         input.setEmail("davsclaus@apache.org");
>         input.setPhone("0045 2962 7576");
>         // create the webservice client and send the request
>         ReportIncidentEndpoint client = createCXFClient();    
>         OutputReportIncident out = client.reportIncident(input);
>         // assert we got a OK back
>         assertEquals("0", out.getCode());
>     }
>     
> }
>  {code}
> but not when the routing is defined in spring DSL
>  {code}
> <?xml version="1.0" encoding="UTF-8"?>
> <beans xmlns="http://www.springframework.org/schema/beans"
> 	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> 	xmlns:camel="http://camel.apache.org/schema/spring"
> 	xmlns:cxf="http://camel.apache.org/schema/cxf"
> 	xsi:schemaLocation=" http://www.springframework.org/schema/beans
> 		http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
> 		http://camel.apache.org/schema/osgi
> 		http://camel.apache.org/schema/osgi/camel-osgi.xsd
> 		http://camel.apache.org/schema/spring
> 		http://camel.apache.org/schema/spring/camel-spring.xsd
> 		http://camel.apache.org/schema/cxf
> 		http://camel.apache.org/schema/cxf/camel-cxf.xsd">
> 		
>     <bean id="webService" class="org.apache.camel.example.reportincident.beans.WebService" />
> 	
> 	<bean id="OK" class="org.apache.camel.example.reportincident.OutputReportIncident">
> 		<property name="code" value="0"/>
> 	</bean>
> 	
>     <!-- webservice endpoint  -->          
>     <cxf:cxfEndpoint id="reportIncident"
>                      address="http://localhost:8080/camel-example/incident"
>                      wsdlURL="wsdl/report_incident.wsdl"
>                      serviceClass="org.apache.camel.example.reportincident.ReportIncidentEndpoint"
>                      xmlns:s="http://reportincident.example.camel.apache.org">
>     </cxf:cxfEndpoint>
>      
> 	<camelContext trace="true" xmlns="http://camel.apache.org/schema/osgi">
> 		<camel:package>org.apache.camel.example.reportincident.routing</camel:package>
> 		
> 		<!-- CXF route -->
> 		<camel:route>
> 			<camel:from uri="cxf:bean:reportIncident" />
> 			<camel:convertBodyTo type="org.apache.camel.example.reportincident.InputReportIncident" />
> 			<camel:transform>
> 			    <camel:method bean="OK" method="code"/>
> 			</camel:transform>
> 		</camel:route>
> 		 
> 		 
> 	</camelContext>
> </beans>
>  {code}
> In debugging mode, I see that the outputreportincident object is null when we call the method declared in the web service. So something happens with Spring & Cxf.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CAMEL-1431) camel-cxf and spring DSL does not work very well

Posted by "Charles Moulliard (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/CAMEL-1431?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=50609#action_50609 ] 

Charles Moulliard commented on CAMEL-1431:
------------------------------------------

It works when of course I use the string cxf://http://localhost:8080/part-five/webservices/incident ... to declare the cxf endpoint but not when using <cxf:cxfEndpoint ...) in combination with what you propose. 

{code}
class MyBean {
public OutputReportIncident setOK() {
     OutputReportIncident. outputReportIncident = new OutputReportIncident();
     outputReportIncident.setCode("0");
      retrun outputReportIncident;
}
{code}

Can you tell me why implementation proposed by Claus in its tutorial does not work ?

Any idea about the error : java.lang.IllegalStateException: BeanFactory not initialized or already closed - call 'refresh' before accessing beans via the ApplicationContext

> camel-cxf and spring DSL does not work very well
> ------------------------------------------------
>
>                 Key: CAMEL-1431
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-1431
>             Project: Apache Camel
>          Issue Type: Sub-task
>          Components: camel-cxf
>    Affects Versions: 2.0-M1
>            Reporter: Charles Moulliard
>            Assignee: Willem Jiang
>
> Hi,
> Camel-cxf and camel works very well when the routing is defined like this :
> {code}
> public class ReportIncidentRoutes extends RouteBuilder {
>     public void configure() throws Exception {
>         // webservice response for OK
>         OutputReportIncident OK = new OutputReportIncident();
>         OK.setCode("0");
>         // endpoint to our CXF webservice
>         String cxfEndpoint = "cxf://http://localhost:8080/camel-example/incident"
>                 + "?serviceClass=org.apache.camel.example.reportincident.ReportIncidentEndpoint"
>                 + "&wsdlURL=wsdl/report_incident.wsdl";
>         // first part from the webservice -> file backup
>         from(cxfEndpoint)
>             // we need to convert the CXF payload to InputReportIncident that FilenameGenerator and velocity expects
>             .convertBodyTo(InputReportIncident.class)
>             // return OK as response
>             .transform(constant(OK));
>     }
> @ContextConfiguration
> public class ReportIncidentRoutesTest extends AbstractJUnit4SpringContextTests  {
> 	
> 	private static final transient Log LOG = LogFactory.getLog(ReportIncidentRoutesTest.class);
> 	
>     @Autowired
>     protected CamelContext camelContext;
>     // should be the same address as we have in our route
>     private final static String ADDRESS = "http://localhost:8080/camel-example/incident";
>     //private final static QName endpointName = new QName("http://reportincident.example.camel.apache.org", "ReportIncidentEndpoint"); 
>     protected static ReportIncidentEndpoint createCXFClient() {
>         // we use CXF to create a client for us as its easier than JAXWS and works
>         JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
>         factory.setServiceClass(ReportIncidentEndpoint.class);
>         factory.setAddress(ADDRESS);
>         //factory.setEndpointName(endpointName);
>         return (ReportIncidentEndpoint) factory.create();
>     }
>     @Test
>     public void testRendportIncident() throws Exception {
>     	
>     	assertNotNull(camelContext);
>         // create input parameter
>         InputReportIncident input = new InputReportIncident();
>         input.setIncidentId("123");
>         input.setIncidentDate("2008-08-18");
>         input.setGivenName("Claus");
>         input.setFamilyName("Ibsen");
>         input.setSummary("Bla");
>         input.setDetails("Bla bla");
>         input.setEmail("davsclaus@apache.org");
>         input.setPhone("0045 2962 7576");
>         // create the webservice client and send the request
>         ReportIncidentEndpoint client = createCXFClient();    
>         OutputReportIncident out = client.reportIncident(input);
>         // assert we got a OK back
>         assertEquals("0", out.getCode());
>     }
>     
> }
>  {code}
> but not when the routing is defined in spring DSL
>  {code}
> <?xml version="1.0" encoding="UTF-8"?>
> <beans xmlns="http://www.springframework.org/schema/beans"
> 	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> 	xmlns:camel="http://camel.apache.org/schema/spring"
> 	xmlns:cxf="http://camel.apache.org/schema/cxf"
> 	xsi:schemaLocation=" http://www.springframework.org/schema/beans
> 		http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
> 		http://camel.apache.org/schema/osgi
> 		http://camel.apache.org/schema/osgi/camel-osgi.xsd
> 		http://camel.apache.org/schema/spring
> 		http://camel.apache.org/schema/spring/camel-spring.xsd
> 		http://camel.apache.org/schema/cxf
> 		http://camel.apache.org/schema/cxf/camel-cxf.xsd">
> 		
>     <bean id="webService" class="org.apache.camel.example.reportincident.beans.WebService" />
> 	
> 	<bean id="OK" class="org.apache.camel.example.reportincident.OutputReportIncident">
> 		<property name="code" value="0"/>
> 	</bean>
> 	
>     <!-- webservice endpoint  -->          
>     <cxf:cxfEndpoint id="reportIncident"
>                      address="http://localhost:8080/camel-example/incident"
>                      wsdlURL="wsdl/report_incident.wsdl"
>                      serviceClass="org.apache.camel.example.reportincident.ReportIncidentEndpoint"
>                      xmlns:s="http://reportincident.example.camel.apache.org">
>     </cxf:cxfEndpoint>
>      
> 	<camelContext trace="true" xmlns="http://camel.apache.org/schema/osgi">
> 		<camel:package>org.apache.camel.example.reportincident.routing</camel:package>
> 		
> 		<!-- CXF route -->
> 		<camel:route>
> 			<camel:from uri="cxf:bean:reportIncident" />
> 			<camel:convertBodyTo type="org.apache.camel.example.reportincident.InputReportIncident" />
> 			<camel:transform>
> 			    <camel:method bean="OK" method="code"/>
> 			</camel:transform>
> 		</camel:route>
> 		 
> 		 
> 	</camelContext>
> </beans>
>  {code}
> In debugging mode, I see that the outputreportincident object is null when we call the method declared in the web service. So something happens with Spring & Cxf.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Assigned: (CAMEL-1431) camel-cxf and spring DSL does not work very well

Posted by "Willem Jiang (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/CAMEL-1431?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Willem Jiang reassigned CAMEL-1431:
-----------------------------------

    Assignee: Willem Jiang

> camel-cxf and spring DSL does not work very well
> ------------------------------------------------
>
>                 Key: CAMEL-1431
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-1431
>             Project: Apache Camel
>          Issue Type: Sub-task
>          Components: camel-cxf
>    Affects Versions: 2.0-M1
>            Reporter: Charles Moulliard
>            Assignee: Willem Jiang
>
> Hi,
> Camel-cxf and camel works very well when the routing is defined like this :
> public class ReportIncidentRoutes extends RouteBuilder {
>     public void configure() throws Exception {
>         // webservice response for OK
>         OutputReportIncident OK = new OutputReportIncident();
>         OK.setCode("0");
>         // endpoint to our CXF webservice
>         String cxfEndpoint = "cxf://http://localhost:8080/camel-example/incident"
>                 + "?serviceClass=org.apache.camel.example.reportincident.ReportIncidentEndpoint"
>                 + "&wsdlURL=wsdl/report_incident.wsdl";
>         // first part from the webservice -> file backup
>         from(cxfEndpoint)
>             // we need to convert the CXF payload to InputReportIncident that FilenameGenerator and velocity expects
>             .convertBodyTo(InputReportIncident.class)
>             // return OK as response
>             .transform(constant(OK));
>     }
> @ContextConfiguration
> public class ReportIncidentRoutesTest extends AbstractJUnit4SpringContextTests  {
> 	
> 	private static final transient Log LOG = LogFactory.getLog(ReportIncidentRoutesTest.class);
> 	
>     @Autowired
>     protected CamelContext camelContext;
>     // should be the same address as we have in our route
>     private final static String ADDRESS = "http://localhost:8080/camel-example/incident";
>     //private final static QName endpointName = new QName("http://reportincident.example.camel.apache.org", "ReportIncidentEndpoint"); 
>     protected static ReportIncidentEndpoint createCXFClient() {
>         // we use CXF to create a client for us as its easier than JAXWS and works
>         JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
>         factory.setServiceClass(ReportIncidentEndpoint.class);
>         factory.setAddress(ADDRESS);
>         //factory.setEndpointName(endpointName);
>         return (ReportIncidentEndpoint) factory.create();
>     }
>     @Test
>     public void testRendportIncident() throws Exception {
>     	
>     	assertNotNull(camelContext);
>         // create input parameter
>         InputReportIncident input = new InputReportIncident();
>         input.setIncidentId("123");
>         input.setIncidentDate("2008-08-18");
>         input.setGivenName("Claus");
>         input.setFamilyName("Ibsen");
>         input.setSummary("Bla");
>         input.setDetails("Bla bla");
>         input.setEmail("davsclaus@apache.org");
>         input.setPhone("0045 2962 7576");
>         // create the webservice client and send the request
>         ReportIncidentEndpoint client = createCXFClient();    
>         OutputReportIncident out = client.reportIncident(input);
>         // assert we got a OK back
>         assertEquals("0", out.getCode());
>     }
>     
> }
> but not when the routing is defined in spring DSL
> <?xml version="1.0" encoding="UTF-8"?>
> <beans xmlns="http://www.springframework.org/schema/beans"
> 	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> 	xmlns:camel="http://camel.apache.org/schema/spring"
> 	xmlns:cxf="http://camel.apache.org/schema/cxf"
> 	xsi:schemaLocation=" http://www.springframework.org/schema/beans
> 		http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
> 		http://camel.apache.org/schema/osgi
> 		http://camel.apache.org/schema/osgi/camel-osgi.xsd
> 		http://camel.apache.org/schema/spring
> 		http://camel.apache.org/schema/spring/camel-spring.xsd
> 		http://camel.apache.org/schema/cxf
> 		http://camel.apache.org/schema/cxf/camel-cxf.xsd">
> 		
>     <bean id="webService" class="org.apache.camel.example.reportincident.beans.WebService" />
> 	
> 	<bean id="OK" class="org.apache.camel.example.reportincident.OutputReportIncident">
> 		<property name="code" value="0"/>
> 	</bean>
> 	
>     <!-- webservice endpoint  -->          
>     <cxf:cxfEndpoint id="reportIncident"
>                      address="http://localhost:8080/camel-example/incident"
>                      wsdlURL="wsdl/report_incident.wsdl"
>                      serviceClass="org.apache.camel.example.reportincident.ReportIncidentEndpoint"
>                      xmlns:s="http://reportincident.example.camel.apache.org">
>     </cxf:cxfEndpoint>
>      
> 	<camelContext trace="true" xmlns="http://camel.apache.org/schema/osgi">
> 		<camel:package>org.apache.camel.example.reportincident.routing</camel:package>
> 		
> 		<!-- CXF route -->
> 		<camel:route>
> 			<camel:from uri="cxf:bean:reportIncident" />
> 			<camel:convertBodyTo type="org.apache.camel.example.reportincident.InputReportIncident" />
> 			<camel:transform>
> 			    <camel:method bean="OK" method="code"/>
> 			</camel:transform>
> 		</camel:route>
> 		 
> 		 
> 	</camelContext>
> </beans>
> In debugging mode, I see that the outputreportincident object is null when we call the method declared in the web service. So something happens with Spring & Cxf.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CAMEL-1431) camel-cxf and spring DSL does not work very well

Posted by "Charles Moulliard (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/CAMEL-1431?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=50470#action_50470 ] 

Charles Moulliard commented on CAMEL-1431:
------------------------------------------

Hi Willem,

Nothing has changed after removing from camel : <camel:package>org.apache.camel.example.reportincident.routing</camel:package>
outputreportincident is always null

> camel-cxf and spring DSL does not work very well
> ------------------------------------------------
>
>                 Key: CAMEL-1431
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-1431
>             Project: Apache Camel
>          Issue Type: Sub-task
>          Components: camel-cxf
>    Affects Versions: 2.0-M1
>            Reporter: Charles Moulliard
>            Assignee: Willem Jiang
>
> Hi,
> Camel-cxf and camel works very well when the routing is defined like this :
> {code}
> public class ReportIncidentRoutes extends RouteBuilder {
>     public void configure() throws Exception {
>         // webservice response for OK
>         OutputReportIncident OK = new OutputReportIncident();
>         OK.setCode("0");
>         // endpoint to our CXF webservice
>         String cxfEndpoint = "cxf://http://localhost:8080/camel-example/incident"
>                 + "?serviceClass=org.apache.camel.example.reportincident.ReportIncidentEndpoint"
>                 + "&wsdlURL=wsdl/report_incident.wsdl";
>         // first part from the webservice -> file backup
>         from(cxfEndpoint)
>             // we need to convert the CXF payload to InputReportIncident that FilenameGenerator and velocity expects
>             .convertBodyTo(InputReportIncident.class)
>             // return OK as response
>             .transform(constant(OK));
>     }
> @ContextConfiguration
> public class ReportIncidentRoutesTest extends AbstractJUnit4SpringContextTests  {
> 	
> 	private static final transient Log LOG = LogFactory.getLog(ReportIncidentRoutesTest.class);
> 	
>     @Autowired
>     protected CamelContext camelContext;
>     // should be the same address as we have in our route
>     private final static String ADDRESS = "http://localhost:8080/camel-example/incident";
>     //private final static QName endpointName = new QName("http://reportincident.example.camel.apache.org", "ReportIncidentEndpoint"); 
>     protected static ReportIncidentEndpoint createCXFClient() {
>         // we use CXF to create a client for us as its easier than JAXWS and works
>         JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
>         factory.setServiceClass(ReportIncidentEndpoint.class);
>         factory.setAddress(ADDRESS);
>         //factory.setEndpointName(endpointName);
>         return (ReportIncidentEndpoint) factory.create();
>     }
>     @Test
>     public void testRendportIncident() throws Exception {
>     	
>     	assertNotNull(camelContext);
>         // create input parameter
>         InputReportIncident input = new InputReportIncident();
>         input.setIncidentId("123");
>         input.setIncidentDate("2008-08-18");
>         input.setGivenName("Claus");
>         input.setFamilyName("Ibsen");
>         input.setSummary("Bla");
>         input.setDetails("Bla bla");
>         input.setEmail("davsclaus@apache.org");
>         input.setPhone("0045 2962 7576");
>         // create the webservice client and send the request
>         ReportIncidentEndpoint client = createCXFClient();    
>         OutputReportIncident out = client.reportIncident(input);
>         // assert we got a OK back
>         assertEquals("0", out.getCode());
>     }
>     
> }
>  {code}
> but not when the routing is defined in spring DSL
>  {code}
> <?xml version="1.0" encoding="UTF-8"?>
> <beans xmlns="http://www.springframework.org/schema/beans"
> 	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> 	xmlns:camel="http://camel.apache.org/schema/spring"
> 	xmlns:cxf="http://camel.apache.org/schema/cxf"
> 	xsi:schemaLocation=" http://www.springframework.org/schema/beans
> 		http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
> 		http://camel.apache.org/schema/osgi
> 		http://camel.apache.org/schema/osgi/camel-osgi.xsd
> 		http://camel.apache.org/schema/spring
> 		http://camel.apache.org/schema/spring/camel-spring.xsd
> 		http://camel.apache.org/schema/cxf
> 		http://camel.apache.org/schema/cxf/camel-cxf.xsd">
> 		
>     <bean id="webService" class="org.apache.camel.example.reportincident.beans.WebService" />
> 	
> 	<bean id="OK" class="org.apache.camel.example.reportincident.OutputReportIncident">
> 		<property name="code" value="0"/>
> 	</bean>
> 	
>     <!-- webservice endpoint  -->          
>     <cxf:cxfEndpoint id="reportIncident"
>                      address="http://localhost:8080/camel-example/incident"
>                      wsdlURL="wsdl/report_incident.wsdl"
>                      serviceClass="org.apache.camel.example.reportincident.ReportIncidentEndpoint"
>                      xmlns:s="http://reportincident.example.camel.apache.org">
>     </cxf:cxfEndpoint>
>      
> 	<camelContext trace="true" xmlns="http://camel.apache.org/schema/osgi">
> 		<camel:package>org.apache.camel.example.reportincident.routing</camel:package>
> 		
> 		<!-- CXF route -->
> 		<camel:route>
> 			<camel:from uri="cxf:bean:reportIncident" />
> 			<camel:convertBodyTo type="org.apache.camel.example.reportincident.InputReportIncident" />
> 			<camel:transform>
> 			    <camel:method bean="OK" method="code"/>
> 			</camel:transform>
> 		</camel:route>
> 		 
> 		 
> 	</camelContext>
> </beans>
>  {code}
> In debugging mode, I see that the outputreportincident object is null when we call the method declared in the web service. So something happens with Spring & Cxf.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CAMEL-1431) camel-cxf and spring DSL does not work very well

Posted by "Willem Jiang (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/CAMEL-1431?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=50622#action_50622 ] 

Willem Jiang commented on CAMEL-1431:
-------------------------------------

Hi Charles,
Clause's Java DSL will set the out message's body with the instance of OutputReportIncident,
{code}
   // return OK as response
    .transform(constant(OK));
{code}

Because  Camel Spring's <constant>, <simple> tag don't support the hold the bean's instance, 
so we can use the <method> to return an instance of  OutputReportIncident for <transform> to use.
Basicaly, the <method> tag is mapped into MethodCallExpression in Java, the expression 
value is the method return value. 
You can find the magic from the package of org.apache.camel.model.language  in camel-core. 

For the java.lang.IllegalStateException, I wrote a comment in CAMEL-1427, please check it out.

BTW, I also write a Spring configuration file which is based on  Clause's example in CAMEL-1465, 
You may take it as an example.

Willem


> camel-cxf and spring DSL does not work very well
> ------------------------------------------------
>
>                 Key: CAMEL-1431
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-1431
>             Project: Apache Camel
>          Issue Type: Sub-task
>          Components: camel-cxf
>    Affects Versions: 2.0-M1
>            Reporter: Charles Moulliard
>            Assignee: Willem Jiang
>
> Hi,
> Camel-cxf and camel works very well when the routing is defined like this :
> {code}
> public class ReportIncidentRoutes extends RouteBuilder {
>     public void configure() throws Exception {
>         // webservice response for OK
>         OutputReportIncident OK = new OutputReportIncident();
>         OK.setCode("0");
>         // endpoint to our CXF webservice
>         String cxfEndpoint = "cxf://http://localhost:8080/camel-example/incident"
>                 + "?serviceClass=org.apache.camel.example.reportincident.ReportIncidentEndpoint"
>                 + "&wsdlURL=wsdl/report_incident.wsdl";
>         // first part from the webservice -> file backup
>         from(cxfEndpoint)
>             // we need to convert the CXF payload to InputReportIncident that FilenameGenerator and velocity expects
>             .convertBodyTo(InputReportIncident.class)
>             // return OK as response
>             .transform(constant(OK));
>     }
> @ContextConfiguration
> public class ReportIncidentRoutesTest extends AbstractJUnit4SpringContextTests  {
> 	
> 	private static final transient Log LOG = LogFactory.getLog(ReportIncidentRoutesTest.class);
> 	
>     @Autowired
>     protected CamelContext camelContext;
>     // should be the same address as we have in our route
>     private final static String ADDRESS = "http://localhost:8080/camel-example/incident";
>     //private final static QName endpointName = new QName("http://reportincident.example.camel.apache.org", "ReportIncidentEndpoint"); 
>     protected static ReportIncidentEndpoint createCXFClient() {
>         // we use CXF to create a client for us as its easier than JAXWS and works
>         JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
>         factory.setServiceClass(ReportIncidentEndpoint.class);
>         factory.setAddress(ADDRESS);
>         //factory.setEndpointName(endpointName);
>         return (ReportIncidentEndpoint) factory.create();
>     }
>     @Test
>     public void testRendportIncident() throws Exception {
>     	
>     	assertNotNull(camelContext);
>         // create input parameter
>         InputReportIncident input = new InputReportIncident();
>         input.setIncidentId("123");
>         input.setIncidentDate("2008-08-18");
>         input.setGivenName("Claus");
>         input.setFamilyName("Ibsen");
>         input.setSummary("Bla");
>         input.setDetails("Bla bla");
>         input.setEmail("davsclaus@apache.org");
>         input.setPhone("0045 2962 7576");
>         // create the webservice client and send the request
>         ReportIncidentEndpoint client = createCXFClient();    
>         OutputReportIncident out = client.reportIncident(input);
>         // assert we got a OK back
>         assertEquals("0", out.getCode());
>     }
>     
> }
>  {code}
> but not when the routing is defined in spring DSL
>  {code}
> <?xml version="1.0" encoding="UTF-8"?>
> <beans xmlns="http://www.springframework.org/schema/beans"
> 	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> 	xmlns:camel="http://camel.apache.org/schema/spring"
> 	xmlns:cxf="http://camel.apache.org/schema/cxf"
> 	xsi:schemaLocation=" http://www.springframework.org/schema/beans
> 		http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
> 		http://camel.apache.org/schema/osgi
> 		http://camel.apache.org/schema/osgi/camel-osgi.xsd
> 		http://camel.apache.org/schema/spring
> 		http://camel.apache.org/schema/spring/camel-spring.xsd
> 		http://camel.apache.org/schema/cxf
> 		http://camel.apache.org/schema/cxf/camel-cxf.xsd">
> 		
>     <bean id="webService" class="org.apache.camel.example.reportincident.beans.WebService" />
> 	
> 	<bean id="OK" class="org.apache.camel.example.reportincident.OutputReportIncident">
> 		<property name="code" value="0"/>
> 	</bean>
> 	
>     <!-- webservice endpoint  -->          
>     <cxf:cxfEndpoint id="reportIncident"
>                      address="http://localhost:8080/camel-example/incident"
>                      wsdlURL="wsdl/report_incident.wsdl"
>                      serviceClass="org.apache.camel.example.reportincident.ReportIncidentEndpoint"
>                      xmlns:s="http://reportincident.example.camel.apache.org">
>     </cxf:cxfEndpoint>
>      
> 	<camelContext trace="true" xmlns="http://camel.apache.org/schema/osgi">
> 		<camel:package>org.apache.camel.example.reportincident.routing</camel:package>
> 		
> 		<!-- CXF route -->
> 		<camel:route>
> 			<camel:from uri="cxf:bean:reportIncident" />
> 			<camel:convertBodyTo type="org.apache.camel.example.reportincident.InputReportIncident" />
> 			<camel:transform>
> 			    <camel:method bean="OK" method="code"/>
> 			</camel:transform>
> 		</camel:route>
> 		 
> 		 
> 	</camelContext>
> </beans>
>  {code}
> In debugging mode, I see that the outputreportincident object is null when we call the method declared in the web service. So something happens with Spring & Cxf.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (CAMEL-1431) camel-cxf and spring DSL does not work very well

Posted by "Willem Jiang (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/CAMEL-1431?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Willem Jiang resolved CAMEL-1431.
---------------------------------

    Resolution: Won't Fix

> camel-cxf and spring DSL does not work very well
> ------------------------------------------------
>
>                 Key: CAMEL-1431
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-1431
>             Project: Apache Camel
>          Issue Type: Sub-task
>          Components: camel-cxf
>    Affects Versions: 2.0-M1
>            Reporter: Charles Moulliard
>            Assignee: Willem Jiang
>
> Hi,
> Camel-cxf and camel works very well when the routing is defined like this :
> {code}
> public class ReportIncidentRoutes extends RouteBuilder {
>     public void configure() throws Exception {
>         // webservice response for OK
>         OutputReportIncident OK = new OutputReportIncident();
>         OK.setCode("0");
>         // endpoint to our CXF webservice
>         String cxfEndpoint = "cxf://http://localhost:8080/camel-example/incident"
>                 + "?serviceClass=org.apache.camel.example.reportincident.ReportIncidentEndpoint"
>                 + "&wsdlURL=wsdl/report_incident.wsdl";
>         // first part from the webservice -> file backup
>         from(cxfEndpoint)
>             // we need to convert the CXF payload to InputReportIncident that FilenameGenerator and velocity expects
>             .convertBodyTo(InputReportIncident.class)
>             // return OK as response
>             .transform(constant(OK));
>     }
> @ContextConfiguration
> public class ReportIncidentRoutesTest extends AbstractJUnit4SpringContextTests  {
> 	
> 	private static final transient Log LOG = LogFactory.getLog(ReportIncidentRoutesTest.class);
> 	
>     @Autowired
>     protected CamelContext camelContext;
>     // should be the same address as we have in our route
>     private final static String ADDRESS = "http://localhost:8080/camel-example/incident";
>     //private final static QName endpointName = new QName("http://reportincident.example.camel.apache.org", "ReportIncidentEndpoint"); 
>     protected static ReportIncidentEndpoint createCXFClient() {
>         // we use CXF to create a client for us as its easier than JAXWS and works
>         JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
>         factory.setServiceClass(ReportIncidentEndpoint.class);
>         factory.setAddress(ADDRESS);
>         //factory.setEndpointName(endpointName);
>         return (ReportIncidentEndpoint) factory.create();
>     }
>     @Test
>     public void testRendportIncident() throws Exception {
>     	
>     	assertNotNull(camelContext);
>         // create input parameter
>         InputReportIncident input = new InputReportIncident();
>         input.setIncidentId("123");
>         input.setIncidentDate("2008-08-18");
>         input.setGivenName("Claus");
>         input.setFamilyName("Ibsen");
>         input.setSummary("Bla");
>         input.setDetails("Bla bla");
>         input.setEmail("davsclaus@apache.org");
>         input.setPhone("0045 2962 7576");
>         // create the webservice client and send the request
>         ReportIncidentEndpoint client = createCXFClient();    
>         OutputReportIncident out = client.reportIncident(input);
>         // assert we got a OK back
>         assertEquals("0", out.getCode());
>     }
>     
> }
>  {code}
> but not when the routing is defined in spring DSL
>  {code}
> <?xml version="1.0" encoding="UTF-8"?>
> <beans xmlns="http://www.springframework.org/schema/beans"
> 	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> 	xmlns:camel="http://camel.apache.org/schema/spring"
> 	xmlns:cxf="http://camel.apache.org/schema/cxf"
> 	xsi:schemaLocation=" http://www.springframework.org/schema/beans
> 		http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
> 		http://camel.apache.org/schema/osgi
> 		http://camel.apache.org/schema/osgi/camel-osgi.xsd
> 		http://camel.apache.org/schema/spring
> 		http://camel.apache.org/schema/spring/camel-spring.xsd
> 		http://camel.apache.org/schema/cxf
> 		http://camel.apache.org/schema/cxf/camel-cxf.xsd">
> 		
>     <bean id="webService" class="org.apache.camel.example.reportincident.beans.WebService" />
> 	
> 	<bean id="OK" class="org.apache.camel.example.reportincident.OutputReportIncident">
> 		<property name="code" value="0"/>
> 	</bean>
> 	
>     <!-- webservice endpoint  -->          
>     <cxf:cxfEndpoint id="reportIncident"
>                      address="http://localhost:8080/camel-example/incident"
>                      wsdlURL="wsdl/report_incident.wsdl"
>                      serviceClass="org.apache.camel.example.reportincident.ReportIncidentEndpoint"
>                      xmlns:s="http://reportincident.example.camel.apache.org">
>     </cxf:cxfEndpoint>
>      
> 	<camelContext trace="true" xmlns="http://camel.apache.org/schema/osgi">
> 		<camel:package>org.apache.camel.example.reportincident.routing</camel:package>
> 		
> 		<!-- CXF route -->
> 		<camel:route>
> 			<camel:from uri="cxf:bean:reportIncident" />
> 			<camel:convertBodyTo type="org.apache.camel.example.reportincident.InputReportIncident" />
> 			<camel:transform>
> 			    <camel:method bean="OK" method="code"/>
> 			</camel:transform>
> 		</camel:route>
> 		 
> 		 
> 	</camelContext>
> </beans>
>  {code}
> In debugging mode, I see that the outputreportincident object is null when we call the method declared in the web service. So something happens with Spring & Cxf.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (CAMEL-1431) camel-cxf and spring DSL does not work very well

Posted by "Willem Jiang (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/CAMEL-1431?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Willem Jiang updated CAMEL-1431:
--------------------------------

    Description: 
Hi,

Camel-cxf and camel works very well when the routing is defined like this :

{code}

public class ReportIncidentRoutes extends RouteBuilder {

    public void configure() throws Exception {
        // webservice response for OK
        OutputReportIncident OK = new OutputReportIncident();
        OK.setCode("0");

        // endpoint to our CXF webservice
        String cxfEndpoint = "cxf://http://localhost:8080/camel-example/incident"
                + "?serviceClass=org.apache.camel.example.reportincident.ReportIncidentEndpoint"
                + "&wsdlURL=wsdl/report_incident.wsdl";

        // first part from the webservice -> file backup
        from(cxfEndpoint)
            // we need to convert the CXF payload to InputReportIncident that FilenameGenerator and velocity expects
            .convertBodyTo(InputReportIncident.class)
            // return OK as response
            .transform(constant(OK));

    }

@ContextConfiguration
public class ReportIncidentRoutesTest extends AbstractJUnit4SpringContextTests  {
	
	private static final transient Log LOG = LogFactory.getLog(ReportIncidentRoutesTest.class);
	
    @Autowired
    protected CamelContext camelContext;

    // should be the same address as we have in our route
    private final static String ADDRESS = "http://localhost:8080/camel-example/incident";
    //private final static QName endpointName = new QName("http://reportincident.example.camel.apache.org", "ReportIncidentEndpoint"); 

    protected static ReportIncidentEndpoint createCXFClient() {
        // we use CXF to create a client for us as its easier than JAXWS and works
        JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
        factory.setServiceClass(ReportIncidentEndpoint.class);
        factory.setAddress(ADDRESS);
        //factory.setEndpointName(endpointName);
        return (ReportIncidentEndpoint) factory.create();
    }

    @Test
    public void testRendportIncident() throws Exception {
    	
    	assertNotNull(camelContext);

        // create input parameter
        InputReportIncident input = new InputReportIncident();
        input.setIncidentId("123");
        input.setIncidentDate("2008-08-18");
        input.setGivenName("Claus");
        input.setFamilyName("Ibsen");
        input.setSummary("Bla");
        input.setDetails("Bla bla");
        input.setEmail("davsclaus@apache.org");
        input.setPhone("0045 2962 7576");

        // create the webservice client and send the request
        ReportIncidentEndpoint client = createCXFClient();    
        OutputReportIncident out = client.reportIncident(input);

        // assert we got a OK back
        assertEquals("0", out.getCode());

    }
    

}

 {code}

but not when the routing is defined in spring DSL

 {code}
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xmlns:camel="http://camel.apache.org/schema/spring"
	xmlns:cxf="http://camel.apache.org/schema/cxf"
	xsi:schemaLocation=" http://www.springframework.org/schema/beans
		http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
		http://camel.apache.org/schema/osgi
		http://camel.apache.org/schema/osgi/camel-osgi.xsd
		http://camel.apache.org/schema/spring
		http://camel.apache.org/schema/spring/camel-spring.xsd
		http://camel.apache.org/schema/cxf
		http://camel.apache.org/schema/cxf/camel-cxf.xsd">
		
    <bean id="webService" class="org.apache.camel.example.reportincident.beans.WebService" />
	
	<bean id="OK" class="org.apache.camel.example.reportincident.OutputReportIncident">
		<property name="code" value="0"/>
	</bean>
	
    <!-- webservice endpoint  -->          
    <cxf:cxfEndpoint id="reportIncident"
                     address="http://localhost:8080/camel-example/incident"
                     wsdlURL="wsdl/report_incident.wsdl"
                     serviceClass="org.apache.camel.example.reportincident.ReportIncidentEndpoint"
                     xmlns:s="http://reportincident.example.camel.apache.org">
    </cxf:cxfEndpoint>
     

	<camelContext trace="true" xmlns="http://camel.apache.org/schema/osgi">
		<camel:package>org.apache.camel.example.reportincident.routing</camel:package>
		
		<!-- CXF route -->
		<camel:route>
			<camel:from uri="cxf:bean:reportIncident" />
			<camel:convertBodyTo type="org.apache.camel.example.reportincident.InputReportIncident" />
			<camel:transform>
			    <camel:method bean="OK" method="code"/>
			</camel:transform>
		</camel:route>
		 
		 
	</camelContext>
</beans>
 {code}

In debugging mode, I see that the outputreportincident object is null when we call the method declared in the web service. So something happens with Spring & Cxf.

  was:
Hi,

Camel-cxf and camel works very well when the routing is defined like this :

public class ReportIncidentRoutes extends RouteBuilder {

    public void configure() throws Exception {
        // webservice response for OK
        OutputReportIncident OK = new OutputReportIncident();
        OK.setCode("0");

        // endpoint to our CXF webservice
        String cxfEndpoint = "cxf://http://localhost:8080/camel-example/incident"
                + "?serviceClass=org.apache.camel.example.reportincident.ReportIncidentEndpoint"
                + "&wsdlURL=wsdl/report_incident.wsdl";

        // first part from the webservice -> file backup
        from(cxfEndpoint)
            // we need to convert the CXF payload to InputReportIncident that FilenameGenerator and velocity expects
            .convertBodyTo(InputReportIncident.class)
            // return OK as response
            .transform(constant(OK));

    }

@ContextConfiguration
public class ReportIncidentRoutesTest extends AbstractJUnit4SpringContextTests  {
	
	private static final transient Log LOG = LogFactory.getLog(ReportIncidentRoutesTest.class);
	
    @Autowired
    protected CamelContext camelContext;

    // should be the same address as we have in our route
    private final static String ADDRESS = "http://localhost:8080/camel-example/incident";
    //private final static QName endpointName = new QName("http://reportincident.example.camel.apache.org", "ReportIncidentEndpoint"); 

    protected static ReportIncidentEndpoint createCXFClient() {
        // we use CXF to create a client for us as its easier than JAXWS and works
        JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
        factory.setServiceClass(ReportIncidentEndpoint.class);
        factory.setAddress(ADDRESS);
        //factory.setEndpointName(endpointName);
        return (ReportIncidentEndpoint) factory.create();
    }

    @Test
    public void testRendportIncident() throws Exception {
    	
    	assertNotNull(camelContext);

        // create input parameter
        InputReportIncident input = new InputReportIncident();
        input.setIncidentId("123");
        input.setIncidentDate("2008-08-18");
        input.setGivenName("Claus");
        input.setFamilyName("Ibsen");
        input.setSummary("Bla");
        input.setDetails("Bla bla");
        input.setEmail("davsclaus@apache.org");
        input.setPhone("0045 2962 7576");

        // create the webservice client and send the request
        ReportIncidentEndpoint client = createCXFClient();    
        OutputReportIncident out = client.reportIncident(input);

        // assert we got a OK back
        assertEquals("0", out.getCode());

    }
    

}


but not when the routing is defined in spring DSL

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xmlns:camel="http://camel.apache.org/schema/spring"
	xmlns:cxf="http://camel.apache.org/schema/cxf"
	xsi:schemaLocation=" http://www.springframework.org/schema/beans
		http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
		http://camel.apache.org/schema/osgi
		http://camel.apache.org/schema/osgi/camel-osgi.xsd
		http://camel.apache.org/schema/spring
		http://camel.apache.org/schema/spring/camel-spring.xsd
		http://camel.apache.org/schema/cxf
		http://camel.apache.org/schema/cxf/camel-cxf.xsd">
		
    <bean id="webService" class="org.apache.camel.example.reportincident.beans.WebService" />
	
	<bean id="OK" class="org.apache.camel.example.reportincident.OutputReportIncident">
		<property name="code" value="0"/>
	</bean>
	
    <!-- webservice endpoint  -->          
    <cxf:cxfEndpoint id="reportIncident"
                     address="http://localhost:8080/camel-example/incident"
                     wsdlURL="wsdl/report_incident.wsdl"
                     serviceClass="org.apache.camel.example.reportincident.ReportIncidentEndpoint"
                     xmlns:s="http://reportincident.example.camel.apache.org">
    </cxf:cxfEndpoint>
     

	<camelContext trace="true" xmlns="http://camel.apache.org/schema/osgi">
		<camel:package>org.apache.camel.example.reportincident.routing</camel:package>
		
		<!-- CXF route -->
		<camel:route>
			<camel:from uri="cxf:bean:reportIncident" />
			<camel:convertBodyTo type="org.apache.camel.example.reportincident.InputReportIncident" />
			<camel:transform>
			    <camel:method bean="OK" method="code"/>
			</camel:transform>
		</camel:route>
		 
		 
	</camelContext>
</beans>

In debugging mode, I see that the outputreportincident object is null when we call the method declared in the web service. So something happens with Spring & Cxf.


> camel-cxf and spring DSL does not work very well
> ------------------------------------------------
>
>                 Key: CAMEL-1431
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-1431
>             Project: Apache Camel
>          Issue Type: Sub-task
>          Components: camel-cxf
>    Affects Versions: 2.0-M1
>            Reporter: Charles Moulliard
>            Assignee: Willem Jiang
>
> Hi,
> Camel-cxf and camel works very well when the routing is defined like this :
> {code}
> public class ReportIncidentRoutes extends RouteBuilder {
>     public void configure() throws Exception {
>         // webservice response for OK
>         OutputReportIncident OK = new OutputReportIncident();
>         OK.setCode("0");
>         // endpoint to our CXF webservice
>         String cxfEndpoint = "cxf://http://localhost:8080/camel-example/incident"
>                 + "?serviceClass=org.apache.camel.example.reportincident.ReportIncidentEndpoint"
>                 + "&wsdlURL=wsdl/report_incident.wsdl";
>         // first part from the webservice -> file backup
>         from(cxfEndpoint)
>             // we need to convert the CXF payload to InputReportIncident that FilenameGenerator and velocity expects
>             .convertBodyTo(InputReportIncident.class)
>             // return OK as response
>             .transform(constant(OK));
>     }
> @ContextConfiguration
> public class ReportIncidentRoutesTest extends AbstractJUnit4SpringContextTests  {
> 	
> 	private static final transient Log LOG = LogFactory.getLog(ReportIncidentRoutesTest.class);
> 	
>     @Autowired
>     protected CamelContext camelContext;
>     // should be the same address as we have in our route
>     private final static String ADDRESS = "http://localhost:8080/camel-example/incident";
>     //private final static QName endpointName = new QName("http://reportincident.example.camel.apache.org", "ReportIncidentEndpoint"); 
>     protected static ReportIncidentEndpoint createCXFClient() {
>         // we use CXF to create a client for us as its easier than JAXWS and works
>         JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
>         factory.setServiceClass(ReportIncidentEndpoint.class);
>         factory.setAddress(ADDRESS);
>         //factory.setEndpointName(endpointName);
>         return (ReportIncidentEndpoint) factory.create();
>     }
>     @Test
>     public void testRendportIncident() throws Exception {
>     	
>     	assertNotNull(camelContext);
>         // create input parameter
>         InputReportIncident input = new InputReportIncident();
>         input.setIncidentId("123");
>         input.setIncidentDate("2008-08-18");
>         input.setGivenName("Claus");
>         input.setFamilyName("Ibsen");
>         input.setSummary("Bla");
>         input.setDetails("Bla bla");
>         input.setEmail("davsclaus@apache.org");
>         input.setPhone("0045 2962 7576");
>         // create the webservice client and send the request
>         ReportIncidentEndpoint client = createCXFClient();    
>         OutputReportIncident out = client.reportIncident(input);
>         // assert we got a OK back
>         assertEquals("0", out.getCode());
>     }
>     
> }
>  {code}
> but not when the routing is defined in spring DSL
>  {code}
> <?xml version="1.0" encoding="UTF-8"?>
> <beans xmlns="http://www.springframework.org/schema/beans"
> 	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> 	xmlns:camel="http://camel.apache.org/schema/spring"
> 	xmlns:cxf="http://camel.apache.org/schema/cxf"
> 	xsi:schemaLocation=" http://www.springframework.org/schema/beans
> 		http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
> 		http://camel.apache.org/schema/osgi
> 		http://camel.apache.org/schema/osgi/camel-osgi.xsd
> 		http://camel.apache.org/schema/spring
> 		http://camel.apache.org/schema/spring/camel-spring.xsd
> 		http://camel.apache.org/schema/cxf
> 		http://camel.apache.org/schema/cxf/camel-cxf.xsd">
> 		
>     <bean id="webService" class="org.apache.camel.example.reportincident.beans.WebService" />
> 	
> 	<bean id="OK" class="org.apache.camel.example.reportincident.OutputReportIncident">
> 		<property name="code" value="0"/>
> 	</bean>
> 	
>     <!-- webservice endpoint  -->          
>     <cxf:cxfEndpoint id="reportIncident"
>                      address="http://localhost:8080/camel-example/incident"
>                      wsdlURL="wsdl/report_incident.wsdl"
>                      serviceClass="org.apache.camel.example.reportincident.ReportIncidentEndpoint"
>                      xmlns:s="http://reportincident.example.camel.apache.org">
>     </cxf:cxfEndpoint>
>      
> 	<camelContext trace="true" xmlns="http://camel.apache.org/schema/osgi">
> 		<camel:package>org.apache.camel.example.reportincident.routing</camel:package>
> 		
> 		<!-- CXF route -->
> 		<camel:route>
> 			<camel:from uri="cxf:bean:reportIncident" />
> 			<camel:convertBodyTo type="org.apache.camel.example.reportincident.InputReportIncident" />
> 			<camel:transform>
> 			    <camel:method bean="OK" method="code"/>
> 			</camel:transform>
> 		</camel:route>
> 		 
> 		 
> 	</camelContext>
> </beans>
>  {code}
> In debugging mode, I see that the outputreportincident object is null when we call the method declared in the web service. So something happens with Spring & Cxf.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CAMEL-1431) camel-cxf and spring DSL does not work very well

Posted by "Charles Moulliard (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/CAMEL-1431?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=50628#action_50628 ] 

Charles Moulliard commented on CAMEL-1431:
------------------------------------------

@Willem,

I don't have this error ( java.lang.IllegalStateException: BeanFactory not initialized or already closed - call 'refresh' before accessing beans via the ApplicationContext) in a non-OSGI environment

> camel-cxf and spring DSL does not work very well
> ------------------------------------------------
>
>                 Key: CAMEL-1431
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-1431
>             Project: Apache Camel
>          Issue Type: Sub-task
>          Components: camel-cxf
>    Affects Versions: 2.0-M1
>            Reporter: Charles Moulliard
>            Assignee: Willem Jiang
>
> Hi,
> Camel-cxf and camel works very well when the routing is defined like this :
> {code}
> public class ReportIncidentRoutes extends RouteBuilder {
>     public void configure() throws Exception {
>         // webservice response for OK
>         OutputReportIncident OK = new OutputReportIncident();
>         OK.setCode("0");
>         // endpoint to our CXF webservice
>         String cxfEndpoint = "cxf://http://localhost:8080/camel-example/incident"
>                 + "?serviceClass=org.apache.camel.example.reportincident.ReportIncidentEndpoint"
>                 + "&wsdlURL=wsdl/report_incident.wsdl";
>         // first part from the webservice -> file backup
>         from(cxfEndpoint)
>             // we need to convert the CXF payload to InputReportIncident that FilenameGenerator and velocity expects
>             .convertBodyTo(InputReportIncident.class)
>             // return OK as response
>             .transform(constant(OK));
>     }
> @ContextConfiguration
> public class ReportIncidentRoutesTest extends AbstractJUnit4SpringContextTests  {
> 	
> 	private static final transient Log LOG = LogFactory.getLog(ReportIncidentRoutesTest.class);
> 	
>     @Autowired
>     protected CamelContext camelContext;
>     // should be the same address as we have in our route
>     private final static String ADDRESS = "http://localhost:8080/camel-example/incident";
>     //private final static QName endpointName = new QName("http://reportincident.example.camel.apache.org", "ReportIncidentEndpoint"); 
>     protected static ReportIncidentEndpoint createCXFClient() {
>         // we use CXF to create a client for us as its easier than JAXWS and works
>         JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
>         factory.setServiceClass(ReportIncidentEndpoint.class);
>         factory.setAddress(ADDRESS);
>         //factory.setEndpointName(endpointName);
>         return (ReportIncidentEndpoint) factory.create();
>     }
>     @Test
>     public void testRendportIncident() throws Exception {
>     	
>     	assertNotNull(camelContext);
>         // create input parameter
>         InputReportIncident input = new InputReportIncident();
>         input.setIncidentId("123");
>         input.setIncidentDate("2008-08-18");
>         input.setGivenName("Claus");
>         input.setFamilyName("Ibsen");
>         input.setSummary("Bla");
>         input.setDetails("Bla bla");
>         input.setEmail("davsclaus@apache.org");
>         input.setPhone("0045 2962 7576");
>         // create the webservice client and send the request
>         ReportIncidentEndpoint client = createCXFClient();    
>         OutputReportIncident out = client.reportIncident(input);
>         // assert we got a OK back
>         assertEquals("0", out.getCode());
>     }
>     
> }
>  {code}
> but not when the routing is defined in spring DSL
>  {code}
> <?xml version="1.0" encoding="UTF-8"?>
> <beans xmlns="http://www.springframework.org/schema/beans"
> 	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> 	xmlns:camel="http://camel.apache.org/schema/spring"
> 	xmlns:cxf="http://camel.apache.org/schema/cxf"
> 	xsi:schemaLocation=" http://www.springframework.org/schema/beans
> 		http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
> 		http://camel.apache.org/schema/osgi
> 		http://camel.apache.org/schema/osgi/camel-osgi.xsd
> 		http://camel.apache.org/schema/spring
> 		http://camel.apache.org/schema/spring/camel-spring.xsd
> 		http://camel.apache.org/schema/cxf
> 		http://camel.apache.org/schema/cxf/camel-cxf.xsd">
> 		
>     <bean id="webService" class="org.apache.camel.example.reportincident.beans.WebService" />
> 	
> 	<bean id="OK" class="org.apache.camel.example.reportincident.OutputReportIncident">
> 		<property name="code" value="0"/>
> 	</bean>
> 	
>     <!-- webservice endpoint  -->          
>     <cxf:cxfEndpoint id="reportIncident"
>                      address="http://localhost:8080/camel-example/incident"
>                      wsdlURL="wsdl/report_incident.wsdl"
>                      serviceClass="org.apache.camel.example.reportincident.ReportIncidentEndpoint"
>                      xmlns:s="http://reportincident.example.camel.apache.org">
>     </cxf:cxfEndpoint>
>      
> 	<camelContext trace="true" xmlns="http://camel.apache.org/schema/osgi">
> 		<camel:package>org.apache.camel.example.reportincident.routing</camel:package>
> 		
> 		<!-- CXF route -->
> 		<camel:route>
> 			<camel:from uri="cxf:bean:reportIncident" />
> 			<camel:convertBodyTo type="org.apache.camel.example.reportincident.InputReportIncident" />
> 			<camel:transform>
> 			    <camel:method bean="OK" method="code"/>
> 			</camel:transform>
> 		</camel:route>
> 		 
> 		 
> 	</camelContext>
> </beans>
>  {code}
> In debugging mode, I see that the outputreportincident object is null when we call the method declared in the web service. So something happens with Spring & Cxf.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CAMEL-1431) camel-cxf and spring DSL does not work very well

Posted by "William Tam (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/CAMEL-1431?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=50610#action_50610 ] 

William Tam commented on CAMEL-1431:
------------------------------------

@Charles, are you seeing this problem in a non-OSGi environment?  

> camel-cxf and spring DSL does not work very well
> ------------------------------------------------
>
>                 Key: CAMEL-1431
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-1431
>             Project: Apache Camel
>          Issue Type: Sub-task
>          Components: camel-cxf
>    Affects Versions: 2.0-M1
>            Reporter: Charles Moulliard
>            Assignee: Willem Jiang
>
> Hi,
> Camel-cxf and camel works very well when the routing is defined like this :
> {code}
> public class ReportIncidentRoutes extends RouteBuilder {
>     public void configure() throws Exception {
>         // webservice response for OK
>         OutputReportIncident OK = new OutputReportIncident();
>         OK.setCode("0");
>         // endpoint to our CXF webservice
>         String cxfEndpoint = "cxf://http://localhost:8080/camel-example/incident"
>                 + "?serviceClass=org.apache.camel.example.reportincident.ReportIncidentEndpoint"
>                 + "&wsdlURL=wsdl/report_incident.wsdl";
>         // first part from the webservice -> file backup
>         from(cxfEndpoint)
>             // we need to convert the CXF payload to InputReportIncident that FilenameGenerator and velocity expects
>             .convertBodyTo(InputReportIncident.class)
>             // return OK as response
>             .transform(constant(OK));
>     }
> @ContextConfiguration
> public class ReportIncidentRoutesTest extends AbstractJUnit4SpringContextTests  {
> 	
> 	private static final transient Log LOG = LogFactory.getLog(ReportIncidentRoutesTest.class);
> 	
>     @Autowired
>     protected CamelContext camelContext;
>     // should be the same address as we have in our route
>     private final static String ADDRESS = "http://localhost:8080/camel-example/incident";
>     //private final static QName endpointName = new QName("http://reportincident.example.camel.apache.org", "ReportIncidentEndpoint"); 
>     protected static ReportIncidentEndpoint createCXFClient() {
>         // we use CXF to create a client for us as its easier than JAXWS and works
>         JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
>         factory.setServiceClass(ReportIncidentEndpoint.class);
>         factory.setAddress(ADDRESS);
>         //factory.setEndpointName(endpointName);
>         return (ReportIncidentEndpoint) factory.create();
>     }
>     @Test
>     public void testRendportIncident() throws Exception {
>     	
>     	assertNotNull(camelContext);
>         // create input parameter
>         InputReportIncident input = new InputReportIncident();
>         input.setIncidentId("123");
>         input.setIncidentDate("2008-08-18");
>         input.setGivenName("Claus");
>         input.setFamilyName("Ibsen");
>         input.setSummary("Bla");
>         input.setDetails("Bla bla");
>         input.setEmail("davsclaus@apache.org");
>         input.setPhone("0045 2962 7576");
>         // create the webservice client and send the request
>         ReportIncidentEndpoint client = createCXFClient();    
>         OutputReportIncident out = client.reportIncident(input);
>         // assert we got a OK back
>         assertEquals("0", out.getCode());
>     }
>     
> }
>  {code}
> but not when the routing is defined in spring DSL
>  {code}
> <?xml version="1.0" encoding="UTF-8"?>
> <beans xmlns="http://www.springframework.org/schema/beans"
> 	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> 	xmlns:camel="http://camel.apache.org/schema/spring"
> 	xmlns:cxf="http://camel.apache.org/schema/cxf"
> 	xsi:schemaLocation=" http://www.springframework.org/schema/beans
> 		http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
> 		http://camel.apache.org/schema/osgi
> 		http://camel.apache.org/schema/osgi/camel-osgi.xsd
> 		http://camel.apache.org/schema/spring
> 		http://camel.apache.org/schema/spring/camel-spring.xsd
> 		http://camel.apache.org/schema/cxf
> 		http://camel.apache.org/schema/cxf/camel-cxf.xsd">
> 		
>     <bean id="webService" class="org.apache.camel.example.reportincident.beans.WebService" />
> 	
> 	<bean id="OK" class="org.apache.camel.example.reportincident.OutputReportIncident">
> 		<property name="code" value="0"/>
> 	</bean>
> 	
>     <!-- webservice endpoint  -->          
>     <cxf:cxfEndpoint id="reportIncident"
>                      address="http://localhost:8080/camel-example/incident"
>                      wsdlURL="wsdl/report_incident.wsdl"
>                      serviceClass="org.apache.camel.example.reportincident.ReportIncidentEndpoint"
>                      xmlns:s="http://reportincident.example.camel.apache.org">
>     </cxf:cxfEndpoint>
>      
> 	<camelContext trace="true" xmlns="http://camel.apache.org/schema/osgi">
> 		<camel:package>org.apache.camel.example.reportincident.routing</camel:package>
> 		
> 		<!-- CXF route -->
> 		<camel:route>
> 			<camel:from uri="cxf:bean:reportIncident" />
> 			<camel:convertBodyTo type="org.apache.camel.example.reportincident.InputReportIncident" />
> 			<camel:transform>
> 			    <camel:method bean="OK" method="code"/>
> 			</camel:transform>
> 		</camel:route>
> 		 
> 		 
> 	</camelContext>
> </beans>
>  {code}
> In debugging mode, I see that the outputreportincident object is null when we call the method declared in the web service. So something happens with Spring & Cxf.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CAMEL-1431) camel-cxf and spring DSL does not work very well

Posted by "Charles Moulliard (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/CAMEL-1431?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=50603#action_50603 ] 

Charles Moulliard commented on CAMEL-1431:
------------------------------------------

I will test what you propose.

By the way, Claus in its tutorial does not return anything (http://cwiki.apache.org/CAMEL/tutorial-example-reportincident-part5.html)

{code}
public void configure() throws Exception {
        // webservice response for OK
        OutputReportIncident OK = new OutputReportIncident();
        OK.setCode("0");

        // endpoint to our CXF webservice
        String cxfEndpoint = "cxf://http://localhost:8080/part-five/webservices/incident"
                + "?serviceClass=org.apache.camel.example.reportincident.ReportIncidentEndpoint"
                + "&wsdlURL=report_incident.wsdl";

        // first part from the webservice -> file backup
        from(cxfEndpoint)
            // we need to convert the CXF payload to InputReportIncident that FilenameGenerator and velocity expects
            .convertBodyTo(InputReportIncident.class)
            // then set the file name using the FilenameGenerator bean
            .setHeader(FileComponent.HEADER_FILE_NAME, BeanLanguage.bean(FilenameGenerator.class, "generateFilename"))
            // and create the mail body using velocity templating
            .to("velocity:MailBody.vm")
            // and store the file
            .to("file://target/subfolder")
            // return OK as response
            .transform(constant(OK));

        // second part from the file backup -> send email
        from("file://target/subfolder")
            // set the subject of the email
            .setHeader("subject", constant("new incident reported"))
            // send the email
            .to("smtp://someone@localhost?password=secret&to=incident@mycompany.com");
    }
'code}



> camel-cxf and spring DSL does not work very well
> ------------------------------------------------
>
>                 Key: CAMEL-1431
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-1431
>             Project: Apache Camel
>          Issue Type: Sub-task
>          Components: camel-cxf
>    Affects Versions: 2.0-M1
>            Reporter: Charles Moulliard
>            Assignee: Willem Jiang
>
> Hi,
> Camel-cxf and camel works very well when the routing is defined like this :
> {code}
> public class ReportIncidentRoutes extends RouteBuilder {
>     public void configure() throws Exception {
>         // webservice response for OK
>         OutputReportIncident OK = new OutputReportIncident();
>         OK.setCode("0");
>         // endpoint to our CXF webservice
>         String cxfEndpoint = "cxf://http://localhost:8080/camel-example/incident"
>                 + "?serviceClass=org.apache.camel.example.reportincident.ReportIncidentEndpoint"
>                 + "&wsdlURL=wsdl/report_incident.wsdl";
>         // first part from the webservice -> file backup
>         from(cxfEndpoint)
>             // we need to convert the CXF payload to InputReportIncident that FilenameGenerator and velocity expects
>             .convertBodyTo(InputReportIncident.class)
>             // return OK as response
>             .transform(constant(OK));
>     }
> @ContextConfiguration
> public class ReportIncidentRoutesTest extends AbstractJUnit4SpringContextTests  {
> 	
> 	private static final transient Log LOG = LogFactory.getLog(ReportIncidentRoutesTest.class);
> 	
>     @Autowired
>     protected CamelContext camelContext;
>     // should be the same address as we have in our route
>     private final static String ADDRESS = "http://localhost:8080/camel-example/incident";
>     //private final static QName endpointName = new QName("http://reportincident.example.camel.apache.org", "ReportIncidentEndpoint"); 
>     protected static ReportIncidentEndpoint createCXFClient() {
>         // we use CXF to create a client for us as its easier than JAXWS and works
>         JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
>         factory.setServiceClass(ReportIncidentEndpoint.class);
>         factory.setAddress(ADDRESS);
>         //factory.setEndpointName(endpointName);
>         return (ReportIncidentEndpoint) factory.create();
>     }
>     @Test
>     public void testRendportIncident() throws Exception {
>     	
>     	assertNotNull(camelContext);
>         // create input parameter
>         InputReportIncident input = new InputReportIncident();
>         input.setIncidentId("123");
>         input.setIncidentDate("2008-08-18");
>         input.setGivenName("Claus");
>         input.setFamilyName("Ibsen");
>         input.setSummary("Bla");
>         input.setDetails("Bla bla");
>         input.setEmail("davsclaus@apache.org");
>         input.setPhone("0045 2962 7576");
>         // create the webservice client and send the request
>         ReportIncidentEndpoint client = createCXFClient();    
>         OutputReportIncident out = client.reportIncident(input);
>         // assert we got a OK back
>         assertEquals("0", out.getCode());
>     }
>     
> }
>  {code}
> but not when the routing is defined in spring DSL
>  {code}
> <?xml version="1.0" encoding="UTF-8"?>
> <beans xmlns="http://www.springframework.org/schema/beans"
> 	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> 	xmlns:camel="http://camel.apache.org/schema/spring"
> 	xmlns:cxf="http://camel.apache.org/schema/cxf"
> 	xsi:schemaLocation=" http://www.springframework.org/schema/beans
> 		http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
> 		http://camel.apache.org/schema/osgi
> 		http://camel.apache.org/schema/osgi/camel-osgi.xsd
> 		http://camel.apache.org/schema/spring
> 		http://camel.apache.org/schema/spring/camel-spring.xsd
> 		http://camel.apache.org/schema/cxf
> 		http://camel.apache.org/schema/cxf/camel-cxf.xsd">
> 		
>     <bean id="webService" class="org.apache.camel.example.reportincident.beans.WebService" />
> 	
> 	<bean id="OK" class="org.apache.camel.example.reportincident.OutputReportIncident">
> 		<property name="code" value="0"/>
> 	</bean>
> 	
>     <!-- webservice endpoint  -->          
>     <cxf:cxfEndpoint id="reportIncident"
>                      address="http://localhost:8080/camel-example/incident"
>                      wsdlURL="wsdl/report_incident.wsdl"
>                      serviceClass="org.apache.camel.example.reportincident.ReportIncidentEndpoint"
>                      xmlns:s="http://reportincident.example.camel.apache.org">
>     </cxf:cxfEndpoint>
>      
> 	<camelContext trace="true" xmlns="http://camel.apache.org/schema/osgi">
> 		<camel:package>org.apache.camel.example.reportincident.routing</camel:package>
> 		
> 		<!-- CXF route -->
> 		<camel:route>
> 			<camel:from uri="cxf:bean:reportIncident" />
> 			<camel:convertBodyTo type="org.apache.camel.example.reportincident.InputReportIncident" />
> 			<camel:transform>
> 			    <camel:method bean="OK" method="code"/>
> 			</camel:transform>
> 		</camel:route>
> 		 
> 		 
> 	</camelContext>
> </beans>
>  {code}
> In debugging mode, I see that the outputreportincident object is null when we call the method declared in the web service. So something happens with Spring & Cxf.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CAMEL-1431) camel-cxf and spring DSL does not work very well

Posted by "Willem Jiang (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/CAMEL-1431?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=50601#action_50601 ] 

Willem Jiang commented on CAMEL-1431:
-------------------------------------

Hi Charles,

I just found the you made a mistake to calling the bean's method in Spring DSL.
You need to make sure your bean's method code will return a instance of OutputReportIncident.
Camel will put this object into the out message body.

{code}
class MyBean {
public OutputReportIncident setOK() {
     OutputReportIncident. outputReportIncident = new OutputReportIncident();
     outputReportIncident.setCode("0");
      retrun outputReportIncident;
} 
{code}

{code}
            <bean id="myBean" class="org.apache.camel.example.reportincident.MyBean">
             <camel:route>
			<camel:from uri="cxf:bean:reportIncident" />
			<camel:convertBodyTo type="org.apache.camel.example.reportincident.InputReportIncident" />
			<camel:transform>
			    <camel:method bean="myBean" method="setOK"/>
			</camel:transform>
		</camel:route>
{code}

Willem


> camel-cxf and spring DSL does not work very well
> ------------------------------------------------
>
>                 Key: CAMEL-1431
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-1431
>             Project: Apache Camel
>          Issue Type: Sub-task
>          Components: camel-cxf
>    Affects Versions: 2.0-M1
>            Reporter: Charles Moulliard
>            Assignee: Willem Jiang
>
> Hi,
> Camel-cxf and camel works very well when the routing is defined like this :
> {code}
> public class ReportIncidentRoutes extends RouteBuilder {
>     public void configure() throws Exception {
>         // webservice response for OK
>         OutputReportIncident OK = new OutputReportIncident();
>         OK.setCode("0");
>         // endpoint to our CXF webservice
>         String cxfEndpoint = "cxf://http://localhost:8080/camel-example/incident"
>                 + "?serviceClass=org.apache.camel.example.reportincident.ReportIncidentEndpoint"
>                 + "&wsdlURL=wsdl/report_incident.wsdl";
>         // first part from the webservice -> file backup
>         from(cxfEndpoint)
>             // we need to convert the CXF payload to InputReportIncident that FilenameGenerator and velocity expects
>             .convertBodyTo(InputReportIncident.class)
>             // return OK as response
>             .transform(constant(OK));
>     }
> @ContextConfiguration
> public class ReportIncidentRoutesTest extends AbstractJUnit4SpringContextTests  {
> 	
> 	private static final transient Log LOG = LogFactory.getLog(ReportIncidentRoutesTest.class);
> 	
>     @Autowired
>     protected CamelContext camelContext;
>     // should be the same address as we have in our route
>     private final static String ADDRESS = "http://localhost:8080/camel-example/incident";
>     //private final static QName endpointName = new QName("http://reportincident.example.camel.apache.org", "ReportIncidentEndpoint"); 
>     protected static ReportIncidentEndpoint createCXFClient() {
>         // we use CXF to create a client for us as its easier than JAXWS and works
>         JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
>         factory.setServiceClass(ReportIncidentEndpoint.class);
>         factory.setAddress(ADDRESS);
>         //factory.setEndpointName(endpointName);
>         return (ReportIncidentEndpoint) factory.create();
>     }
>     @Test
>     public void testRendportIncident() throws Exception {
>     	
>     	assertNotNull(camelContext);
>         // create input parameter
>         InputReportIncident input = new InputReportIncident();
>         input.setIncidentId("123");
>         input.setIncidentDate("2008-08-18");
>         input.setGivenName("Claus");
>         input.setFamilyName("Ibsen");
>         input.setSummary("Bla");
>         input.setDetails("Bla bla");
>         input.setEmail("davsclaus@apache.org");
>         input.setPhone("0045 2962 7576");
>         // create the webservice client and send the request
>         ReportIncidentEndpoint client = createCXFClient();    
>         OutputReportIncident out = client.reportIncident(input);
>         // assert we got a OK back
>         assertEquals("0", out.getCode());
>     }
>     
> }
>  {code}
> but not when the routing is defined in spring DSL
>  {code}
> <?xml version="1.0" encoding="UTF-8"?>
> <beans xmlns="http://www.springframework.org/schema/beans"
> 	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> 	xmlns:camel="http://camel.apache.org/schema/spring"
> 	xmlns:cxf="http://camel.apache.org/schema/cxf"
> 	xsi:schemaLocation=" http://www.springframework.org/schema/beans
> 		http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
> 		http://camel.apache.org/schema/osgi
> 		http://camel.apache.org/schema/osgi/camel-osgi.xsd
> 		http://camel.apache.org/schema/spring
> 		http://camel.apache.org/schema/spring/camel-spring.xsd
> 		http://camel.apache.org/schema/cxf
> 		http://camel.apache.org/schema/cxf/camel-cxf.xsd">
> 		
>     <bean id="webService" class="org.apache.camel.example.reportincident.beans.WebService" />
> 	
> 	<bean id="OK" class="org.apache.camel.example.reportincident.OutputReportIncident">
> 		<property name="code" value="0"/>
> 	</bean>
> 	
>     <!-- webservice endpoint  -->          
>     <cxf:cxfEndpoint id="reportIncident"
>                      address="http://localhost:8080/camel-example/incident"
>                      wsdlURL="wsdl/report_incident.wsdl"
>                      serviceClass="org.apache.camel.example.reportincident.ReportIncidentEndpoint"
>                      xmlns:s="http://reportincident.example.camel.apache.org">
>     </cxf:cxfEndpoint>
>      
> 	<camelContext trace="true" xmlns="http://camel.apache.org/schema/osgi">
> 		<camel:package>org.apache.camel.example.reportincident.routing</camel:package>
> 		
> 		<!-- CXF route -->
> 		<camel:route>
> 			<camel:from uri="cxf:bean:reportIncident" />
> 			<camel:convertBodyTo type="org.apache.camel.example.reportincident.InputReportIncident" />
> 			<camel:transform>
> 			    <camel:method bean="OK" method="code"/>
> 			</camel:transform>
> 		</camel:route>
> 		 
> 		 
> 	</camelContext>
> </beans>
>  {code}
> In debugging mode, I see that the outputreportincident object is null when we call the method declared in the web service. So something happens with Spring & Cxf.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Issue Comment Edited: (CAMEL-1431) camel-cxf and spring DSL does not work very well

Posted by "Charles Moulliard (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/CAMEL-1431?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=50603#action_50603 ] 

Charles Moulliard edited comment on CAMEL-1431 at 3/17/09 8:36 AM:
-------------------------------------------------------------------

I will test what you propose.

By the way, Claus in its tutorial does not return anything (http://cwiki.apache.org/CAMEL/tutorial-example-reportincident-part5.html)

{code}
public void configure() throws Exception {
        // webservice response for OK
        OutputReportIncident OK = new OutputReportIncident();
        OK.setCode("0");

        // endpoint to our CXF webservice
        String cxfEndpoint = "cxf://http://localhost:8080/part-five/webservices/incident"
                + "?serviceClass=org.apache.camel.example.reportincident.ReportIncidentEndpoint"
                + "&wsdlURL=report_incident.wsdl";

        // first part from the webservice -> file backup
        from(cxfEndpoint)
            // we need to convert the CXF payload to InputReportIncident that FilenameGenerator and velocity expects
            .convertBodyTo(InputReportIncident.class)
            // then set the file name using the FilenameGenerator bean
            .setHeader(FileComponent.HEADER_FILE_NAME, BeanLanguage.bean(FilenameGenerator.class, "generateFilename"))
            // and create the mail body using velocity templating
            .to("velocity:MailBody.vm")
            // and store the file
            .to("file://target/subfolder")
            // return OK as response
            .transform(constant(OK));

        // second part from the file backup -> send email
        from("file://target/subfolder")
            // set the subject of the email
            .setHeader("subject", constant("new incident reported"))
            // send the email
            .to("smtp://someone@localhost?password=secret&to=incident@mycompany.com");
    }
{code}



      was (Author: cmoulliard):
    I will test what you propose.

By the way, Claus in its tutorial does not return anything (http://cwiki.apache.org/CAMEL/tutorial-example-reportincident-part5.html)

{code}
public void configure() throws Exception {
        // webservice response for OK
        OutputReportIncident OK = new OutputReportIncident();
        OK.setCode("0");

        // endpoint to our CXF webservice
        String cxfEndpoint = "cxf://http://localhost:8080/part-five/webservices/incident"
                + "?serviceClass=org.apache.camel.example.reportincident.ReportIncidentEndpoint"
                + "&wsdlURL=report_incident.wsdl";

        // first part from the webservice -> file backup
        from(cxfEndpoint)
            // we need to convert the CXF payload to InputReportIncident that FilenameGenerator and velocity expects
            .convertBodyTo(InputReportIncident.class)
            // then set the file name using the FilenameGenerator bean
            .setHeader(FileComponent.HEADER_FILE_NAME, BeanLanguage.bean(FilenameGenerator.class, "generateFilename"))
            // and create the mail body using velocity templating
            .to("velocity:MailBody.vm")
            // and store the file
            .to("file://target/subfolder")
            // return OK as response
            .transform(constant(OK));

        // second part from the file backup -> send email
        from("file://target/subfolder")
            // set the subject of the email
            .setHeader("subject", constant("new incident reported"))
            // send the email
            .to("smtp://someone@localhost?password=secret&to=incident@mycompany.com");
    }
'code}


  
> camel-cxf and spring DSL does not work very well
> ------------------------------------------------
>
>                 Key: CAMEL-1431
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-1431
>             Project: Apache Camel
>          Issue Type: Sub-task
>          Components: camel-cxf
>    Affects Versions: 2.0-M1
>            Reporter: Charles Moulliard
>            Assignee: Willem Jiang
>
> Hi,
> Camel-cxf and camel works very well when the routing is defined like this :
> {code}
> public class ReportIncidentRoutes extends RouteBuilder {
>     public void configure() throws Exception {
>         // webservice response for OK
>         OutputReportIncident OK = new OutputReportIncident();
>         OK.setCode("0");
>         // endpoint to our CXF webservice
>         String cxfEndpoint = "cxf://http://localhost:8080/camel-example/incident"
>                 + "?serviceClass=org.apache.camel.example.reportincident.ReportIncidentEndpoint"
>                 + "&wsdlURL=wsdl/report_incident.wsdl";
>         // first part from the webservice -> file backup
>         from(cxfEndpoint)
>             // we need to convert the CXF payload to InputReportIncident that FilenameGenerator and velocity expects
>             .convertBodyTo(InputReportIncident.class)
>             // return OK as response
>             .transform(constant(OK));
>     }
> @ContextConfiguration
> public class ReportIncidentRoutesTest extends AbstractJUnit4SpringContextTests  {
> 	
> 	private static final transient Log LOG = LogFactory.getLog(ReportIncidentRoutesTest.class);
> 	
>     @Autowired
>     protected CamelContext camelContext;
>     // should be the same address as we have in our route
>     private final static String ADDRESS = "http://localhost:8080/camel-example/incident";
>     //private final static QName endpointName = new QName("http://reportincident.example.camel.apache.org", "ReportIncidentEndpoint"); 
>     protected static ReportIncidentEndpoint createCXFClient() {
>         // we use CXF to create a client for us as its easier than JAXWS and works
>         JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
>         factory.setServiceClass(ReportIncidentEndpoint.class);
>         factory.setAddress(ADDRESS);
>         //factory.setEndpointName(endpointName);
>         return (ReportIncidentEndpoint) factory.create();
>     }
>     @Test
>     public void testRendportIncident() throws Exception {
>     	
>     	assertNotNull(camelContext);
>         // create input parameter
>         InputReportIncident input = new InputReportIncident();
>         input.setIncidentId("123");
>         input.setIncidentDate("2008-08-18");
>         input.setGivenName("Claus");
>         input.setFamilyName("Ibsen");
>         input.setSummary("Bla");
>         input.setDetails("Bla bla");
>         input.setEmail("davsclaus@apache.org");
>         input.setPhone("0045 2962 7576");
>         // create the webservice client and send the request
>         ReportIncidentEndpoint client = createCXFClient();    
>         OutputReportIncident out = client.reportIncident(input);
>         // assert we got a OK back
>         assertEquals("0", out.getCode());
>     }
>     
> }
>  {code}
> but not when the routing is defined in spring DSL
>  {code}
> <?xml version="1.0" encoding="UTF-8"?>
> <beans xmlns="http://www.springframework.org/schema/beans"
> 	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> 	xmlns:camel="http://camel.apache.org/schema/spring"
> 	xmlns:cxf="http://camel.apache.org/schema/cxf"
> 	xsi:schemaLocation=" http://www.springframework.org/schema/beans
> 		http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
> 		http://camel.apache.org/schema/osgi
> 		http://camel.apache.org/schema/osgi/camel-osgi.xsd
> 		http://camel.apache.org/schema/spring
> 		http://camel.apache.org/schema/spring/camel-spring.xsd
> 		http://camel.apache.org/schema/cxf
> 		http://camel.apache.org/schema/cxf/camel-cxf.xsd">
> 		
>     <bean id="webService" class="org.apache.camel.example.reportincident.beans.WebService" />
> 	
> 	<bean id="OK" class="org.apache.camel.example.reportincident.OutputReportIncident">
> 		<property name="code" value="0"/>
> 	</bean>
> 	
>     <!-- webservice endpoint  -->          
>     <cxf:cxfEndpoint id="reportIncident"
>                      address="http://localhost:8080/camel-example/incident"
>                      wsdlURL="wsdl/report_incident.wsdl"
>                      serviceClass="org.apache.camel.example.reportincident.ReportIncidentEndpoint"
>                      xmlns:s="http://reportincident.example.camel.apache.org">
>     </cxf:cxfEndpoint>
>      
> 	<camelContext trace="true" xmlns="http://camel.apache.org/schema/osgi">
> 		<camel:package>org.apache.camel.example.reportincident.routing</camel:package>
> 		
> 		<!-- CXF route -->
> 		<camel:route>
> 			<camel:from uri="cxf:bean:reportIncident" />
> 			<camel:convertBodyTo type="org.apache.camel.example.reportincident.InputReportIncident" />
> 			<camel:transform>
> 			    <camel:method bean="OK" method="code"/>
> 			</camel:transform>
> 		</camel:route>
> 		 
> 		 
> 	</camelContext>
> </beans>
>  {code}
> In debugging mode, I see that the outputreportincident object is null when we call the method declared in the web service. So something happens with Spring & Cxf.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.