Is there any tool for generating Java code from WSDL using XML Catalogs? The problem is that I have wsdl files that import XML schemas which also import other schemas and the schemas are not available at schemaLocation url. That is why code generation fails. If a tool was able to use XML Catalog this problem would be solved without modifying each schemaLocation in each WSDLs and schemas.
I have tried Eclipse and Netbeans plugins but both failed. In Eclipse and Netbeans I have configured alternative schema locations by using XML Catalog and so they can validate WSDL files without error. However, when they generate code from wsdl they fail.
Just found that JBoss's wsconsume tool is able to consume XML Catalogs for entity resolution and it works fine.
http://community.jboss.org/wiki/JBossWS-wsconsume
Just for the record: i've set up a small exemple project on Github that uses an XML schema. it may be of any help: https://github.com/fmarot/xml-mapping-tutorial
Be sure to check its wiki too in order to have an overview: https://github.com/fmarot/xml-mapping-tutorial/wiki
The WSDL has to be valid without the use of XML catalogs, or clients consuming that WSDL will not be able to consume it.
Of course, if you will never use any clients not running on the JBoss platform, then you'll be fine.
Meanwhile, I found an other solution that fits the best to my needs. There is a maven plugin called jaxws-maven-plugin that is also able to handle XMLCatalogs when generating sources from wsdl.
https://jax-ws-commons.dev.java.net/jaxws-maven-plugin/
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>jaxws-maven-plugin</artifactId>
<version>1.10</version>
<executions>
<execution>
<id>id1</id>
<phase>generate-sources</phase>
<goals>
<goal>wsimport</goal>
</goals>
<configuration>
<verbose>true</verbose>
<keep>true</keep>
<catalog>${basedir}/src/main/resources/catalog.xml</catalog>
<packageName>org.example</packageName>
<wsdlDirectory>
${basedir}/src/main/resources/contracts/wsdl/ExampleService/1
</wsdlDirectory>
<wsdlFiles>
<wsdlFile>ExampleService_1_0.wsdl</wsdlFile>
</wsdlFiles>
<xadditionalHeaders>false</xadditionalHeaders>
</configuration>
</execution>
</executions>
<configuration>
</configuration>
<dependencies>
<dependency>
<groupId>com.sun.xml.ws</groupId>
<artifactId>jaxws-tools</artifactId>
<version>2.1.7</version>
</dependency>
</dependencies>
Related
At work we use the Spring (or rather Google) ehcache manager. Oddly, I'm getting an error in Spring STS that my coworkers, also using Spring STS and using the exact same code, do not get. The following line in my pom.xml file is marked as an error (or a "problem" according to Spring STS).
<ehcache:annotation-driven cache-manager="ehCacheManager" />
The reason given is this:
The matching wildcard is strict, but no declaration can be found for element 'ehcache:annotation-driven'.
In case it might be helpful, here are the schema declarations at the top of my pom.xml file.
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:beans="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:ehcache="http://ehcache-spring-annotations.googlecode.com/svn/schema/ehcache-spring"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:util="http://www.springframework.org/schema/util"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-3.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.5.xsd
http://www.springframework.org/schema/cache http://www.springframework.org/schema/cache/spring-cache.xsd
http://ehcache-spring-annotations.googlecode.com/svn/schema/ehcache-spring http://ehcache-spring-annotations.googlecode.com/svn/schema/ehcache-spring/ehcache-spring-1.1.xsd">
Both Spring STS and my specific project/workspace are using Java 8 as a compiler and runtime environment. So I don't think that's an issue. I also did a project refresh, a Maven update, and a mvn clean install.
I did some research and looked at this question as well as this one. The conclusion seems to be that one of my schemas is no longer hosted and so it cannot figure out what <ehcache:annotation-driven cache-manager="ehCacheManager"/> means. It seems that the http://ehcache-spring-annotations.googlecode.com/svn/schema/ehcache-spring/ehcache-spring-1.1.xsd schema is missing, which can be confirmed if you simply try to visit the URL.
The comments on this question suggest that I avoid the Google ehcache and use the Spring one instead. How should I go about this? Ideally I would like to avoid changing the schemas that we use, since after all it works for my co-workers. But maybe that's because they were able to pull from the Google ehcache schema while it was still being hosted. Is it really necessary to change from the Google schema to the Spring schema, and if so how should I implement this in my POM file?
Try this
<cache:annotation-driven cache-manager="ehCacheManager" />
We want to split our swagger specifications into two files. One containing the endpoints and one containing the type definitions because the type definitions are used in multiple projects and we want to avoid fixing something in multiple source locations.
We are using the maven codegen plugin to generate the model and the api and it works fine with the splitting.
However the request validation does not because it is not able to follow the external references to the type definitions it seems.
We are using swagger-request-validator-springmvc for the request validation. Unfortunately only one resource is allowed and it does not expand/merge the multiple specifications into one as swagger-codegen does.
When running the swagger-codegen in verbose mode a "merged" swagger specification is shown in the log. Is there a way to get codegen to export this merged specification?
Or is there another way to get the request validation going with multiple specification files?
When running the swagger-codegen in verbose mode a "merged" swagger specification is shown in the log. Is there a way to get codegen to export this merged specification?
If I am understanding this correctly, you want the whole swagger specification when using the maven plugin. This is usually generated in the output folder specified in the plugin configuration.
<plugin>
<groupId>io.swagger</groupId>
<artifactId>swagger-codegen-maven-plugin</artifactId>
<version>${swagger.codegen.maven.plugin.version}</version>
<executions>
<execution>
<phase>generate-sources</phase>
<goals>
<goal>generate</goal>
</goals>
<configuration>
...
<output>${project.build.directory}/generated-sources/swagger</output>
...
</configuration>
</execution>
</executions>
</plugin>
I cannot understand your second question however - can you please elaborate?
Or is there another way to get the request validation going with multiple specification files?
This feels like a really basic, stupid question.
I've got a graph in Neo4j 2.1.5. It's a toy graph, so it was created with the defaults.
I built the Neo4j2 version of Blueprints, as instructed. I can get Rexster to start with this configuration:
<graph>
<graph-name>graph.db</graph-name>
<graph-type>com.tinkerpop.blueprints.impls.neo4j2.rexster.Neo4j2GraphConfiguration</graph-type>
<graph-location>/usr/local/Cellar/neo4j/2.1.5/libexec/data</graph-location>
<properties>
...
</properties>
<extensions>
<allows>
<allow>tp:gremlin</allow>
</allows>
</extensions>
</graph>
When I open the Rexster web interface, it says the graph is there, but when I try to browse it, no dice. I have no trouble browsing my graph from the Neo4j web interface. What am I missing?
I have an ear project with war and ejb. Using omnifaces, I normally set the error message in the war project. But on one project I'm using picketlink for authentication, and unfortunately I need to move my #Picketlink annotated class inside the ejb, otherwise it won't work.
Then my authentication classes are also in the ejb project, then the problem when the user enter a wrong credential I need to show a localized error. How do I do that in the ejb project?
Or is there a way to make picketlink work moving the authentication classes back to the war project.
Sample codes:
Authentication class:
#PicketLink
public class PicketlinkAuthenticator extends BaseAuthenticator { }
JBoss deployment file
<?xml version='1.0' encoding='UTF-8'?>
<jboss-deployment-structure>
<ear-subdeployments-isolated>true</ear-subdeployments-isolated>
<sub-deployment name="my-project-web.war">
<dependencies>
<module name="org.picketlink" />
</dependencies>
</sub-deployment>
</jboss-deployment-structure>
Thanks
I've found 2 solutions with my problem:
1.) Move the authentication classes (picketlink) to the web layer, so that the message can be set and localized.
2.) Implement a JPA IDMConfiguration in the ejb layer. And an authentication class in the web layer.
Refer to this project from github: picketlink-authorization-idm-jpa. In this way we've created a picketlink resource that we will use in web layer authentication.
I am trying to follow this tutorial to create DropWizard views. However, when I try to addBundle(new ViewBundle()), it fails to find (or import) ViewBundle. What am I missing here?
The dependency dropwizard-views was missing in my maven pom file. Adding the dependency solved the issue.
<dependency>
<groupId>io.dropwizard</groupId>
<artifactId>dropwizard-views</artifactId>
<version>${dropwizard.version}</version>
</dependency>
You will need to choose one of the view template. As of writing, Dropwizard supports FreeMarker and Mustache. Instead of including dropwizard-view dependency, you should choose either dropwizard-views-mustache or dropwizard-views-freemarker, and dropwizard-view will be included as dependency.