Re: Base class members not serializing / deserializing

2008-04-06 Thread Brad O'Hearne

Doug,

Thanks for the reply.  Couple things -- first, @UriParam is now  
apparently @PathParam. Additionally, I cannot get the paths to work. I  
repeatedly get Tomcat errors that there's No operation matching  
request path..., and others like itstill a black artI'd love  
to get this worked out, as I've got jax-rs loaded, I just need to be  
able to hit it now. I've tried about every URL combination  
possibleno dice.


Prior to your post, I had reverted back to my Jax-WS frontend, and I  
discovered that inheritance IS working on serialization (outbound  
serialization on return types) but is NOT working on deserialization  
(inbound deserialization of XML to Java types on parameters). The  
problem is definitely there.


Brad

On Apr 5, 2008, at 7:54 PM, Doug wrote:


On Sun, 6 Apr 2008, Brad O'Hearne wrote:

I've moved to 2.1 SNAPSHOT -- my @UriTemplate annotations still won't
compile. Is there another dependency needed?



I think @UriTemplate was deprecated/replaced by @Path by the JSR-311  
folks,
but their spec documents aren't uptodate (thats my understanding  
anyway)



Something like the following works for me (from the 2.1 SNAPSHOT):

import javax.ws.rs.Path;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.core.HttpContext;
import javax.ws.rs.core.HttpHeaders;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.UriInfo;
import javax.ws.rs.core.MultivaluedMap;
import javax.ws.rs.ProduceMime;
import javax.ws.rs.ConsumeMime;
import javax.ws.rs.UriParam;
import javax.ws.rs.WebApplicationException;

