[
https://issues.apache.org/jira/browse/CXF-4626?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Daniel Kulp resolved CXF-4626.
------------------------------
Resolution: Cannot Reproduce
Fix Version/s: Invalid
No response for a requested test case after way more than a month.
> JAXB Marshalling error class not known to this context
> ------------------------------------------------------
>
> Key: CXF-4626
> URL: https://issues.apache.org/jira/browse/CXF-4626
> Project: CXF
> Issue Type: Bug
> Components: JAXB Databinding
> Affects Versions: 2.5.4
> Environment: Windows 7, Netbeans 7.1.2,
> Reporter: Shaun Montgomery
> Fix For: Invalid
>
>
> I am trying to update a web service client and change it from using
> pregenerated classes using wsdl2java to dynamically loading the wsdl and
> creating the client. The application needs to dynamically load the request
> and response structures and uses java reflection to display the contents of
> the response. I use the following code to create the dynamic client:
> JaxWsDynamicClientFactory dcf =
> JaxWsDynamicClientFactory.newInstance();
>
> Logger.getLogger(AXAddressService.class.getName()).log(Level.INFO,"Dynamically
> loading wsdl from " + theWsdlLocation);
> ClassLoader clBefore =
> Thread.currentThread().getContextClassLoader();
> dynClient = dcf.createClient(theWsdlLocation, bindingFileList);
> if (dynClient == null) {
>
> Logger.getLogger(AXAddressService.class.getName()).log(Level.SEVERE,"dynClient
> creation not successful");
> } else {
>
> Logger.getLogger(AXAddressService.class.getName()).log(Level.INFO,"Successful
> creation of service client from wsdl at " + theWsdlLocation);
> }
>
> Bus bus = ((EndpointImpl) dynClient.getEndpoint()).getBus();
> PolicyInterceptorProviderRegistry pipr =
> bus.getExtension(PolicyInterceptorProviderRegistry.class);
> pipr.register(new XRMAuthPolicyProvider());
>
> http = (HTTPConduit) dynClient.getConduit();
> // ************************
> HTTPClientPolicy httpClientPolicy = new HTTPClientPolicy();
> httpClientPolicy.setConnectionTimeout(36000);
> httpClientPolicy.setAllowChunking(false);
> http.setClient(httpClientPolicy);
> I then use the following code to invoke the read method on the service:
> Class asrReqClass =
> Class.forName("com.microsoft.schemas.dynamics._2008._01.services.AddressServiceReadRequest");
> Object asrReq = asrReqClass.newInstance();
> EntityKeyList ekl = CreateEntityKeyList(keys);
>
> Method setEntityKeyListMethod =
> asrReq.getClass().getMethod("setEntityKeyList", EntityKeyList.class);
> setEntityKeyListMethod.invoke(asrReq, ekl);
>
> Object [] asrRespObjs = dynClient.invoke("read", asrReq);
> I have also tried to use the context loader to load the asrReq class.
> If I add code to create a JAXBContext, I am able to marshall the asrReq class
> correctly.
> The Exception I am getting is:
> Nov 9, 2012 9:58:06 AM org.apache.cxf.phase.PhaseInterceptorChain
> doDefaultLogging
> WARNING: Interceptor for
> {http://schemas.microsoft.com/dynamics/2008/01/services}AddressService#{http://schemas.microsoft.com/dynamics/2008/01/services}read
> has thrown exception, unwinding now
> org.apache.cxf.interceptor.Fault: Marshalling Error:
> com.microsoft.schemas.dynamics._2008._01.services.AddressServiceReadRequest
> is not known to this context
> at
> org.apache.cxf.jaxb.JAXBEncoderDecoder.marshall(JAXBEncoderDecoder.java:261)
> at org.apache.cxf.jaxb.io.DataWriterImpl.write(DataWriterImpl.java:169)
> ...
> I would really appreciate some help with this. I've already spent too much
> time trying to figure it out and a solution is critical.
> Thanks in advance.
> Shaun
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira