This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<build> | |
<plugins> | |
<plugin> | |
<groupId>org.apache.maven.plugins</groupId> | |
<artifactId>maven-jar-plugin</artifactId> | |
<executions> | |
<execution> | |
<phase>package</phase> | |
<goals> | |
<goal>jar</goal> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@javax.xml.bind.annotation.XmlSchema( | |
namespace = "http://ws.cdyne.com/WeatherWS/", | |
elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED | |
package com.cdyne.ws.weatherws; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@javax.xml.bind.annotation.XmlSchema( | |
namespace = "http://ws.cdyne.com/WeatherWS/", | |
elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED, | |
xmlns = { | |
@javax.xml.bind.annotation.XmlNs(namespaceURI = "http://ws.cdyne.com/WeatherWS/", prefix = "weather") | |
}) | |
package com.cdyne.ws.weatherws; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Bean | |
public JAXBDataBinding jaxbDataBinding() { | |
JAXBDataBinding jaxbDataBinding = new JAXBDataBinding(); | |
Map<String,String> namespaceMap = new HashMap<String, String>(); | |
namespaceMap.put("http://ws.cdyne.com/WeatherWS/", "weather"); | |
jaxbDataBinding.setNamespaceMap(namespaceMap); | |
return jaxbDataBinding; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<configuration> | |
<!-- See https://jax-ws-commons.java.net/jaxws-maven-plugin/wsimport-mojo.html --> | |
<wsdlUrls> | |
<wsdlUrl>src/main/resources/Weather1.0.wsdl</wsdlUrl> | |
</wsdlUrls> | |
<sourceDestDir>target/generated-sources/wsdlimport/Weather1.0</sourceDestDir> | |
<!-- For accessing the imported schema, see https://netbeans.org/bugzilla/show_bug.cgi?id=241570 --> | |
<vmArgs> | |
<vmArg>-Djavax.xml.accessExternalSchema=all</vmArg> | |
</vmArgs> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- the binding.xml in the given directory is found automatically, because the directory is scanned for '.xml'-Files --> | |
<bindingDirectory>src/main/resources</bindingDirectory> | |
<!-- Arguments for JAXB2-Generator behind JAX-WS-Frontend --> | |
<args> | |
<arg>-extension</arg> | |
<!-- Thats a tricky parameter: The first '-B' is for passing the following argument to JAXB2-Generator | |
the second is needed to generate the human readable Namespace-Prefixes --> | |
<arg>-B-Xnamespace-prefix</arg> | |
</args> | |
</configuration> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0"?> | |
<jxb:bindings version="1.0" | |
xmlns:jxb="http://java.sun.com/xml/ns/jaxb" | |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xmlns:namespace="http://jaxb2-commons.dev.java.net/namespace-prefix" | |
xsi:schemaLocation="http://java.sun.com/xml/ns/jaxb http://java.sun.com/xml/ns/jaxb/bindingschema_2_0.xsd | |
http://jaxb2-commons.dev.java.net/namespace-prefix http://java.net/projects/jaxb2-commons/sources/svn/content/namespace-prefix/trunk/src/main/resources/prefix-namespace-schema.xsd"> | |
<jxb:bindings schemaLocation="Weather1.0.xsd"> | |
<jxb:schemaBindings> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
String requestFolder = "requests/"; | |
String file; | |
URI filepathUrl = this.getClass().getClassLoader().getResource(requestFolder + fileName).toURI(); | |
Path filepath = Paths.get(filepathUrl); | |
file = Files.lines(filepath).collect(Collectors.joining()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void printXML2Console(Node documentOrDocumentFragment) | |
throws TransformerFactoryConfigurationError, | |
TransformerConfigurationException, | |
TransformerException { | |
DOMSource domSource = new DOMSource(documentOrDocumentFragment); | |
StringWriter writer = new StringWriter(); | |
StreamResult result = new StreamResult(writer); | |
TransformerFactory tf = TransformerFactory.newInstance(); | |
Transformer transformer = tf.newTransformer(); | |
transformer.transform(domSource, result); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Document you want 2 append | |
Document document = ...; | |
// Create the Document | |
DocumentBuilderFactory docBuilderfactory = DocumentBuilderFactory.newInstance(); | |
DocumentBuilder docBuilder = docBuilderfactory.newDocumentBuilder(); | |
Document document2Append2 = docBuilder.newDocument(); | |
// Copy the Document as ChildElement under a new Element | |
Element rootElement = document2Append2.createElement("root"); |
OlderNewer