@Path(/rc)
public class ReflectionCoverageService {

@POST
@Path(init/{clientId})
@ProduceMime(text/plain)
	public String init(@UriParam(clientId) String id, @HttpContext  
UriInfo

info, SomeJavaBeanClass sjbc) {
MultivaluedMap params  = info.getQueryParameters();







AegisDataBinding throwing NullPointer

2008-04-06 Thread Judes Tumuhairwe
Hi,
I have an interesting case binding/marshalling complex types using the 2.1
snapshot. A NullPointer is thrown [in NamespaceHelper.getPrefix() ] when I
used AegisDataBinding but it works perfectly fine when I use JAXB (see the
comment me to use JAXB line in the server  client).

Question: Do I absolutely have to have a prefix for my namespace? How come
it works fine with primitives? [actually I was trying to get the service
working with some interfaces  abstract classes  was running into no write
method for property xxx so when I took them out  dealt with POJOs, I ran
into this NPE.]

About the environment: Eclipse Europa, Win XP, Java 1.6
I have 2 beans, the interface and the implementation, the server  the
client (all in the same package).
First, here is the stacktrace:

Apr 6, 2008 2:06:05 AM
org.apache.cxf.service.factory.ReflectionServiceFactoryBean
buildServiceFromClass
INFO: Creating Service {http://education.toorosystems.com/}University from
class com.toorosystems.education.University
Exception in thread main java.lang.NullPointerException
at
org.apache.cxf.aegis.util.NamespaceHelper.getPrefix(NamespaceHelper.java:71)
at
org.apache.cxf.aegis.util.NamespaceHelper.getUniquePrefix(NamespaceHelper.java:57)
at
org.apache.cxf.aegis.type.basic.BeanType.getNameWithPrefix(BeanType.java:533)
at
org.apache.cxf.aegis.type.basic.BeanType.writeSchema(BeanType.java:483)
at
org.apache.cxf.aegis.databinding.AegisDatabinding.createSchemas(AegisDatabinding.java:477)
at
org.apache.cxf.aegis.databinding.AegisDatabinding.initialize(AegisDatabinding.java:322)
at
org.apache.cxf.service.factory.ReflectionServiceFactoryBean.buildServiceFromClass(ReflectionServiceFactoryBean.java:343)
at
org.apache.cxf.service.factory.ReflectionServiceFactoryBean.initializeServiceModel(ReflectionServiceFactoryBean.java:392)
at
org.apache.cxf.service.factory.ReflectionServiceFactoryBean.create(ReflectionServiceFactoryBean.java:180)
at
org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createEndpoint(AbstractWSDLBasedEndpointFactory.java:79)
at
org.apache.cxf.frontend.ServerFactoryBean.create(ServerFactoryBean.java:113)
at com.toorosystems.education.Server.main(Server.java:19)

The model:
*a)* The beans:
1. Course [id (long), name  description; their getters and setters, + 2
constructors: (no-arg  all-arg)]
2. Teacher [age (int), name, department; their getters/setters, + 2
constructors (no-arg  all-arg i.e. Course(int age, String name, String
dept)]

*b)* The interface:
package com.toorosystems.education;

import javax.jws.WebService;
import javax.jws.soap.SOAPBinding;
import javax.jws.WebMethod;
import javax.jws.WebResult;
import javax.jws.WebParam;

@WebService(name=University, targetNamespace=
http://education.toorosystems.com/;)
@SOAPBinding(use=SOAPBinding.Use.LITERAL, style=SOAPBinding.Style.DOCUMENT,
parameterStyle=SOAPBinding.ParameterStyle.BARE)
public interface University {

@WebResult(targetNamespace=http://education.toorosystems.com/;,
name=return, partName=return)
@WebMethod(operationName=getTeacher, exclude=false)
public Teacher getTeacher(@WebParam(targetNamespace=
http://education.toorosystems.com/;, name=course, mode=WebParam.Mode.IN)
Course course);
}

*c)* The implementation
package com.toorosystems.education;

import javax.xml.ws.WebServiceClient;

//@WebServiceClient(name=com.toorosystems.education.UniversityImpl,
targetNamespace=http://education.toorosystems.com/;)
public class UniversityImpl implements University {

public UniversityImpl() {}
public Teacher getTeacher(Course course) {
System.out.println(getTeacher called...);
return new Teacher(Mr. Tom, 52, Computer Science +
course.getName());
}

}


*d)* The Server
package com.toorosystems.education;

import org.apache.cxf.aegis.databinding.AegisDatabinding;
import org.apache.cxf.frontend.ServerFactoryBean;

public class Server {

public static void main(String[] args) {
// Create our service implementation
System.out.println(Starting server ...);
ServerFactoryBean svrFactory = new ServerFactoryBean();
svrFactory.setServiceClass(University.class);
svrFactory.setAddress(http://localhost:9090/TV;);
svrFactory.setServiceBean(new UniversityImpl());

// comment me to use JAXB
svrFactory.getServiceFactory().setDataBinding(new
AegisDatabinding());

svrFactory.create();
System.out.println(Server started!);
}
}

*e)* The client
package com.toorosystems.education;

import org.apache.cxf.aegis.databinding.AegisDatabinding;
import org.apache.cxf.frontend.ClientProxyFactoryBean;

public class Client {

public static void main(String[] args) {
// see
http://cwiki.apache.org/CXF20DOC/introduction-to-aegis-21.html
ClientProxyFactoryBean factory = new ClientProxyFactoryBean();
// comment me to use JAXB
factory.getServiceFactory().setDataBinding(new 

Re: Base class members not serializing / deserializing

2008-04-06 Thread Doug
On Sun, 6 Apr 2008, Brad O'Hearne wrote:
 Thanks for the reply.  Couple things -- first, @UriParam is now
 apparently @PathParam. Additionally, I cannot get the paths to work. I
 repeatedly get Tomcat errors that there's No operation matching
 request path..., and others like itstill a black artI'd love
 to get this worked out, as I've got jax-rs loaded, I just need to be
 able to hit it now. I've tried about every URL combination
 possibleno dice.

@PathParam may well be the next JSR-311 incarnation, but at least for 
apache-cxf-2.1-incubator-20080306.021818-37.zip the annotation that works,
for me, is @Path. 

Specifically, using my previous example, 
I have a tomcat webapps project reflncover which I access by the URL:
 
http://localhost:8080/reflncover/svc/rc/init/myclientid?arg1=val1arg2=val2

The svc component of the URL originates from the WEB-INF/web.xml file:

servlet-mapping
servlet-nameCXFServlet/servlet-name
url-pattern/svc/*/url-pattern
/servlet-mapping

Also, in my beans.xml file (referenced by web.xml) I have:

  import resource=classpath:META-INF/cxf/cxf.xml /
  import resource=classpath:META-INF/cxf/cxf-extension-jaxrs-binding.xml /
  import resource=classpath:META-INF/cxf/cxf-servlet.xml / 
  jaxrs:server id=reflectionCoverage address=/
jaxrs:serviceBeans
  bean class=au.net.mmsn.rc.services.ReflectionCoverageService /
/jaxrs:serviceBeans
  /jaxrs:server

It works for me. 

Originally I had a bit of trouble figuring the format of the XML to POST
to my /init/ REST service, so I ended up creating a dummy @GET service 
URL that returned a dummy bean class (as XML) that I created and 
populated within my ReflectionCovergeService class (below). Once I had 
that then submitting the same XML structure back just worked.

Hope this helps.
Doug


 Prior to your post, I had reverted back to my Jax-WS frontend, and I
 discovered that inheritance IS working on serialization (outbound
 serialization on return types) but is NOT working on deserialization
 (inbound deserialization of XML to Java types on parameters). The
 problem is definitely there.

Not sure what you mean by inheritance here. I looked briefly at JAX-WS
but wrapping everything in SOAP headers wasn't flexible enough for my
needs. 

Hope this helps
Doug


 On Apr 5, 2008, at 7:54 PM, Doug wrote:
  On Sun, 6 Apr 2008, Brad O'Hearne wrote:
  I've moved to 2.1 SNAPSHOT -- my @UriTemplate annotations still won't
  compile. Is there another dependency needed?
 
  I think @UriTemplate was deprecated/replaced by @Path by the JSR-311
  folks,
  but their spec documents aren't uptodate (thats my understanding
  anyway)
 
 
  Something like the following works for me (from the 2.1 SNAPSHOT):
 
  import javax.ws.rs.Path;
  import javax.ws.rs.GET;
  import javax.ws.rs.POST;
  import javax.ws.rs.core.HttpContext;
  import javax.ws.rs.core.HttpHeaders;
  import javax.ws.rs.core.Response;
  import javax.ws.rs.core.UriInfo;
  import javax.ws.rs.core.MultivaluedMap;
  import javax.ws.rs.ProduceMime;
  import javax.ws.rs.ConsumeMime;
  import javax.ws.rs.UriParam;
  import javax.ws.rs.WebApplicationException;
 
  @Path(/rc)
  public class ReflectionCoverageService {
 
  @POST
  @Path(init/{clientId})
  @ProduceMime(text/plain)
  public String init(@UriParam(clientId) String id, @HttpContext
  UriInfo
  info, SomeJavaBeanClass sjbc) {
  MultivaluedMap params  = info.getQueryParameters();




RE: Base class members not serializing / deserializing

2008-04-06 Thread Beryozkin, Sergey
Hi

@Path replaces @UriTemplate and @PathParam replaces @UriParam, 
I'm wondering why you have no compilation issues with jsr-311-api 0.6 if
use still can use @UriParam ? May be jsr-311-api 0.5 is also on a class
path ?

Cheers, Sergey

-Original Message-
From: Doug [mailto:[EMAIL PROTECTED] 
Sent: 06 April 2008 12:49
To: Brad O'Hearne
Cc: cxf-user@incubator.apache.org
Subject: Re: Base class members not serializing / deserializing

On Sun, 6 Apr 2008, Brad O'Hearne wrote:
 Thanks for the reply.  Couple things -- first, @UriParam is now
 apparently @PathParam. Additionally, I cannot get the paths to work. I
 repeatedly get Tomcat errors that there's No operation matching
 request path..., and others like itstill a black artI'd love
 to get this worked out, as I've got jax-rs loaded, I just need to be
 able to hit it now. I've tried about every URL combination
 possibleno dice.

@PathParam may well be the next JSR-311 incarnation, but at least for 
apache-cxf-2.1-incubator-20080306.021818-37.zip the annotation that
works,
for me, is @Path. 

Specifically, using my previous example, 
I have a tomcat webapps project reflncover which I access by the URL:
 
http://localhost:8080/reflncover/svc/rc/init/myclientid?arg1=val1arg2=v
al2

The svc component of the URL originates from the WEB-INF/web.xml file:

servlet-mapping
servlet-nameCXFServlet/servlet-name
url-pattern/svc/*/url-pattern
/servlet-mapping

Also, in my beans.xml file (referenced by web.xml) I have:

  import resource=classpath:META-INF/cxf/cxf.xml /
  import
resource=classpath:META-INF/cxf/cxf-extension-jaxrs-binding.xml /
  import resource=classpath:META-INF/cxf/cxf-servlet.xml / 
  jaxrs:server id=reflectionCoverage address=/
jaxrs:serviceBeans
  bean class=au.net.mmsn.rc.services.ReflectionCoverageService /
/jaxrs:serviceBeans
  /jaxrs:server

It works for me. 

Originally I had a bit of trouble figuring the format of the XML to POST
to my /init/ REST service, so I ended up creating a dummy @GET service 
URL that returned a dummy bean class (as XML) that I created and 
populated within my ReflectionCovergeService class (below). Once I had 
that then submitting the same XML structure back just worked.

Hope this helps.
Doug


 Prior to your post, I had reverted back to my Jax-WS frontend, and I
 discovered that inheritance IS working on serialization (outbound
 serialization on return types) but is NOT working on deserialization
 (inbound deserialization of XML to Java types on parameters). The
 problem is definitely there.

Not sure what you mean by inheritance here. I looked briefly at JAX-WS
but wrapping everything in SOAP headers wasn't flexible enough for my
needs. 

Hope this helps
Doug


 On Apr 5, 2008, at 7:54 PM, Doug wrote:
  On Sun, 6 Apr 2008, Brad O'Hearne wrote:
  I've moved to 2.1 SNAPSHOT -- my @UriTemplate annotations still
won't
  compile. Is there another dependency needed?
 
  I think @UriTemplate was deprecated/replaced by @Path by the JSR-311
  folks,
  but their spec documents aren't uptodate (thats my understanding
  anyway)
 
 
  Something like the following works for me (from the 2.1 SNAPSHOT):
 
  import javax.ws.rs.Path;
  import javax.ws.rs.GET;
  import javax.ws.rs.POST;
  import javax.ws.rs.core.HttpContext;
  import javax.ws.rs.core.HttpHeaders;
  import javax.ws.rs.core.Response;
  import javax.ws.rs.core.UriInfo;
  import javax.ws.rs.core.MultivaluedMap;
  import javax.ws.rs.ProduceMime;
  import javax.ws.rs.ConsumeMime;
  import javax.ws.rs.UriParam;
  import javax.ws.rs.WebApplicationException;
 
  @Path(/rc)
  public class ReflectionCoverageService {
 
  @POST
  @Path(init/{clientId})
  @ProduceMime(text/plain)
  public String init(@UriParam(clientId) String id, @HttpContext
  UriInfo
  info, SomeJavaBeanClass sjbc) {
  MultivaluedMap params  = info.getQueryParameters();


IONA Technologies PLC (registered in Ireland)
Registered Number: 171387
Registered Address: The IONA Building, Shelbourne Road, Dublin 4, Ireland


jax-rs URLs not working (was: Base class members not serializing / deserializing)

2008-04-06 Thread Brad O'Hearne

Doug,

Thanks for the reply. I'm still getting the same errors, going to show  
you exactly what happens in my implementation. Here is my web.xml:


!DOCTYPE web-app
PUBLIC -//Sun Microsystems, Inc.//DTD Web Application 2.3//EN
http://java.sun.com/dtd/web-app_2_3.dtd;
web-app
context-param
param-namecontextConfigLocation/param-name
param-valueWEB-INF/beans.xml/param-value
/context-param
listener
listener-class
org.springframework.web.context.ContextLoaderListener
/listener-class
/listener
servlet
servlet-nameCXFServlet/servlet-name
display-nameCXF Servlet/display-name
servlet-class
org.apache.cxf.transport.servlet.CXFServlet
/servlet-class
load-on-startup1/load-on-startup
/servlet
servlet-mapping
servlet-nameCXFServlet/servlet-name
url-pattern/services/*/url-pattern
/servlet-mapping
/web-app

Here is my beans.xml:

?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:jaxrs=http://cxf.apache.org/jaxrs;
xsi:schemaLocation=
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://cxf.apache.org/jaxrs
http://cxf.apache.org/schemas/jaxrs.xsd;
import resource=classpath:META-INF/cxf/cxf.xml /
import
resource=classpath:META-INF/cxf/cxf-extension-jaxrs-binding.xml 
/
import resource=classpath:META-INF/cxf/cxf-servlet.xml /
jaxrs:server id=userService address=/
jaxrs:serviceBeans
bean
class=com.brad.UserService /
/jaxrs:serviceBeans
/jaxrs:server
/beans

Here is my service interface (which is implemented by the UserService  
class referenced in beans.xml):


@Path(/UserService)
public interface IUserService {
@POST
@Path(authenticate)
@ConsumeMime(application/xml)
@ProduceMime(application/xml)
AuthenticateResponse authenticate(AuthenticateRequest request);
}

Tomcat loads cleanly (as far as I can tell -- no exceptions). When I  
try to access this service with an xml payload and the following URL:  http://localhost:8080/MyWebApp/services/UserService/authenticate


I get the following exception on the server:

Apr 6, 2008 7:38:46 AM  
org.apache.cxf.jaxrs.interceptor.JAXRSInInterceptor handleMessage
SEVERE: No operation found for path: /UserService/authenticate/,  
contentType: application/xml, Accept contentType: */*
Apr 6, 2008 7:38:46 AM org.apache.cxf.phase.PhaseInterceptorChain  
doIntercept

INFO: Interceptor has thrown exception, unwinding now
org.apache.cxf.interceptor.Fault: .No operation matching request path / 
UserService/authenticate/ is found, ContentType : application/xml,  
Accept : */*.
	at  
org 
.apache 
.cxf 
.jaxrs 
.interceptor.JAXRSInInterceptor.handleMessage(JAXRSInInterceptor.java: 
120)
	at  
org 
.apache 
.cxf 
.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:220)
	at  
org 
.apache 
.cxf 
.transport 
.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:78)
	at  
org 
.apache 
.cxf 
.transport.servlet.ServletDestination.invoke(ServletDestination.java:92)
	at  
org 
.apache 
.cxf 
.transport 
.servlet.ServletController.invokeDestination(ServletController.java:214)
	at  
org 
.apache 
.cxf.transport.servlet.ServletController.invoke(ServletController.java: 
113)
	at  
org 
.apache 
.cxf 
.transport.servlet.AbstractCXFServlet.invoke(AbstractCXFServlet.java: 
170)
	at  
org 
.apache 
.cxf 
.transport.servlet.AbstractCXFServlet.doPost(AbstractCXFServlet.java: 
148)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
	at  
org 
.apache 
.catalina 
.core 
.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java: 
290)
	at  
org 
.apache 
.catalina 
.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
	at  
org 
.apache 
.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java: 
233)
	at  
org 
.apache 
.catalina.core.StandardContextValve.invoke(StandardContextValve.java: 
175)
	at  
org 
.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java: 
128)
	at  
org 
.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java: 
102)
	at  
org 
.apache 
.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
	at  
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java: 
286)
	at  
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java: 
844)
	at org.apache.coyote.http11.Http11Protocol 

Re: AegisDataBinding throwing NullPointer

2008-04-06 Thread Benson Margulies
Aegis does not support unqualified schema. However, it should have just made
up one for you. Please post a JIRA.

On Sun, Apr 6, 2008 at 2:40 AM, Judes Tumuhairwe [EMAIL PROTECTED]
wrote:

 Hi,
 I have an interesting case binding/marshalling complex types using the 2.1
 snapshot. A NullPointer is thrown [in NamespaceHelper.getPrefix() ] when I
 used AegisDataBinding but it works perfectly fine when I use JAXB (see the
 comment me to use JAXB line in the server  client).

 Question: Do I absolutely have to have a prefix for my namespace? How come
 it works fine with primitives? [actually I was trying to get the service
 working with some interfaces  abstract classes  was running into no
 write
 method for property xxx so when I took them out  dealt with POJOs, I ran
 into this NPE.]

 About the environment: Eclipse Europa, Win XP, Java 1.6
 I have 2 beans, the interface and the implementation, the server  the
 client (all in the same package).
 First, here is the stacktrace:

 Apr 6, 2008 2:06:05 AM
 org.apache.cxf.service.factory.ReflectionServiceFactoryBean
 buildServiceFromClass
 INFO: Creating Service 
 {http://education.toorosystems.com/}Universityhttp://education.toorosystems.com/%7DUniversityfrom
 class com.toorosystems.education.University
 Exception in thread main java.lang.NullPointerException
at

 org.apache.cxf.aegis.util.NamespaceHelper.getPrefix(NamespaceHelper.java:71)
at

 org.apache.cxf.aegis.util.NamespaceHelper.getUniquePrefix(NamespaceHelper.java:57)
at

 org.apache.cxf.aegis.type.basic.BeanType.getNameWithPrefix(BeanType.java:533)
at
 org.apache.cxf.aegis.type.basic.BeanType.writeSchema(BeanType.java:483)
at

 org.apache.cxf.aegis.databinding.AegisDatabinding.createSchemas(AegisDatabinding.java:477)
at

 org.apache.cxf.aegis.databinding.AegisDatabinding.initialize(AegisDatabinding.java:322)
at

 org.apache.cxf.service.factory.ReflectionServiceFactoryBean.buildServiceFromClass(ReflectionServiceFactoryBean.java:343)
at

 org.apache.cxf.service.factory.ReflectionServiceFactoryBean.initializeServiceModel(ReflectionServiceFactoryBean.java:392)
at

 org.apache.cxf.service.factory.ReflectionServiceFactoryBean.create(ReflectionServiceFactoryBean.java:180)
at

 org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createEndpoint(AbstractWSDLBasedEndpointFactory.java:79)
at

 org.apache.cxf.frontend.ServerFactoryBean.create(ServerFactoryBean.java:113)
at com.toorosystems.education.Server.main(Server.java:19)

 The model:
 *a)* The beans:
 1. Course [id (long), name  description; their getters and setters, + 2
 constructors: (no-arg  all-arg)]
 2. Teacher [age (int), name, department; their getters/setters, + 2
 constructors (no-arg  all-arg i.e. Course(int age, String name, String
 dept)]

 *b)* The interface:
 package com.toorosystems.education;

 import javax.jws.WebService;
 import javax.jws.soap.SOAPBinding;
 import javax.jws.WebMethod;
 import javax.jws.WebResult;
 import javax.jws.WebParam;

 @WebService(name=University, targetNamespace=
 http://education.toorosystems.com/;)
 @SOAPBinding(use=SOAPBinding.Use.LITERAL,
 style=SOAPBinding.Style.DOCUMENT,
 parameterStyle=SOAPBinding.ParameterStyle.BARE)
 public interface University {

@WebResult(targetNamespace=http://education.toorosystems.com/;,
 name=return, partName=return)
@WebMethod(operationName=getTeacher, exclude=false)
public Teacher getTeacher(@WebParam(targetNamespace=
 http://education.toorosystems.com/;, name=course, mode=WebParam.Mode.IN)
Course course);
 }

 *c)* The implementation
 package com.toorosystems.education;

 import javax.xml.ws.WebServiceClient;

 //@WebServiceClient(name=com.toorosystems.education.UniversityImpl,
 targetNamespace=http://education.toorosystems.com/;)
 public class UniversityImpl implements University {

public UniversityImpl() {}
public Teacher getTeacher(Course course) {
System.out.println(getTeacher called...);
return new Teacher(Mr. Tom, 52, Computer Science +
 course.getName());
}

 }


 *d)* The Server
 package com.toorosystems.education;

 import org.apache.cxf.aegis.databinding.AegisDatabinding;
 import org.apache.cxf.frontend.ServerFactoryBean;

 public class Server {

public static void main(String[] args) {
// Create our service implementation
System.out.println(Starting server ...);
ServerFactoryBean svrFactory = new ServerFactoryBean();
svrFactory.setServiceClass(University.class);
svrFactory.setAddress(http://localhost:9090/TV;);
svrFactory.setServiceBean(new UniversityImpl());

// comment me to use JAXB
svrFactory.getServiceFactory().setDataBinding(new
 AegisDatabinding());

svrFactory.create();
System.out.println(Server started!);
}
 }

 *e)* The client
 package com.toorosystems.education;

 import org.apache.cxf.aegis.databinding.AegisDatabinding;
 import org.apache.cxf.frontend.ClientProxyFactoryBean;

 

Re: /soapenv:Envelope

2008-04-06 Thread Benson Margulies
Did you enable validation?

On Fri, Apr 4, 2008 at 4:30 PM, Web Man [EMAIL PROTECTED] wrote:


 When a SOAP request is submitted without the closing /soapenv:Envelope,
 the
 Web Service is called and no errors are thrown.

 soapenv:Envelope xmlns:soapenv=http://schemas.xmlsoap.org/soap/envelope/
 
 xmlns:v1=
 http://www.nortel.com/xmlprotocol/wsdl/data/protocol_interfaces/cisco_icm/v1_0
 
   soapenv:Header/
   soapenv:Body
  v1:CallCleared-Event
 !--Optional:--
 callId35756/callId
 cause6/cause
  /v1:CallCleared-Event
   /soapenv:Body

 *  There should be a /soapenv:Envelope at the end of this request
 *
 --
 View this message in context:
 http://www.nabble.com/%3C-soapenv%3AEnvelope%3E-tp16498308p16498308.html
 Sent from the cxf-user mailing list archive at Nabble.com.




Re: jax-rs URLs not working (was: Base class members not serializing / deserializing)

2008-04-06 Thread Doug
Maybe the annotations have to go in the implementation class 
instead/as well? I didn't use an interface - just an instantiatable
class (with method bodies).

Apart from broken POST data, thats the only other thing I can think of.

Doug


On Mon, 7 Apr 2008, Brad O'Hearne wrote:
 Doug,

 Thanks for the reply. I'm still getting the same errors, going to show
 you exactly what happens in my implementation. Here is my web.xml:

 !DOCTYPE web-app
  PUBLIC -//Sun Microsystems, Inc.//DTD Web Application 2.3//EN
  http://java.sun.com/dtd/web-app_2_3.dtd;
 web-app
   context-param
   param-namecontextConfigLocation/param-name
   param-valueWEB-INF/beans.xml/param-value
   /context-param
   listener
   listener-class
   org.springframework.web.context.ContextLoaderListener
   /listener-class
   /listener
   servlet
   servlet-nameCXFServlet/servlet-name
   display-nameCXF Servlet/display-name
   servlet-class
   org.apache.cxf.transport.servlet.CXFServlet
   /servlet-class
   load-on-startup1/load-on-startup
   /servlet
   servlet-mapping
   servlet-nameCXFServlet/servlet-name
   url-pattern/services/*/url-pattern
   /servlet-mapping
 /web-app

 Here is my beans.xml:

 ?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:jaxrs=http://cxf.apache.org/jaxrs;
   xsi:schemaLocation=
   http://www.springframework.org/schema/beans
   http://www.springframework.org/schema/beans/spring-beans.xsd
   http://cxf.apache.org/jaxrs
   http://cxf.apache.org/schemas/jaxrs.xsd;
   import resource=classpath:META-INF/cxf/cxf.xml /
   import
   
 resource=classpath:META-INF/cxf/cxf-extension-jaxrs-binding.xml /
   import resource=classpath:META-INF/cxf/cxf-servlet.xml /
   jaxrs:server id=userService address=/
   jaxrs:serviceBeans
   bean
   class=com.brad.UserService /
   /jaxrs:serviceBeans
   /jaxrs:server
 /beans

 Here is my service interface (which is implemented by the UserService
 class referenced in beans.xml):

 @Path(/UserService)
 public interface IUserService {
  @POST
  @Path(authenticate)
  @ConsumeMime(application/xml)
  @ProduceMime(application/xml)
  AuthenticateResponse authenticate(AuthenticateRequest request);
 }

 Tomcat loads cleanly (as far as I can tell -- no exceptions). When I
 try to access this service with an xml payload and the following URL: 
 http://localhost:8080/MyWebApp/services/UserService/authenticate

 I get the following exception on the server:

 Apr 6, 2008 7:38:46 AM
 org.apache.cxf.jaxrs.interceptor.JAXRSInInterceptor handleMessage
 SEVERE: No operation found for path: /UserService/authenticate/,
 contentType: application/xml, Accept contentType: */*
 Apr 6, 2008 7:38:46 AM org.apache.cxf.phase.PhaseInterceptorChain
 doIntercept
 INFO: Interceptor has thrown exception, unwinding now
 org.apache.cxf.interceptor.Fault: .No operation matching request path /
 UserService/authenticate/ is found, ContentType : application/xml,
 Accept : */*.
   at
 org
 .apache
 .cxf
 .jaxrs
 .interceptor.JAXRSInInterceptor.handleMessage(JAXRSInInterceptor.java:
 120)
   at
 org
 .apache
 .cxf
 .phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:220)
   at
 org
 .apache
 .cxf
 .transport
 .ChainInitiationObserver.onMessage(ChainInitiationObserver.java:78)
   at
 org
 .apache
 .cxf
 .transport.servlet.ServletDestination.invoke(ServletDestination.java:92)
   at
 org
 .apache
 .cxf
 .transport
 .servlet.ServletController.invokeDestination(ServletController.java:214)
   at
 org
 .apache
 .cxf.transport.servlet.ServletController.invoke(ServletController.java:
 113)
   at
 org
 .apache
 .cxf
 .transport.servlet.AbstractCXFServlet.invoke(AbstractCXFServlet.java:
 170)
   at
 org
 .apache
 .cxf
 .transport.servlet.AbstractCXFServlet.doPost(AbstractCXFServlet.java:
 148)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
   at
 org
 .apache
 .catalina
 .core
 .ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:
 290)
   at
 org
 .apache
 .catalina
 .core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
   at
 org
 .apache
 .catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:
 233)
   at
 org
 .apache
 .catalina.core.StandardContextValve.invoke(StandardContextValve.java:
 175)
   at
 org
 .apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:
 128)
   at
 org
 .apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:
 102)
 

Re: CXF Service End Points reloaded every time in WebLogic

2008-04-06 Thread Glen Mazza
I have not worked with this type of problem before.  Possible guesses:

1.) Anything in our WebLogic docs[1] that may be relevant for your
problem?

