You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Tsun-Po Yang <tp...@sanger.ac.uk> on 2009/07/17 17:40:33 UTC

Can I have more than one jaxws:endpoint in cxf.xml?

Hi all,

I am new to CXF and will be very appreciated if you can help me.
Can I have more than one endpoint per servlet?

1. For example: my "cxf.xml":
<beans>
  ...
  <jaxws:endpoint id="example1"
    implementor="com.example.business.Example1"
    serviceName="Example1Service"
    address="/Example1WS"/>
 
  <jaxws:endpoint id="example2"
    implementor="com.example.business.Example2"
    serviceName="Example2Service"
    address="/Example2WS"/>
</beans>


2. Start Tomcat, I DO can visit both:
http://localhost:8080/example/services/Example1WS
http://localhost:8080/example/services/Example2WS


3. In my "Client.java"

JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
factory.getInInterceptors().add(new LoggingInInterceptor());
factory.getOutInterceptors().add(new LoggingOutInterceptor());
factory.setServiceClass(Example1.class);
factory.setAddress(url + "/Example1WS");

Example1 client = (Example1) factory.create();
client.doSomething();


4. The error messages:
Exception in thread "AWT-EventQueue-0" 
javax.xml.ws.soap.SOAPFaultException: Could not send Message.
    at 
org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:141)
    at $Proxy47.doSomething(Unknown Source)

Tomcat:
INFO: Servlet transport factory already registered


5. However, if I remove "Example2" endpoint in the "cxf.xml",
re-start Tomcat and it works fine.


Please help!


Many thanks,
George


-- 
 The Wellcome Trust Sanger Institute is operated by Genome Research 
 Limited, a charity registered in England with number 1021457 and a 
 company registered in England with number 2742969, whose registered 
 office is 215 Euston Road, London, NW1 2BE. 

RE: Can I have more than one jaxws:endpoint in cxf.xml?

Posted by tsunpo <ts...@yahoo.com>.
Cheers, Dan and Ron.

Just realised my Example2 extends something else...
com.example.business.Example1 implements Example1Service
com.example.business.Example2 extends BloodySomethingElse implements
Example2Service

Phew! 

But still thanks for your answers,
George



rdgrimes wrote:
> 
> Hi,
> 
> Make sure you check for the bonehead mistakes (which I usually make),
> like the @WebService annotation in the service implementation class. I
> sometimes copy a service implementation class and forget to change the
> endpointInterface and serviceName values.
> 
> Ron
> 
> 
> -----Original Message-----
> From: Tsun-Po Yang [mailto:tpy@sanger.ac.uk] 
> Sent: Friday, July 17, 2009 9:41 AM
> To: users@cxf.apache.org
> Subject: Can I have more than one jaxws:endpoint in cxf.xml?
> 
> Hi all,
> 
> I am new to CXF and will be very appreciated if you can help me.
> Can I have more than one endpoint per servlet?
> 
> 1. For example: my "cxf.xml":
> <beans>
>   ...
>   <jaxws:endpoint id="example1"
>     implementor="com.example.business.Example1"
>     serviceName="Example1Service"
>     address="/Example1WS"/>
>  
>   <jaxws:endpoint id="example2"
>     implementor="com.example.business.Example2"
>     serviceName="Example2Service"
>     address="/Example2WS"/>
> </beans>
> 
> 
> 2. Start Tomcat, I DO can visit both:
> http://localhost:8080/example/services/Example1WS
> http://localhost:8080/example/services/Example2WS
> 
> 
> 3. In my "Client.java"
> 
> JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
> factory.getInInterceptors().add(new LoggingInInterceptor());
> factory.getOutInterceptors().add(new LoggingOutInterceptor());
> factory.setServiceClass(Example1.class);
> factory.setAddress(url + "/Example1WS");
> 
> Example1 client = (Example1) factory.create(); client.doSomething();
> 
> 
> 4. The error messages:
> Exception in thread "AWT-EventQueue-0" 
> javax.xml.ws.soap.SOAPFaultException: Could not send Message.
>     at
> org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:141)
>     at $Proxy47.doSomething(Unknown Source)
> 
> Tomcat:
> INFO: Servlet transport factory already registered
> 
> 
> 5. However, if I remove "Example2" endpoint in the "cxf.xml", re-start
> Tomcat and it works fine.
> 
> 
> Please help!
> 
> 
> Many thanks,
> George
> 
> 
> --
>  The Wellcome Trust Sanger Institute is operated by Genome Research
> Limited, a charity registered in England with number 1021457 and a
> company registered in England with number 2742969, whose registered
> office is 215 Euston Road, London, NW1 2BE. 
> 
> 

