Travelport / travelport-uapi-tutorial

The travelport-uapi-tutorial is a Java project for Universal API that will help you connect and code a standard workflow including Air and Hotel.
45 stars 34 forks source link

ServiceConstructionException #393

Open SwpuEsine opened 7 years ago

SwpuEsine commented 7 years ago

when i create a AirReservatReq, it occurs: 十月 09, 2017 5:20:38 下午 org.apache.cxf.wsdl.service.factory.ReflectionServiceFactoryBean buildServiceFromWSDL 信息: Creating Service {http://www.travelport.com/service/universal_v42_0}AirService from WSDL: file:/C:/Users/jiww/Desktop/20170927/travelport-uapi-tutorial-master/wsdl/universal_v42_0/UniversalRecord.wsdl

java.lang.RuntimeException: javax.xml.ws.WebServiceException: org.apache.cxf.service.factory.ServiceConstructionException

at com.travelport.tutorial.support.PortWrapper.init(PortWrapper.java:206)
at com.travelport.tutorial.support.PortWrapper.get(PortWrapper.java:79)
at com.travelport.uapi.unit1.CreateReservat.CreateReservatReq(CreateReservat.java:50)
at com.travelport.uapi.unit1.CreateReservat.Test1(CreateReservat.java:66)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
at org.junit.runner.JUnitCore.run(JUnitCore.java:160)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:51)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)

Caused by: javax.xml.ws.WebServiceException: org.apache.cxf.service.factory.ServiceConstructionException at org.apache.cxf.jaxws.ServiceImpl.getPort(ServiceImpl.java:360) at org.apache.cxf.jaxws.ServiceImpl.getPort(ServiceImpl.java:349) at javax.xml.ws.Service.getPort(Service.java:119) at com.travelport.service.universal_v42_0.AirService.getAirCreateReservationPort(AirService.java:74) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at com.travelport.tutorial.support.PortWrapper.init(PortWrapper.java:185) ... 25 more Caused by: org.apache.cxf.service.factory.ServiceConstructionException at org.apache.cxf.jaxb.JAXBDataBinding.initialize(JAXBDataBinding.java:329) at org.apache.cxf.service.factory.AbstractServiceFactoryBean.initializeDataBindings(AbstractServiceFactoryBean.java:86) at org.apache.cxf.wsdl.service.factory.ReflectionServiceFactoryBean.buildServiceFromWSDL(ReflectionServiceFactoryBean.java:426) at org.apache.cxf.wsdl.service.factory.ReflectionServiceFactoryBean.initializeServiceModel(ReflectionServiceFactoryBean.java:528) at org.apache.cxf.wsdl.service.factory.ReflectionServiceFactoryBean.create(ReflectionServiceFactoryBean.java:263) at org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.create(JaxWsServiceFactoryBean.java:199) at org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createEndpoint(AbstractWSDLBasedEndpointFactory.java:103) at org.apache.cxf.frontend.ClientFactoryBean.create(ClientFactoryBean.java:91) at org.apache.cxf.frontend.ClientProxyFactoryBean.create(ClientProxyFactoryBean.java:159) at org.apache.cxf.jaxws.JaxWsProxyFactoryBean.create(JaxWsProxyFactoryBean.java:142) at org.apache.cxf.jaxws.ServiceImpl.createPort(ServiceImpl.java:492) at org.apache.cxf.jaxws.ServiceImpl.getPort(ServiceImpl.java:358) ... 33 more Caused by: com.sun.xml.bind.v2.runtime.IllegalAnnotationsException: 1 counts of IllegalAnnotationExceptions javax.xml.bind.JAXBElement没有无参数默认构造器。 this problem is related to the following location: at javax.xml.bind.JAXBElement at public javax.xml.bind.JAXBElement com.travelport.schema.hotel_v42_0.ObjectFactory.createHotelSearchAvailabilityRsp(com.travelport.schema.hotel_v42_0.BaseHotelSearchRsp) at com.travelport.schema.hotel_v42_0.ObjectFactory

at com.sun.xml.bind.v2.runtime.IllegalAnnotationsException$Builder.check(IllegalAnnotationsException.java:66)
at com.sun.xml.bind.v2.runtime.JAXBContextImpl.getTypeInfoSet(JAXBContextImpl.java:364)
at com.sun.xml.bind.v2.runtime.JAXBContextImpl.<init>(JAXBContextImpl.java:216)
at com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:76)
at com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:55)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:248)
at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:235)
at javax.xml.bind.ContextFinder.find(ContextFinder.java:432)
at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:637)
at org.apache.cxf.common.jaxb.JAXBContextCache$2.run(JAXBContextCache.java:347)
at org.apache.cxf.common.jaxb.JAXBContextCache$2.run(JAXBContextCache.java:345)
at java.security.AccessController.doPrivileged(Native Method)
at org.apache.cxf.common.jaxb.JAXBContextCache.createContext(JAXBContextCache.java:345)
at org.apache.cxf.common.jaxb.JAXBContextCache.getCachedContextAndSchemas(JAXBContextCache.java:246)
at org.apache.cxf.jaxb.JAXBDataBinding.createJAXBContextAndSchemas(JAXBDataBinding.java:472)
at org.apache.cxf.jaxb.JAXBDataBinding.initialize(JAXBDataBinding.java:327)
... 44 more

i wonder know what should i do

vivekjyotipramanik commented 7 years ago

Hi SwpuEsine,

I believe the issue here is you are using CXF, which does not support MaxOccurs more than 5000. We have some MaxOccurs valus as 9999 in wsdl which is causing the issue with ServiceConstruction. Could you please try with apache axis2 instead of CXF. Please let us know how it goes. Thanks.

SwpuEsine commented 7 years ago

hi vivekjyotipramanik, thanks for your help,you are right, i did use CXF, But I have several interfaces that already use CXF,And I've never used axis2,could you give me some demo to study,thanks