Guys,
I´m writing an app which is a WebService but I´ve been facing a strange issue.
When I call the W.S I receive this error:
Exception Description: The object [2013-08-04T12:00:00:00], of class [class java.lang.String], from mapping [org.eclipse.persistence.oxm.mappings.XMLDirectMapping[dateEvent-->dateEvent/text()]] with descriptor [XMLDescriptor(br.com.gvt.armanagementapp.service.to.ReceivableInvoiceIn --> [DatabaseTable(ns0:receivableInvoiceIn)])], could not be converted to [class java.util.Calendar].
But my Objet ReceivableInvoiceIn there isn´t an attribute with java.util.Calendar there is an atributte java.util.Date
Has anyone faced this issue?
My environment is Weblogic12c with maven
I found the problem. I think is a bug on Weblogic12c1.1 when you perform a simple test with Webblogic ´s WebService Client , it puts a blank spaces into the tag like this:
<code>
<dateEvent>
<!--date time format: yyyy-MM-ddTHH:mm:ss-->
1999-12-24T22:00:00
</dateEvent>
</code>
The solution is split the blank spaces:
<code>
<dateEvent>1999-12-24T22:00:00</dateEvent>
</code>
Related
I'm trying to get Thymeleaf to build me a URL where the domain part is a parameter, some fragment is a literal string, and the query parameters are also parameterized.
The documentation offers some examples:
#{${myDomain}/literalUrl}
#{${myDomain}'/literalUrl'}
#{/literalUrl(query=${queryValue})}
#{'/literalUrl'(query=${queryValue})}
#{${myDomain}(query=${queryValue})}
or even
<a th:with="baseUrl=${myDomain}" th:href="#{${baseUrl}}(query=${queryValue})}">
Separately, all of these work well. But if I try to combine them, the domain part suddenly refuses to resolve:
#{${myDomain}/literalUrl(query=${queryValue})} and #{${myDomain}+'/literalUrl'+(query=${queryValue})} each resolve to ${myDomain}/literalUrl?query=queryValue, and
How do I get Thymeleaf to properly generate my url https://example.com/literalUrl?query=queryValue
Don't know if this is a legit solution for your problem, but if you concat the literalUrl with the first parameter, it will work. Down side: you need an additional model parameter.
<a th:href="#{${linkData+path}(q=${queryParam})}">some link</a>
gets
some link
with model params:
mv.addObject("linkData", "https://example.com");
mv.addObject("path", "/literalUrl");
mv.addObject("queryParam", "queryValue");
I am trying to parse below xml using saxparse in java code but i get SAXParseException. xml looks fine. Not sure why i get this exception. Can anyone help me know what is the problem with my xml. Thanks in advance!
<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:m0="http://schemas.compassplus.com/two/1.0/fimi_types.xsd" xmlns:m1="http://schemas.compassplus.com/two/1.0/fimi.xsd">
<env:Body>
<m1:UserDefinedRp>
<m1:Response Response="1" TranId="7643629" Ver="14.3" Product="XXX"/>
</m1:UserDefinedRp>
</env:Body>
</env:Envelope>
Below is the exception i get:
org.xml.sax.SAXParseException: Element type "env:Envelope" must be followed by either attribute specifications, ">" or "/>".
at org.apache.xerces.framework.XMLParser.reportError(XMLParser.java:1213)
at org.apache.xerces.framework.XMLDocumentScanner.reportFatalXMLError(XMLDocumentScanner.java:579)
at org.apache.xerces.framework.XMLDocumentScanner.abortMarkup(XMLDocumentScanner.java:628)
at org.apache.xerces.framework.XMLDocumentScanner.scanElement(XMLDocumentScanner.java:1800)
at org.apache.xerces.framework.XMLDocumentScanner$ContentDispatcher.dispatch(XMLDocumentScanner.java:949)
at org.apache.xerces.framework.XMLDocumentScanner.parseSome(XMLDocumentScanner.java:381)
at org.apache.xerces.framework.XMLParser.parse(XMLParser.java:1098)
If you think it is correct XML (yes, it looks fine) try to check nonprintable chars, sometimes IDE or other editors add them. Try to check it.
I have a strange problem
this is what I have in routes files
GET /path/list controllers.path.getPaths()
GET /path/:id controllers.path.get(id:Int)
when I try to go <domain>/path/list the following error shows up:
For request 'GET /path/list' [Cannot parse parameter id as Int: For
input string: "list"]
I also tried to change the order in routes file
GET /path/:id controllers.path.get(id:Int)
GET /path/list controllers.path.getPaths()
I still get the same error. so my question is
isn't route supposed to match the first path that matches?
what else could be the problem (e.g. java codes)?
From the code you've provided this should work. The routes are not ambiguous because (from Play documentation):
Many routes can match the same request. If there is a conflict, the first route (in declaration order) is used.
if your routes ordering looks like this:
GET /path/list controllers.path.getPaths()
GET /path/:id controllers.path.get(id:Int)
/path/list will match before attempting to extract/transform the id parameter id:Int from the path and throwing.
If you want Play to transform the incoming parameter into a specific Scala type, you can add an explicit type
The only way this would not work is if you attempted to visit a route that did not match list or was not an Int:
For request 'GET /path/lists' [Cannot parse parameter id as Int: For input string: "lists"]
I wonder do you now any program that can generate for me a Java code from transformation JSON to a XML? In Altova MapForce there is such a possibility, but unfortunately when I want use it, it returns me an Error:
Altova_Hierarchical_JSON.mfd: Mapping validation failed - 1 error(s), 0 warning(s)
Altova_Hierarchical: JSON components are not supported for Java.
The output component Altova_Hierarchical has no output file name set. A default file name will be used.
The second thing, that is important for me, is capabilities to create graphic mapping between JSON and XML like example below shows:
Thanks for the reply.
There is underscore-java library with static method U.xmlToJson(xml). I am the maintainer of the project.
<anyxml>data</anyxml>
Output:
{
"anyxml": "data",
"#omit-xml-declaration": "yes"
}
When marshalling an empty value, the XML generated looks something like:
<some_data>
<required_tag_with_data>Some data</required_tag_with_data>
<required_tag_without_data>
</some_data>
The output I'd like to see, however, is more like this:
<some_data>
<required_tag_with_data>Some data</required_tag_with_data>
<required_tag_without_data />
</some_data>
or this:
<some_data>
<required_tag_with_data>Some data</required_tag_with_data>
<required_tag_without_data></required_tag_without_data>
</some_data>
In the binding I've tried setting usage="required" and nillable="true" but that results in:
<some_data>
<required_tag_with_data>Some data</required_tag_with_data>
<required_tag_without_data xsi:nil="true">
</some_data>
Thanks in advance :)
It turns out that Jibx is not at fault.
I am using a Chrome plugin called Dev HTTP Client (https://plus.google.com/104025798250320128549) to view the output XML.
The plugin, it appears, applies some formatting to the XML but then drops off the closing forward slash in the scenario described above.
When viewing the raw output (in my IDE's debugger) it is as expected.
I have raised a bug report with the developer of DHC.