Share your knowledge
Tuesday, May 10, 2016
A new blog is born
Thursday, May 7, 2015
Switching between maven settings.xml
Often you have to copy the maven settings.xml file which is configured for a specific customer. But while developing in my spare time I just want to use my own settings.xml file. The easiest way to switch to using a different file is shown below:
mvn -gs $M2_HOME/conf/settings_pelssers.xml clean install
Thursday, April 9, 2015
Using ssh tunnel with port forwarding
Connectivity has been setup from our staging environment to the third party server (endpoint of our soap clients). However, I wanted to connect locally with SOAP UI to this server, so I needed to setup an ssh tunnel with portforwarding on my macbook. I used to do this with putty on windows in the past so it took me a bit longer to figure this out.
Let's say the endpoint used from our staging environment would be "http://3rdpartyhostname/coolservice". In this case I want to listen on port 8877, and forward traffic from this port using the ssh tunnel to 3rdpartyhostname on port 80
ssh -f username@staginghostname -L 8877:3rdpartyhostname:80 -N
Now I can connect in SOAPUI to the following endpoint "http://localhost:8877/coolservice"
Thursday, March 26, 2015
Fixing collisions ObjectFactory while executing wsdl2java
Often you have to deal with WSDL's from third parties. Sometimes the WSDL including referenced schemas are setup crappy and you run into issues while converting the WSDL to Java. Below we will look into how to fix these issues.
Eclipse will complain with following message
[ERROR] file:/playground/objectfactory/src/main/resources/xsd/helloworld.xsd [32,3]:
(Relevant to above error) another "ReasonType" is generated from here.
[ERROR] file:/playground/objectfactory/src/main/resources/xsd/helloworld.xsd [32,3]:
Two declarations cause a collision in the ObjectFactory class.
[ERROR] file:/playground/objectfactory/src/main/resources/xsd/helloworld.xsd [26,3]:
(Related to above error) This is the other declaration.
[ERROR] file:/playground/objectfactory/src/main/resources/xsd/helloworld.xsd [9,3]:
Two declarations cause a collision in the ObjectFactory class.
[ERROR] file:/playground/objectfactory/src/main/resources/xsd/helloworld.xsd [10,3]:
(Related to above error) This is the other declaration.
[ERROR] file:/playground/objectfactory/src/main/resources/xsd/helloworld.xsd [15,7]:
Two declarations cause a collision in the ObjectFactory class.
[ERROR] file:/playground/objectfactory/src/main/resources/xsd/helloworld.xsd [14,7]:
(Related to above error) This is the other declaration. A class/interface with the same
name "com.pelssers.helloworld.wrapper.ReasonType" is already in use.
Use a class customization to resolve this conflict.
Below a version that fixes all issues. Ps. Sometimes it might also be useful to add @underscoreBinding="asCharInWord" to the globalBindings.