2.) We have two types of configuration for web services--via a
cxf-servlet.xml file and directly through Spring configuration[2].  If
you try the cxf-servlet.xml method, does the problem go away?  It might
be something Spring-related that is causing the reinitialization to be
occurring each time.

HTH,
Glen

[1]
http://cwiki.apache.org/confluence/display/CXF20DOC/AppServerGuide#AppServerGuide-WebLogic
[2]
http://cwiki.apache.org/CXF20DOC/configuration.html#Configuration-Serverconfigurationfiles


Am Samstag, den 05.04.2008, 11:14 -0700 schrieb stevewu:
 Hi all,
 
 I deployed my web services in WebLogic with an EAR file.Every time I access
 a web service it rebuild all the end points defined in cxf-servlet.xml. Is
 there some parameters that I can set, so that the endpoints will be build
 only once when I start the service?
 
 Entries in cxf-servlet.xml
 ?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:cxf=http://cxf.apache.org/core;
   xmlns:wsa=http://cxf.apache.org/ws/addressing;
   xmlns:jaxws=http://cxf.apache.org/jaxws;
   xmlns:soap=http://cxf.apache.org/bindings/soap;
   xsi:schemaLocation=
 http://www.springframework.org/schema/beans
 http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
 http://cxf.apache.org/bindings/soap
 http://cxf.apache.org/schemas/configuration/soap.xsd
 http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd
 http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd;
 
   
 
 jaxws:endpoint
 id=LoginService
 implementor=com.myworld.ws.jaxws.provider.LoginProvider
 wsdlLocation=WEB-INF/wsdl/Login.wsdl
 address=/LoginService
 jaxws:features
  bean class=org.apache.cxf.feature.LoggingFeature/
 /jaxws:features
 /jaxws:endpoint
 ..
 /beans
 
 Below is the top part of the console output before it rebuild the end
 points.
 
 
 Apr 5, 2008 12:38:59 PM org.apache.cxf.transport.servlet.CXFServlet
 loadSpringBus
 INFO: Load the bus without application context
 log4j:WARN No appenders could be found for logger
 (org.apache.cxf.bus.spring.BusApplicationContext).
 log4j:WARN Please initialize the log4j system properly.
 Apr 5, 2008 12:39:04 PM org.apache.cxf.configuration.spring.ConfigurerImpl
 init
 INFO: Could not find the configuration file cxf.xml on the classpath.
 Apr 5, 2008 12:39:06 PM org.apache.cxf.transport.servlet.AbstractCXFServlet
 replaceDestinationFactory
 INFO: Replaced the http destionFactory with servlet transport factory
 Apr 5, 2008 12:39:06 PM org.apache.cxf.transport.servlet.CXFServlet
 loadAdditionalConfig
 INFO: Build endpoints from config-location: /WEB-INF/cxf-servlet.xml