[JBoss Web Services CXF] - Deploying JBOSS CXF-WS with JBOSS AS 4.2.3G.A. on jdk 1.6
by sawan1424
Hi ,
I am using JBOSS AS 4.2.3 with JBOSS WS-CXF 3.0.2 version with JDK 1.6 on Eclipse 3.5 Galileo.
I successfully installed CXF WS on JBOSS AS 4.2.3.G.
In the Eclipse->Window->preference->Web Service -> JBOSS WS
In that option , I selected JBOSS 4.2.3 as JBOSS 4.2.3 G.A. as JBOSS WS Runtime as I selected it as jboss.home in the ant.properties file.
After that I created Dynamic Web Project with JBOSS WS run time .
I created a POJO .
package com.test.ws;
import javax.jws.WebMethod;
import javax.jws.WebService;
@WebService
public class Converter {
@WebMethod
public float celsiusToFarenheit ( float celsius )
{
return (celsius * 9 / 5) + 32;
}
@WebMethod
public float farenheitToCelsius ( float farenheit )
{
return (farenheit - 32) * 5 / 9;
}
}
After that I tried to create a Web Service using Bottom up approach similar to Axis procedure.But When I click next button ,it showed me an exception.
Details of EXception :-
Exception in thread "main" java.lang.IllegalStateException: Failed to load: org.jboss.ws.tools.jaxws.impl.JBossWSProviderFactoryImpl
at org.jboss.wsf.spi.util.ServiceLoader.loadDefault(ServiceLoader.java:205)
at org.jboss.wsf.spi.util.ServiceLoader.loadFromSystemProperty(ServiceLoader.java:138)
at org.jboss.wsf.spi.util.ServiceLoader.loadService(ServiceLoader.java:68)
at org.jboss.wsf.spi.tools.WSContractProvider.newInstance(WSContractProvider.java:65)
at org.jboss.wsf.spi.tools.cmd.WSProvide.generate(WSProvide.java:170)
at org.jboss.wsf.spi.tools.cmd.WSProvide.main(WSProvide.java:77)
Caused by: java.lang.ClassNotFoundException: org.jboss.ws.tools.jaxws.impl.JBossWSProviderFactoryImpl
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at org.jboss.wsf.spi.util.ServiceLoader.loadDefault(ServiceLoader.java:200)
... 5 more
Please help me out.
Please tell me where I made a mistake.
Any help would be appreciated.
Thanks
Sandy
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4263205#4263205
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4263205
14 years, 6 months
[JBoss Web Services CXF] - custom fault mapping with jax-rpc
by newmanw10
I am currently working on an old legacy system that is using jax-rpc. I would like to add in some custom faults such that I can inform clients better. I.E. I can throw custom exceptions/faults such that the user can catch them to determine the best course of action. However using JBoss I have not been able to get this to work. The main problem is that in the SOAP message that comes back there is no tag. This tag is how the exception would get deserialized on the client, so without that tag the client will have no idea what exception/fault was thrown.
Has anyone every gotten a custom fault to work with JBoss? My guess is no as I have not been able to find out anything on this problem.
I am running 4.2.3.GA and out of the box is has jbossws-native-3.0.1, I also installed jbossws-native-3.1.1.GA to see if it fixed the problem but I was still out of luck. Please help I am all out of ideas! Below are some code snippets to show what I am talking about. If you need more please let me know.
I took a simple example jax-rpc HelloWord service from the java tutorial section and added a fault to the wsdl.
Here is a snippet:
| <portType name="HelloIF">
| <operation name="sayHello" parameterOrder="String_1">
| <input message="tns:HelloIF_sayHello"/>
| <output message="tns:HelloIF_sayHelloResponse"/>
| <fault name="fault" message="tns:sayHelloException"></fault>
| </operation>
| </portType>
|
I generated the jax-rpc classes:
Here is the fault/exception generated:
| public class SayHelloException extends java.lang.Exception {
| private java.lang.String message;
|
|
| public SayHelloException(java.lang.String message) {
| super(message);
| this.message = message;
| }
|
| public java.lang.String getMessage() {
| return message;
| }
| }
|
Here is the endpoint interface:
| public interface HelloIF extends java.rmi.Remote {
| public java.lang.String sayHello(boolean string_1) throws
| samples.webservices.jaxrpc.simple.SayHelloException, java.rmi.RemoteException;
| }
|
I also creating the jax-rpc mapping file and deployed with the war in the web-inf directory as well as my webservices.xml and web.xml.
At this point I am not sure why jboss is not creating the tag in the SOAP message that gets sent back to the server.
Here is how I throw the custom exception on the server:
throw new SayHelloException("Throwing custom exception/fault from WS");
Here is my client:
| try {
| Stub stub = (Stub) port;
| stub._setProperty(javax.xml.rpc.Stub.ENDPOINT_ADDRESS_PROPERTY, "http://localhost:8080/hello/simple");
| String result = port.sayHello(true);
| System.out.println(result);
| } catch (SayHelloException ex) {
| System.out.println("PASS! caught a custom exception");
| } catch (RemoteException ex) {
| } catch (Exception ex) {
| System.out.println("FAIL! caught a Exception");
| }
|
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4263184#4263184
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4263184
14 years, 6 months
[JBoss Web Services CXF] - Re: HTTP conduit configuration for de-coupeld end-points
by karypid
Actually, I need a little bit more help. I though I'd easily move on by putting jetty-6.1.19.jar in WEB-INF/lib.
However, the class-loader active at the time can't "see" that folder and I still get the ClassNotFound exception.
I'm 100% certain the library is available to my war, because I access the class from code right before I attempt to initialize the port:
| // I put the line below to demonstrate Jetty is available
| org.mortbay.jetty.Server server = new org.mortbay.jetty.Server(1234);
| org.mortbay.jetty.Connector c[] = server.getConnectors();
| System.err.println("Connectors found: " + c.length);
|
| // The above prints that "Connectors found: 1"
|
| AsyncMessagingService ams = new AsyncMessagingService(wsdlURL, svcName);
| AsyncMessaging am = ams.getAsyncMessagingImplPort();
| // The call below throws the exception for org.mortbay.jetty.Connector
| // which was just used above
| am.deliver("This is a test");
|
The code above is in a doGet() method of a "DebugServlet" class I put together to do a quick test. Exception is the same.
So where would I put the jetty jars to make sure the CXF of JBoss can see them?
Please note that I don't embed the entire CXF in my war; instead I use a JBoss 5.1 instance where the native stack has been replaced with the CXF one. Here are the relevant messages from startup:
14:48:59,706 INFO [WebService] Using RMI server codebase: http://localhost:8183/
| 14:49:04,933 INFO [AbstractServerConfig] JBoss Web Services - CXF Server
| 14:49:04,933 INFO [AbstractServerConfig] 3.2.0.GA
I took jetty jars straight from a CXF 2.2.3 download, which is the same version used by your 3.2.0 integration.
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4261847#4261847
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4261847
14 years, 6 months
[JBoss Web Services CXF] - Re: HTTP conduit configuration for de-coupeld end-points
by richard.opalka@jboss.com
"karypid" wrote :
| While creating the client proxy, CXF also tries to create the endpoint for receiving replies. Unfortunately it uses Jetty (as it is not aware that it is running in JBoss) and I get a ClassNotFoundException (see log below and notice how the HTTPConduit class tries to initialize and HTTP engine using Jetty).
|
Yes, this is how CXF WS-RM client works.
"karypid" wrote :
| How can I configure CXF to delegate this task to JBoss? For example, to have JAX-WS web services published on JBoss, you need to configure an invoker from the JBoss integration layer:
|
| <jaxws:endpoint id='AsyncMessaging'
| | address='http://localhost:7180/jboss-cxf.wsrm.recipient/AsyncMessagingService'
| | implementor='svc.impl.messaging.AsyncMessagingServiceImpl'>
| | <jaxws:invoker>
| | <bean class='org.jboss.wsf.stack.cxf.InvokerJSE' />
| | </jaxws:invoker>
|
|
There's no way how you could achieve it ATM :(
Your usecase is really advanced and we don't provide SPI or integration point for it.
JAX-WS spec tries to solve this 'usecase' with it's
Endpoint.publish(String url, Class endpointImpl) but this usecase
is broken for server side IMHO.
Your only option ATM is to configure jbossws-cxf classpath properly to have myssing Jetty classes visible.
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4261813#4261813
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4261813
14 years, 6 months
[JBoss Web Services CXF] - HTTP conduit configuration for de-coupeld end-points
by karypid
Hi,
I have a rather simple (I hope) problem trying to setup a WS-RM client as follows:
I need a separate connection to be used for the incoming traffic (de-coupled endpoint) towards the client (the CXF configuration to do this is explained here: http://cxf.apache.org/docs/configuration-of-runtime-constructed-objects.html).
My problem is this:
While creating the client proxy, CXF also tries to create the endpoint for receiving replies. Unfortunately it uses Jetty (as it is not aware that it is running in JBoss) and I get a ClassNotFoundException (see log below and notice how the HTTPConduit class tries to initialize and HTTP engine using Jetty).
11:45:57,875 INFO [ReflectionServiceFactoryBean] Creating Service {http://messaging.cmr/}AsyncMessagingService from WSDL: http://localhost:8001/wls-cxf.wsrm.recipient-war/services/AsyncMessagingS...
| 11:45:58,343 INFO [HTTPConduit] creating decoupled endpoint: http://localhost:9999/decoupled_endpoint
| 11:45:58,359 ERROR [[DebugServlet]] Servlet.service() for servlet DebugServlet threw exception
| java.lang.ClassNotFoundException: org.mortbay.jetty.Connector from BaseClassLoader@1816fb6{VFSClassLoaderPolicy@cd429b{...
| at org.jboss.classloader.spi.base.BaseClassLoader.loadClass(BaseClassLoader.java:448)
| at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
| at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
| at org.apache.cxf.transport.http_jetty.JettyHTTPServerEngineFactory.createJettyHTTPServerEngine(JettyHTTPServerEngineFactory.java:217)
| at org.apache.cxf.transport.http_jetty.JettyHTTPDestination.retrieveEngine(JettyHTTPDestination.java:114)
| at org.apache.cxf.transport.http_jetty.JettyHTTPDestination.finalizeConfig(JettyHTTPDestination.java:142)
| at org.apache.cxf.transport.http_jetty.JettyHTTPTransportFactory.createDestination(JettyHTTPTransportFactory.java:123)
| at org.apache.cxf.transport.http_jetty.JettyHTTPTransportFactory.getDestination(JettyHTTPTransportFactory.java:103)
| at org.apache.cxf.transport.http.HTTPConduit.getDestination(HTTPConduit.java:966)
| at org.apache.cxf.transport.http.HTTPConduit.setUpDecoupledDestination(HTTPConduit.java:943)
| at org.apache.cxf.transport.http.HTTPConduit.getBackChannel(HTTPConduit.java:747)
|
How can I configure CXF to delegate this task to JBoss? For example, to have JAX-WS web services published on JBoss, you need to configure an invoker from the JBoss integration layer:
<jaxws:endpoint id='AsyncMessaging'
| address='http://localhost:7180/jboss-cxf.wsrm.recipient/AsyncMessagingService'
| implementor='svc.impl.messaging.AsyncMessagingServiceImpl'>
| <jaxws:invoker>
| <bean class='org.jboss.wsf.stack.cxf.InvokerJSE' />
| </jaxws:invoker>
I hope somebody can point me in the right direction? My jbossws-cxf.xml currenty looks like this:
<cxf:bus>
| <cxf:features>
| <cxf:logging />
| <wsa:addressing />
| <wsrm-mgr:reliableMessaging>
| <wsrm-policy:RMAssertion>
| <wsrm-policy:BaseRetransmissionInterval
| Milliseconds="4000" />
| <wsrm-policy:AcknowledgementInterval
| Milliseconds="2000" />
| </wsrm-policy:RMAssertion>
| <wsrm-mgr:destinationPolicy>
| <wsrm-mgr:acksPolicy intraMessageThreshold="0" />
| </wsrm-mgr:destinationPolicy>
| </wsrm-mgr:reliableMessaging>
| </cxf:features>
| </cxf:bus>
|
| <http:conduit
| name="{http://messaging.cmr/}AsyncMessagingImplPort.http-conduit">
| <http:client DecoupledEndpoint="http://localhost:9999/decoupled_endpoint" />
| </http:conduit>
|
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4261659#4261659
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4261659
14 years, 6 months