-- 
View this message in context: http://www.nabble.com/Can-I-have-more-than-one-jaxws%3Aendpoint-in-cxf.xml--tp24537473p24548895.html
Sent from the cxf-user mailing list archive at Nabble.com.


RE: Can I have more than one jaxws:endpoint in cxf.xml?

Posted by Ron Grimes <rg...@sinclairoil.com>.
Hi,

Make sure you check for the bonehead mistakes (which I usually make),
like the @WebService annotation in the service implementation class. I
sometimes copy a service implementation class and forget to change the
endpointInterface and serviceName values.

Ron


-----Original Message-----
From: Tsun-Po Yang [mailto:tpy@sanger.ac.uk] 
Sent: Friday, July 17, 2009 9:41 AM
To: users@cxf.apache.org
Subject: Can I have more than one jaxws:endpoint in cxf.xml?

Hi all,

I am new to CXF and will be very appreciated if you can help me.
Can I have more than one endpoint per servlet?

1. For example: my "cxf.xml":
<beans>
  ...
  <jaxws:endpoint id="example1"
    implementor="com.example.business.Example1"
    serviceName="Example1Service"
    address="/Example1WS"/>
 
  <jaxws:endpoint id="example2"
    implementor="com.example.business.Example2"
    serviceName="Example2Service"
    address="/Example2WS"/>
</beans>


2. Start Tomcat, I DO can visit both:
http://localhost:8080/example/services/Example1WS
http://localhost:8080/example/services/Example2WS


3. In my "Client.java"

JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
factory.getInInterceptors().add(new LoggingInInterceptor());
factory.getOutInterceptors().add(new LoggingOutInterceptor());
factory.setServiceClass(Example1.class);
factory.setAddress(url + "/Example1WS");

Example1 client = (Example1) factory.create(); client.doSomething();


4. The error messages:
Exception in thread "AWT-EventQueue-0" 
javax.xml.ws.soap.SOAPFaultException: Could not send Message.
    at
org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:141)
    at $Proxy47.doSomething(Unknown Source)

Tomcat:
INFO: Servlet transport factory already registered


5. However, if I remove "Example2" endpoint in the "cxf.xml", re-start
Tomcat and it works fine.


Please help!


Many thanks,
George


--
 The Wellcome Trust Sanger Institute is operated by Genome Research
Limited, a charity registered in England with number 1021457 and a
company registered in England with number 2742969, whose registered
office is 215 Euston Road, London, NW1 2BE. 

Re: Can I have more than one jaxws:endpoint in cxf.xml?

Posted by Daniel Kulp <dk...@apache.org>.

This definitely should work fine.   Any chance you can attach a test case to a 
JIRA?

Dan


On Fri July 17 2009 11:40:33 am Tsun-Po Yang wrote:
> Hi all,
>
> I am new to CXF and will be very appreciated if you can help me.
> Can I have more than one endpoint per servlet?
>
> 1. For example: my "cxf.xml":
> <beans>
>   ...
>   <jaxws:endpoint id="example1"
>     implementor="com.example.business.Example1"
>     serviceName="Example1Service"
>     address="/Example1WS"/>
>
>   <jaxws:endpoint id="example2"
>     implementor="com.example.business.Example2"
>     serviceName="Example2Service"
>     address="/Example2WS"/>
> </beans>
>
>
> 2. Start Tomcat, I DO can visit both:
> http://localhost:8080/example/services/Example1WS
> http://localhost:8080/example/services/Example2WS
>
>
> 3. In my "Client.java"
>
> JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
> factory.getInInterceptors().add(new LoggingInInterceptor());
> factory.getOutInterceptors().add(new LoggingOutInterceptor());
> factory.setServiceClass(Example1.class);
> factory.setAddress(url + "/Example1WS");
>
> Example1 client = (Example1) factory.create();
> client.doSomething();
>
>
> 4. The error messages:
> Exception in thread "AWT-EventQueue-0"
> javax.xml.ws.soap.SOAPFaultException: Could not send Message.
>     at
> org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:141)
>     at $Proxy47.doSomething(Unknown Source)
>
> Tomcat:
> INFO: Servlet transport factory already registered
>
>
> 5. However, if I remove "Example2" endpoint in the "cxf.xml",
> re-start Tomcat and it works fine.
>
>
> Please help!
>
>
> Many thanks,
> George

-- 
Daniel Kulp
dkulp@apache.org
http://www.dankulp.com/blog