Return-Path: Delivered-To: apmail-incubator-cxf-issues-archive@locus.apache.org Received: (qmail 10665 invoked from network); 6 Apr 2008 19:59:14 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 6 Apr 2008 19:59:14 -0000 Received: (qmail 74590 invoked by uid 500); 6 Apr 2008 19:59:14 -0000 Delivered-To: apmail-incubator-cxf-issues-archive@incubator.apache.org Received: (qmail 74572 invoked by uid 500); 6 Apr 2008 19:59:14 -0000 Mailing-List: contact cxf-issues-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: cxf-dev@incubator.apache.org Delivered-To: mailing list cxf-issues@incubator.apache.org Received: (qmail 74563 invoked by uid 99); 6 Apr 2008 19:59:14 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 06 Apr 2008 12:59:14 -0700 X-ASF-Spam-Status: No, hits=-1998.5 required=10.0 tests=ALL_TRUSTED,WEIRD_PORT X-Spam-Check-By: apache.org Received: from [140.211.11.140] (HELO brutus.apache.org) (140.211.11.140) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 06 Apr 2008 19:58:30 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 53FD1234C0B5 for ; Sun, 6 Apr 2008 12:56:24 -0700 (PDT) Message-ID: <1830162162.1207511784339.JavaMail.jira@brutus> Date: Sun, 6 Apr 2008 12:56:24 -0700 (PDT) From: "Benson Margulies (JIRA)" To: cxf-issues@incubator.apache.org Subject: [jira] Resolved: (CXF-1504) AegisDataBinding throws NullPointer with un-prefixed Namespace In-Reply-To: <1716023582.1207503444502.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/CXF-1504?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Benson Margulies resolved CXF-1504. ----------------------------------- Resolution: Fixed Fix Version/s: 2.1 svn 645294. This appears to be a problem with doc/lit/bare versus Aegis. > AegisDataBinding throws NullPointer with un-prefixed Namespace > -------------------------------------------------------------- > > Key: CXF-1504 > URL: https://issues.apache.org/jira/browse/CXF-1504 > Project: CXF > Issue Type: Bug > Components: Aegis Databinding > Affects Versions: 2.1 > Environment: Windows XP, Eclipse Europa (3.3), Java 1.6 > Reporter: Judes Tumuhairwe > Assignee: Benson Margulies > Fix For: 2.1 > > > When dealing with Complex types (i.e. non-primitives), AegisDatabinding throws a NullPointer exception [in NamespaceHelper.getPrefix() ] when I but it works perfectly fine when I use JAXB (see the "comment me to use JAXB" line in the server & client). It should default to a prefix e.g. ns0. > 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) > To reproduce: > I had 2 beans, the interface and the implementation, the server & the client (all in the same package). > 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 AegisDatabinding()); > > factory.setServiceClass(University.class); > factory.setAddress("http://localhost:9090/TV"); > University client = (University) factory.create(); > > Teacher tr = client.getTeacher(new Course(40, "Intro to CS", "Introductory Comp Sci")); > System.out.println("Response is: " + tr.getName() + ", " + tr.getAge() + ", " + tr.getDepartment()); > } > } -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.