-
15. Re: XmlJavaTypeAdapter classes ignored in SOAP responses
geturner Jul 2, 2015 10:58 AM (in response to asoldano)I actually verified that first, but the client and the WAR/WEB-INF/lib both have EXACTLY the same jar that includes the schemas/wsdls, and classes.
jar -tvf excerpt:
0 Thu Jul 02 08:53:18 MDT 2015 wsdl/External/C2SSACOI/3.x.x/ISM/CVE/Schema/W3C-XML/
0 Thu Jul 02 08:53:18 MDT 2015 wsdl/External/C2SSACOI/3.x.x/ISM/CVE/Schema/XLINK/
0 Thu Jul 02 08:53:18 MDT 2015 wsdl/External/C2SSACOI/3.x.x/ISM/Schema/
0 Thu Jul 02 08:53:18 MDT 2015 wsdl/External/C2SSACOI/3.x.x/ISM/Schema/ISM/
0 Thu Jul 02 08:53:18 MDT 2015 wsdl/External/C2SSACOI/3.x.x/ISM/Schema/ISM/CVEGenerated/
0 Thu Jul 02 08:53:18 MDT 2015 wsdl/External/C2SSACOI/3.x.x/Types/
0 Thu Jul 02 08:53:18 MDT 2015 wsdl/External/C2SSACOI/CodeLists/
507 Thu Jul 02 08:53:30 MDT 2015 com/lmco/spacefence/webservices/util/package-info.class
1694 Thu Jul 02 08:53:30 MDT 2015 com/lmco/spacefence/webservices/util/XmlDateAdapter.class
1631 Thu Jul 02 08:53:30 MDT 2015 com/lmco/spacefence/webservices/util/XmlDatetimeAdapter.class
1523 Thu Jul 02 08:53:30 MDT 2015 gov/c2ssa/c2ssadomain/common/docstructure/v2/ConstraintRationaleCollectionType.class
3470 Thu Jul 02 08:53:30 MDT 2015 gov/c2ssa/c2ssadomain/common/docstructure/v2/ConstraintRationaleReferenceEnumType.class
1859 Thu Jul 02 08:53:30 MDT 2015 gov/c2ssa/c2ssadomain/common/docstructure/v2/ConstraintRationaleType.class
6551 Thu Jul 02 08:53:30 MDT 2015 gov/c2ssa/c2ssadomain/common/docstructure/v2/ObjectFactory.class
385 Thu Jul 02 08:53:30 MDT 2015 gov/c2ssa/c2ssadomain/common/docstructure/v2/package-info.class
-
16. Re: XmlJavaTypeAdapter classes ignored in SOAP responses
asoldano Jul 2, 2015 11:09 AM (in response to geturner)Excuse me if I'm basically trying guessing what could be wrong, but it's not that easy without having a reproducer to run.
Did you perhaps try with the deployment being a plain jar or war, that is with the endpoint impl, endpoint interface and generated classes living in the main war you're deploying and not in a jar embedded into a war ?
Asking as you might be suffering from a classloading issue.
-
17. Re: XmlJavaTypeAdapter classes ignored in SOAP responses
geturner Jul 2, 2015 11:49 AM (in response to asoldano)I will change my pom to extract the generated classes jar directly into the classes folder of the WAR. But if that fixes the problem, that is DEFINITELY a BUG!
-
18. Re: XmlJavaTypeAdapter classes ignored in SOAP responses
asoldano Jul 2, 2015 11:52 AM (in response to geturner)For sure, that would definitely be a bug. But the problem here is figuring out what's going wrong, once that's clear we can fix the problem.
-
19. Re: XmlJavaTypeAdapter classes ignored in SOAP responses
geturner Jul 2, 2015 12:12 PM (in response to asoldano)Nope, no change. Is there any CXF debugging level that can be set to maybe "see" what is going on?
-
20. Re: XmlJavaTypeAdapter classes ignored in SOAP responses
geturner Jul 2, 2015 5:52 PM (in response to geturner)I think I have found the problem, but can't seem to find a "fix". I turned on logging for org.apache.cxf and it nicely printed the JAXBDataBinding JAXBContext for each service. But my XmlAdapter classes are not shown. So I added a jaxb.index (with the two class names) to the package directory of the package-info and the two adapter classes, and ensured that Maven copied it to the jar correctly. But still no go. I have tried to find how to use the jaxb.additionalContextClasses property but I only seem to find Spring instructions. I feel I am close, do you have any more pointers?
-
21. Re: XmlJavaTypeAdapter classes ignored in SOAP responses
geturner Jul 2, 2015 6:57 PM (in response to geturner)Well, I added the two adapter classes to the XmlSeeAlso and now they show up in the JAXBContext, but it still does not use them. I will revert the pom to place everything into WEB-INF classes again.
-
22. Re: XmlJavaTypeAdapter classes ignored in SOAP responses
geturner Jul 2, 2015 7:14 PM (in response to geturner)With all of the classes back into the WEB-INF/classes folder, still no go. I am willing to upload this entire project to someone at Apache in the hopes of resolving this problem, but I cannot post this source openly.
-
23. Re: XmlJavaTypeAdapter classes ignored in SOAP responses
asoldano Jul 3, 2015 3:22 AM (in response to geturner)If you ever decide to share the project with someone, even if privately, consider letting me know (alessio.soldano@jboss.com), I would try the project for sure.
-
24. Re: XmlJavaTypeAdapter classes ignored in SOAP responses
geturner Jul 6, 2015 2:56 PM (in response to asoldano)Ok, I have re-produced the problem with a VERY simple war that I produced by cutting out all of the "ugly" from my project. So all JPA and the schemas that I can't provide due to contract restrictions have been removed, and it still failed. Here is the output of my test case:
2015-07-06
2015-07-06T18:50:32Z
Jul 06, 2015 12:50:34 PM org.apache.cxf.services.TestService.TestServicePort.TestServicePortType
INFO: Outbound Message
---------------------------
ID: 1
Address: http://ncserver:8080/NetCentric/TestService
Encoding: UTF-8
Http-Method: POST
Content-Type: text/xml
Headers: {Accept=[*/*], SOAPAction=["http://www.C2SSA.gov/C2SSADomain/SpaceFence/v2/Test/Service/test"]}
Payload: <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><ns3:test xmlns:ns2="http://www.C2SSA.gov/C2SSADomain/SpaceFence/v2/Test" xmlns:ns3="http://www.C2SSA.gov/C2SSADomain/SpaceFence/v2/Test/Operations" testDate="2015-07-06" testDatetime="2015-07-06T18:50:32Z"/></soap:Body></soap:Envelope>
--------------------------------------
Jul 06, 2015 12:50:34 PM org.apache.cxf.services.TestService.TestServicePort.TestServicePortType
INFO: Inbound Message
----------------------------
ID: 1
Response-Code: 200
Encoding: UTF-8
Content-Type: text/xml;charset=UTF-8
Headers: {connection=[keep-alive], content-type=[text/xml;charset=UTF-8], Date=[Mon, 06 Jul 2015 18:50:34 GMT], Server=[WildFly/9], transfer-encoding=[chunked], X-Powered-By=[Undertow/1]}
Payload: <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><ns3:testResponse xmlns:ns2="http://www.C2SSA.gov/C2SSADomain/SpaceFence/v2/Test" xmlns:ns3="http://www.C2SSA.gov/C2SSADomain/SpaceFence/v2/Test/Operations"><ns2:TestType><ns2:responseDate xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema" xsi:type="xs:dateTime">2015-07-06T00:00:00-06:00</ns2:responseDate><ns2:responseDatetime xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema" xsi:type="xs:dateTime">2015-07-06T18:50:32Z</ns2:responseDatetime></ns2:TestType></ns3:testResponse></soap:Body></soap:Envelope>
--------------------------------------
Jul 06, 2015 12:50:33 PM org.apache.cxf.wsdl.service.factory.ReflectionServiceFactoryBean buildServiceFromWSDL
INFO: Creating Service {http://www.C2SSA.gov/C2SSADomain/SpaceFence/v2/Test/Service}TestService from WSDL: jar:file:/C:/SpaceFence/build/common/communication/cp.generated.from.services.jar!/wsdl/TestService.wsdl
2015-07-06
2015-07-06T18:50:32Z
Process finished with exit code 0
Look at the "testDate" attribute. From the client to the server it is fine, but in the response, it is wrong. In fact, both the client logging and the server logging show the values as an xsi:type of datetime.
I will try to upload the project immediately.
-
25. Re: XmlJavaTypeAdapter classes ignored in SOAP responses
geturner Jul 6, 2015 2:57 PM (in response to geturner)Ok, need help, cannot find any kind of attach or upload link on this page
-
26. Re: XmlJavaTypeAdapter classes ignored in SOAP responses
geturner Jul 6, 2015 2:59 PM (in response to geturner)Ok, attached test.zip to the original post
-
27. Re: XmlJavaTypeAdapter classes ignored in SOAP responses
geturner Jul 6, 2015 3:03 PM (in response to geturner)One other thing. The binding for the adapters worked without error on this test case. The source has:
@XmlElement(required = true, type = String.class)
@XmlJavaTypeAdapter(XmlDateAdapter.class)
@XmlSchemaType(name = "date")
protected Date responseDate;
@XmlElement(required = true, type = String.class)
@XmlJavaTypeAdapter(XmlDatetimeAdapter.class)
@XmlSchemaType(name = "dateTime")
protected Calendar responseDatetime;
In the original project, I had to modify the source and remove the "type=String.class" from each XmlElement declaration for the fields using the adapter classes, of I would get an error stating it could not set a field of type String to Calendar (or Date). However, I did NOT modify the source of this test project and had no such problems.
-
28. Re: XmlJavaTypeAdapter classes ignored in SOAP responses
asoldano Jul 6, 2015 3:21 PM (in response to geturner)Thanks for the reproducer, will try it tomorrow.
-
29. Re: XmlJavaTypeAdapter classes ignored in SOAP responses
geturner Jul 6, 2015 3:28 PM (in response to asoldano)The one "gotcha" will be that you will probably need to install the "cp.generated.from.services.jar" into your local Maven repository, as I did not provide the project to build that.