Can't get REST style Web Services using JAX-WS Provider/Dispatch to work
marcelcasado Dec 9, 2009 5:09 PMHi,
Based on CXF support for building REST style Web Services using the JAX-WS Provider/Dispatch and XML binding I'm trying to get a little service going on Fuse 4.1.0 and CXF 2.2.2.1-fuse
Here is the excerpt of the service impl:
@WebServiceProvider()
@ServiceMode(value = Service.Mode.PAYLOAD)
public class WSDLRestSourcePayloadProvider implements Provider {
private GetWSDLServiceImpl wsdlService;
@Resource
protected WebServiceContext wsContext;
public WSDLRestSourcePayloadProvider() {
}
public DOMSource invoke(DOMSource request) {
MessageContext mc = wsContext.getMessageContext();
String path = (String)mc.get(Message.PATH_INFO);
String query = (String)mc.get(Message.QUERY_STRING);
String httpMethod = (String)mc.get(Message.HTTP_REQUEST_METHOD);
System.out.println("path- " + path);
System.out.println("query- " + query);
System.out.println("httpMethod- " + httpMethod);
if (httpMethod.equalsIgnoreCase("POST")) {
// TBD: parse query info from DOMSource
return null;
} else if (httpMethod.equalsIgnoreCase("GET")) {
if (path.equals("/wsdlService/wsdl") && query != null) {
if(query.indexOf("rwsdl") >= 0)
{
System.out.println("-Invoking getWSDL-");
return getWSDL(query);
}
else if(query.indexOf("rxsd") >= 0)
{
return getXSD(query);
}
}
}
return null;
}
The service endpoint definition on Spring :
When querying the service with http://localhost:8087/wsdlService/wsdl I got the exception :
org.apache.cxf.interceptor.Fault: Invalid URL/Verb combination. Verb: GET Path:
at org.apache.cxf.binding.http.interceptor.DispatchInterceptor.handleMessage(DispatchInterceptor.java:74)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:236)
at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:89)
at org.apache.cxf.transport.http_jetty.JettyHTTPDestination.serviceRequest(JettyHTTPDestination.java:302)
at org.apache.cxf.transport.http_jetty.JettyHTTPDestination.doService(JettyHTTPDestination.java:266)
at org.apache.cxf.transport.http_jetty.JettyHTTPHandler.handle(JettyHTTPHandler.java:70)
at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:766)
at org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:230)
at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
at org.mortbay.jetty.Server.handle(Server.java:320)
I also tried using bindingUri="http://cxf.apache.org/bindings/xformat" but I got :
org.apache.cxf.interceptor.Fault: No such operation: (HTTP GET PATH_INFO: /wsdlService/wsdl)
at org.apache.cxf.interceptor.URIMappingInterceptor.handleMessage(URIMappingInterceptor.java:83)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:236)
at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:89)
at org.apache.cxf.transport.http_jetty.JettyHTTPDestination.serviceRequest(JettyHTTPDestination.java:302)
at org.apache.cxf.transport.http_jetty.JettyHTTPDestination.doService(JettyHTTPDestination.java:266)
at org.apache.cxf.transport.http_jetty.JettyHTTPHandler.handle(JettyHTTPHandler.java:70)
at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:766)
at org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:230)
at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
What I'm missing ?
Thanks,
-Marcel