通过使用JDK 1.6

时间:2017-06-19 08:19:01

标签: java soap jaxb wsimport

在调用使用JDK 1.6的wsimport命令生成的客户端存根时,我收到以下异常。 使用下面的客户端代码:

AppLookupServiceService service = new AppLookupServiceService();
AppLookupService port = service.getAppLookupService(); //This line causing the below exception (generating port from service)

* 使用wsimport和jdk 1.7

生成的客户端存根,相同的代码工作正常
Exception in thread "main" javax.xml.ws.WebServiceException
    at com.sun.xml.internal.ws.model.RuntimeModel.createJAXBContext(RuntimeModel.java:201)
    at com.sun.xml.internal.ws.model.RuntimeModel.postProcess(RuntimeModel.java:79)
    at com.sun.xml.internal.ws.modeler.RuntimeModeler.buildRuntimeModel(RuntimeModeler.java:255)
    at com.sun.xml.internal.ws.client.ServiceContextBuilder.processAnnotations(ServiceContextBuilder.java:119)
    at com.sun.xml.internal.ws.client.ServiceContextBuilder.completeServiceContext(ServiceContextBuilder.java:87)
    at com.sun.xml.internal.ws.client.WSServiceDelegate.processServiceContext(WSServiceDelegate.java:136)
    at com.sun.xml.internal.ws.client.WSServiceDelegate.createEndpointIFBaseProxy(WSServiceDelegate.java:288)
    at com.sun.xml.internal.ws.client.WSServiceDelegate.getPort(WSServiceDelegate.java:174)
    at javax.xml.ws.Service.getPort(Service.java:94)
    at com.lookup.webservices.AppLookupServiceService.getAppLookupService(AppLookupServiceService.java:50)
    at com.client.AppLookupClient.main(AppLookupClient.java:21)
Caused by: com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationsException: 8 counts of IllegalAnnotationExceptions
There's no ObjectFactory with an @XmlElementDecl for the element {http://webservices.lookup.com}lineOfBusiness.
    this problem is related to the following location:
        at protected javax.xml.bind.JAXBElement com.lookup.dto.LookUpServiceRequestDTO.lineOfBusiness
        at com.lookup.dto.LookUpServiceRequestDTO
        at protected com.lookup.dto.LookUpServiceRequestDTO com.lookup.webservices.GetLookUpServiceDetails.getLookUpService
        at com.lookup.webservices.GetLookUpServiceDetails
There's no ObjectFactory with an @XmlElementDecl for the element {http://webservices.lookup.com}flex1.
    this problem is related to the following location:
        at protected javax.xml.bind.JAXBElement com.lookup.dto.LookUpServiceRequestDTO.flex1
        at com.lookup.dto.LookUpServiceRequestDTO
        at protected com.lookup.dto.LookUpServiceRequestDTO com.lookup.webservices.GetLookUpServiceDetails.getLookUpService
        at com.lookup.webservices.GetLookUpServiceDetails

*

当我使用JDK 1.7从wsimport生成客户端存根时,我可以通过调用客户端存根来获取响应,但是使用JDK 1.6,我得到了上述异常。

我搜遍了所有地方,但没有找到任何有用的东西。

请说明为什么JDK 1.6会发生这种情况。

提前致谢。

0 个答案:

没有答案