Transforming XSD Import for WSDL in Spring WS - import

I'm tring to extend the example in chapter 5 of the Spring WS guide. I'm using Spring WS 1.5.9 .
I've added ...
<import namespace="http://myco.com/schemas/promotion/v1_2"
schemaLocation="http://localhost:8080/ordersService/Promotion_1_2.xsd" /> ...
But spring doesn't appear to be transforming the location of the import like it does for the port. So on my company website it still shows "localhost:8080"
I have the WSDL generation defined as such
<bean id="orders" class="org.springframework.ws.wsdl.wsdl11.DefaultWsdl11Definition">
<property name="schema" ref="schema" />
<property name="portTypeName" value="Orders" />
<property name="locationUri" value="http://localhost:8080/ordersService/" />
Does/Can Spring Framework transform the imports some way ???
UPDATE: Some more background....
We use the same XSD with the maven JaxB2 plugin to build our response schema objects. That all works great, and we use the Catalog resolver to actually find the addional business domain XSDs in an included JAR file. We have 100's of XSDs that describe our business domain.
SO i'm trying not to break that.
What I would like to see is a more detailed example. An example where JaxB2 is used and XSD -> WSDL functionality.
Should I refactor the XSDs ?
Should I use a WSDL and not an XSD
How do I properly idenitfy the XSDs to spring ?
Do I use "classpath:My_file.xsd" ? Will I have to list possibly 100's of XSDs to schemaCollection ?
The spring Docs are great but I would like a practical example that matches.

I want to add detail on the solution we ended up with. We have been moving to Spring WS 2x. Here's an updated link...
http://static.springsource.org/spring-ws/site/reference/html/server.html#server-automatic-wsdl-exposure
The trick / key was in that section it says... "If you want to use multiple schemas, either by includes or imports, you will want to put Commons XMLSchema"
So that was the final answer to add that to our project.
<dependency>
<groupId>org.apache.ws.commons.schema</groupId>
<artifactId>XmlSchema</artifactId>
<version>1.4.7</version>
</dependency>
Now spring enables additional functionality to allow classpath resolution to work.

Spring-WS can automagically inline all schema elements directly into the WSDL, so that they appear as a single document. This avoids the problem of inaccessible <import> URLs.
See the section of the Spring WS manual which talks about CommonsXsdSchemaCollection.

Related

Can I have two persistence.xml files in my spring maven project

Is it possible for me to have two different persistence.xml files under META-INF eg. persistence-one.xml and persistence-two.xml and then somehow use <property name="persistenceXmlLocation" value="${db.persistence.file.name}"/> in my spring-context.xml to use the appropriate one using property files ?
I am doing this because I have two separate environments with different configurations - providers/dialects etc.
If I do above changes then I get Caused by: java.io.FileNotFoundException: and it's not able to read the appropriate file.
How I can make this work ?
Spring 3, Hibernate 5.3
Whoaa... spring 3 with hibernate 5 is going to be... challenging.
In any case, I'd try using <property name="persistenceProvider" value="org.hibernate.jpa.HibernatePersistenceProvider" /> instead of jpaVendorAdapter.
You might want to take a look at the bean's javadoc to see which other properties might be relevant (alternatively, you can use the persistenceXmlLocation property and load all the properties from either persistence_dev.xml or persistence_prod.xml)

Can camel context be started automatically on EAP

