Hi,

I have cxf 2.3.1 running inside of eclipse helios with java jdk 1.6.0_23.

I changed the client main method of the Restful Http Binding Demo to test
the SOAP interface.  
Here is the code:

        private static final QName serviceName = new
QName("http://demo.restful.server";, "CustomerService");
        private static final QName portName = new
QName("http://demo.restful.server";, "CustomerServicePort");

        public static void main(String[] args) throws Exception {
                Service service = Service.create(serviceName);
                // Endpoint Address
                String endpointAddress = "http://localhost:8080/soap";;

                // Add a port to the Service
                service.addPort(portName, SOAPBinding.SOAP11HTTP_BINDING,
endpointAddress);

                GetCustomer customer = new GetCustomer();
                customer.setId(123);

                CustomerServiceImpl customerService =
service.getPort(CustomerServiceImpl.class);
                System.out.println(customerService.getCustomer(customer));

                System.out.println();
        }

and i get this exception:

Exception in thread "main" javax.xml.ws.WebServiceException:
org.apache.cxf.service.factory.ServiceConstructionException
        at org.apache.cxf.jaxws.ServiceImpl.getPort(ServiceImpl.java:312)
        at org.apache.cxf.jaxws.ServiceImpl.getPort(ServiceImpl.java:305)
        at javax.xml.ws.Service.getPort(Service.java:161)
        at demo.restful.client.Client.main(Client.java:63)
Caused by: org.apache.cxf.service.factory.ServiceConstructionException
        at 
org.apache.cxf.jaxb.JAXBDataBinding.initialize(JAXBDataBinding.java:341)
        at
org.apache.cxf.service.factory.AbstractServiceFactoryBean.initializeDataBindings(AbstractServiceFactoryBean.java:86)
        at
org.apache.cxf.service.factory.ReflectionServiceFactoryBean.buildServiceFromClass(ReflectionServiceFactoryBean.java:442)
        at
org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.buildServiceFromClass(JaxWsServiceFactoryBean.java:680)
        at
org.apache.cxf.service.factory.ReflectionServiceFactoryBean.initializeServiceModel(ReflectionServiceFactoryBean.java:505)
        at
org.apache.cxf.service.factory.ReflectionServiceFactoryBean.create(ReflectionServiceFactoryBean.java:242)
        at
org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.create(JaxWsServiceFactoryBean.java:202)
        at org.apache.cxf.jaxws.ServiceImpl.createPort(ServiceImpl.java:437)
        at org.apache.cxf.jaxws.ServiceImpl.getPort(ServiceImpl.java:310)
        ... 3 more
Caused by: com.sun.xml.bind.v2.runtime.IllegalAnnotationsException: 1 counts
of IllegalAnnotationExceptions
Two classes have the same XML type name
"{http://demo.restful.server}getCustomer";. Use @XmlType.name and
@XmlType.namespace to assign different names to them.
        this problem is related to the following location:
                at demo.restful.server.GetCustomer
                at private demo.restful.server.GetCustomer
demo.restful.server.jaxws_asm.GetCustomer.GetCustomer
                at demo.restful.server.jaxws_asm.GetCustomer
        this problem is related to the following location:
                at demo.restful.server.jaxws_asm.GetCustomer

        at
com.sun.xml.bind.v2.runtime.IllegalAnnotationsException$Builder.check(IllegalAnnotationsException.java:102)
        at
com.sun.xml.bind.v2.runtime.JAXBContextImpl.getTypeInfoSet(JAXBContextImpl.java:472)
        at
com.sun.xml.bind.v2.runtime.JAXBContextImpl.<init>(JAXBContextImpl.java:302)
        at
com.sun.xml.bind.v2.runtime.JAXBContextImpl$JAXBContextBuilder.build(JAXBContextImpl.java:1140)
        at
com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:154)
        at
com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:121)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:202)
        at javax.xml.bind.ContextFinder.find(ContextFinder.java:363)
        at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:574)
        at
org.apache.cxf.jaxb.JAXBDataBinding.createContext(JAXBDataBinding.java:564)
        at
org.apache.cxf.jaxb.JAXBDataBinding.createJAXBContextAndSchemas(JAXBDataBinding.java:504)
        at 
org.apache.cxf.jaxb.JAXBDataBinding.initialize(JAXBDataBinding.java:324)
        ... 11 more

all the other intefaces work as expected, as well as
http://localhost:8080/soap?wsdl

I have not changed any other code.

Can anyone tell me what I am doing wrong or how to fix the issue.

Thanks,

Chris



-- 
View this message in context: 
http://cxf.547215.n5.nabble.com/IllegalAnnotationExceptions-when-running-Restful-Http-Binding-Demo-tp3349642p3349642.html
Sent from the cxf-user mailing list archive at Nabble.com.

Reply via email to