Iam using jboss fuse63 on eap6.4, to make camel context defined with spring DSL run after deploying the camel app as war, I have to use a listener class in web.xml, and use the listener class to start camel context as the following:
ApplicationContext contextCommon = new FileSystemXmlApplicationContext("camel-context-common.xml");
DefaultCamelContext camelContextCommon = (DefaultCamelContext)contextCommon.getBean("_camelContext_common");
try {
camelContextCommon.start();
...
The abstract of my spring DSL is as the following(autoStartup="true" is defined):
<beans ...">
<bean class="test.CommonProcessor" id="commProcessor"/>
<camelContext autoStartup="true" id="_camelContext_common"
shutdownRunningTask="CompleteAllTasks" xmlns="http://camel.apache.org/schema/spring">
Is there a way to make camel context run automatically on eap without using java code to start it?
Best regards
Yes, there is easy way. You have to correctly name your Spring XML file which contains Camel route. The file naming convention requires to include the -camel-context.xml suffix.
In your case, rename camel-context-common.xml file to common-camel-context.xml. If you do that then Camel subsystem will automatically start up camel contexts.
Yes, there is a great way to do this. Use the Wildfly-Camel subsystem and the very handy quickstarts for examples.
If you are using productised versions, you can use Fuse/EAP for this.
Good Luck,
Rick

Getting error "Missing elastic.cluster and elastic.host...." while running indexer job in nutch in eclipse

I have configured apache nutch 1.13 with solr 5.5.0 and hbase 0.90.6 in eclipse. Now, I am able to run the jobs from injector to invertlinks, but while running indexing job it throws error "Missing elastic.cluster and elastic.host....". I have set indexer-solr under plugin.includes in nutch-site.xml file. But still getting these error. Can anybody help me why this is happening?
The problem is with the nutch-site.xml. If you see there are two nutch-site.xml; one is under the conf folder and other is in src/test folder. We generally configure nutch-site.xml file under conf folder but when we import it in eclipse, it considers that file under src/test folder. So the way to fix this error is to configure your setting under src/test folder. Generally that file contains very basic config, you need to replace
<property>
<name>plugin.includes</name>
<value>.*</value>
<description>Enable all plugins during unit testing.</description>
</property>
with below lines
<property>
<name>plugin.includes</name>
<value>protocol-http|urlfilter-regex|parse-(html|tika)|index-(basic|anchor)|indexer-solr|scoring-opic|urlnormalizer-(pass|regex|basic)</value>
<description>Regular expression naming plugin directory names to
include. Any plugin not matching this expression is excluded.
In any case you need at least include the nutch-extensionpoints plugin. By
default Nutch includes crawling just HTML and plain text via HTTP,
and basic indexing and search plugins. In order to use HTTPS please enable
protocol-httpclient, but be aware of possible intermittent problems with the
underlying commons-httpclient library. Set parsefilter-naivebayes for classification based focused crawler.
</description>
</property>
So if you want to use solr then use indexer-solr, elastic then indexer-elastic and so on.
Hope this help others.

How to remove auto generated classes in jax-ws clients

I have a web service which I created with jax-ws in NetBeans. When I create the soap client from the wsdl file, Netbeans generates the mapping classes used for serialisation.
My problem is that I don't want them. I wrote them myself and they are used in other parts of the application. I tried everything to use my classes instead of the auto generated to send the SOAP message but with no success.
The cumbersome solution would be to copy the data from one class to the other and then send the message, but my class has about twenty subclasses so I would like very much to skip this.
Use the JAXB episode option which basically allows you to instruct JAXB to reuse classes in a package. You specify the desired packages in an episode file. "episode" is just a fancy name for a jaxb binding file and it's not very different from your regular jaxb config file. Your episode file would look something like this (bindings file excerpt courtesty of Blaise Doughan's blog)
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<bindings version="2.1" xmlns="http://java.sun.com/xml/ns/jaxb">
<bindings scd="x-schema::tns"
xmlns:tns="http://www.example.org/Product">
<schemaBindings map="false"/>
<bindings scd="tns:product">
<class ref="com.you.yourclass"/>
</bindings>
</bindings>
</bindings>
Save the file as a .episode file and configure in your Netbeans project like so. I assume here that you've run the Create Webservice from WSDL wizard in Netbeans
Right click on Webservice node within your project. Navigate to the WSimport options tab
Under the Jaxb(xjc) options frame, add the following
(where myepisodefile.episode refers to the episode file you created earlier. Make sure the file is available within your project)

Eclipse Spring Builder set properties with Groovy beans

I typically use groovy to construct simple bean but the Spring IDE plugin to eclipse fails to build when I try to set a property that is generated by groovy without an explicit setter. For example,
class MyGrooyClass {
def propertyA
}
and in the spring configuration file I have something that looks like:
<bean id="MyGroovyClassBean" class="MyGroovyClass">
<property name="propertyA" value="someValue"/>
</bean>
The spring builder says there is no such property but it is in the bytecode since it is automatically generated by groovy. If I don't validate that bean, everything works, so spring can resolve the property, but it seems to be an issue with the plugin. Is there a way to work around this or to disable validating a particular bean?
EDIT: I can construct the bean using the groovy specific syntax
<lang:groovy id="..." script-source="...">
<lang:property name="propertyA" value="someValue"/>
</lang>
but it seems odd that I should need to do this just for the plugin.
Thanks,
Jeff
It definitely looks like a bug in the Spring IDE plugin. I've also had issues where the content assist does not show auto-complete for properties of a Groovy bean.
I see the same issue in the project I am working on. Consequently I do not use the Spring Validator.
As confirmed by Chris Dail, this is a bug in the Spring IDE plugin. I posted it in the Spring forums http://forum.springsource.org/showthread.php?p=271607&posted=1#post271607 and it has been fixed in the nightly build.