AXIS2 not generating all classes for WSDL file - web-services

I am new to webservices. I am trying to change the my application webservices from JBOSS(Currently using) to AXIS2. Using JBOSS everything is worked fine but the same WSDL when i gave as input to AXIS2 wsdl2java.bat, it is not creating all the classes and stubs which leads to compile error as the compiler missed many files. Could you please any one tell me that, what could be the reason and solution for the case. My build script mentioned below. I have been doing my R&D since 1 week and didnt find any clue. Hope your answers will lead me to further steps...
<target name="make-server-template">
<!-- Using AXIS2 -->
<echo>Generating and compiling ${service_name}. ${server.def.package}..</echo>
<exec dir="." executable="${wsconsume}">
<arg line=" -o ${server.srcautogen.dir}
-p ${package.name}
-uri ${wsdl.dir}/${wsdl.file}"/>
</exec>
<!-- commented.... Using JBOSS ..Everything is perfect
<exec dir="." executable="${wsconsume}" error="${wsc.logfile}">
<arg line="-s ${server.srcautogen.dir} -o ${serverbuild.dir} -k
-e -p ${package_name} ${wsdl.dir}/${wsdl.file}"/>
</exec> -->
</target>
<target name="make-server-artifacts" depends="clean,prepare">
<antcall target="make-server-template">
<param name="service_name" value="WSDLFILE"/>
<param name="package.name" value="${server.def.package}"/>
</antcall>
Thanks & Regards

Assume that all missing files are related to axis2.
When you generated java files for your web services using axis2, it generates Java classes that related to the WSDL file only. But it refers most of axis2 classes in order to make the communication work with web service.
Therefore, if you want to use those files in your code, you have to include most of axis2 libraries in your project's classpath.
As the first step, include all jar files you can find in axis2/lib folder into your project. It will work.

Related

Is it possible to use multiple Java versions within same build.xml - ANT build. - ANTLR3.3

I am working on a legacy project which needs to be upgraded to use Java8. During the upgrade we are facing issues with ANTL3.3 as it not compatible with Java8.
Now because of certain dependencies we cannot upgrade ANTLR version and ANTLR is used to generate Java files from Grammar(.g) files.
Now, in the ANT - build.xml. I want to divide it in 2 parts.
In which ANTLR target is run wherein the Grammar files being converted to Java files using. During this part I want to use Java1.7.
ANTLR - Garmmar ===Java1.7===> output generated Java files
Once Java files generated with 1.7 it should be compiled with existing Java files using Java8 and then final package should be prepared.
Generated Java files + existing java source code ===Java8===> Compile classes
Presumable you use the java Ant task to generate lexer- and parser classes from your .g grammar file, then you could use the jvm attribute to point to your 1.7 Java binary:
<java
jvm="/path/to/java-1.7/bin/java"
classname="org.antlr.Tool"
fork="true"
failonerror="true"
maxmemory="1024m">
<arg value="T.g" />
<classpath refid="classpath" />
</java>
where <classpath ... points to your ANTLR 3.3 JAR (and other classes you need might need in the classpath):
<?xml version="1.0" encoding="UTF-8"?>
<project>
<path id="classpath">
...
<fileset dir="lib">
<include name="*.jar" />
</fileset>
</path>
...
</project>

ivy report for entire repo?

I'm working on an internal ivy repository with a decent number of projects under it, each with many revisions. I would like to make a dependency report for the entire repository showing which versions of which artifacts depend on which revisions of other artifacts. Obviously it isn't too difficult to make a script to parse the published ivy xml files, but if this functionality exists already I'll use that. Something like the repreport task would be nice, but for a whole repo.
My main goal here is to get a report of artifacts that are not referenced by any other artifacts so as to make a list of candidates for removal from the repo.
So, does ivy have any way to build a dependency report against and entire repository?
Edit: Working through this, it looks like ivy:repreport is the way to go.
Here is my build.xml file:
<project name="Report Build" xmlns:ivy="antlib:org.apache.ivy.ant" basedir=".">
<property name="ivy.version" value="2.2.0"/>
<property name="ivy.home" value="${user.home}/.ivy2"/>
<target name="fetch-ivy" unless="offline" description="Install Ivy if it doesn't already exist">
<mkdir dir="${ivy.home}"/>
<get
src="http://repo2.maven.org/maven2/org/apache/ivy/ivy/${ivy.version}/ivy-${ivy.version}.jar"
dest="${ivy.home}" usetimestamp="true"/>
</target>
<target name="init-ivy" depends="fetch-ivy" unless="ivy-initialized">
<path id="ivy.lib.path">
<fileset dir="${ivy.home}" includes="*.jar"/>
</path>
<taskdef resource="org/apache/ivy/ant/antlib.xml" uri="antlib:org.apache.ivy.ant" classpathref="ivy.lib.path"/>
<property name="ivy-initialized" value="yes"/>
</target>
<target name="report" depends="init-ivy">
<ivy:settings file="ivy-settings-report.xml" id="report.ivy.settings"/>
<ivy:repreport settingsref="report.ivy.settings"/>
</target>
</project>
And here is my ivy settings file:
<?xml version="1.0" encoding="UTF-8"?>
<ivy-settings>
<settings defaultResolver="main"/>
<resolvers>
<chain name="main">
<url name="internalartifacts" m2compatible="false">
<artifact
pattern="http://internalartifacts.local/[organization]/[module]/[revision]/[artifact]-[revision](-[classifier]).[ext]"/>
<ivy pattern="http://internalartifacts.local/[organization]/[module]/[revision]/ivy-[revision].xml"/>
</url>
</chain>
</resolvers>
</ivy-settings>
The documentation for repreport says:
To generate a xml report for all the latest versions of all the
modules in your repository:
<ivy:repreport />
Limitation: this task requires to be able to browse the repository,
and is thus limited to resolvers supporting repository listing. In
particular, it means it doesn't work to report all organizations in a
repository using m2compatible mode. Moreover, to be able to list
organizations, this task requires an [organisation] token in the
resolver(s) used.
So this should totally work.
As mentioned in the comment:
It is important that your repository has ivy.xml files for the artifacts in it. Otherwise ivy cannot recognize the dependencies between the artifacts and your report will be empty.

How to run exe file on CruiseControl

I've been looking through CruiseControl documentation and I found tag and
for running scripts. But when I am trying to run exe-file from that tags it does not work as well as it described in documantation.
I also tried to put call of the exe in batch file and execute it from CruiseControl but also did not work as I expected. So how can I run exe-file from CC? I also need to be able to include output of this file work in my email notification is it possible at all?
E.g. I have file UnitTests.exe which prints something like this:
Unit tests are passed.
47 Tests was successful
How can I do this? Or how can I at least get an returning code from that executable file?
Run the exec in ant.
In cruisecontrol:
<schedule>
<ant anthome="/usr/apache-ant-1.8.2" buildfile="/usr/ant-build-files/my-ant-build-file.build" target="do-task" uselogger="true">
</ant>
</schedule>
In /usr/ant-build-files/my-ant-build-file.build
...
<target name="do-task">
<exec executable="/<path to dir containing exe>/UnitTests.exe" failonerror="true">
<arg line="<args to UnitTests.exe>"/>
</exec>
There is option to execute .bat or .exe files using the following tag.
<exec executable="c:/something.exe" />
You can place the above line in any target of the xml files that your build script is going to call.
<target name="target-to-call-an-exe">
<exec executable="c:/cygwin/bin/bash.exe" />
</target>
Hope this helps, Thanks.

VS 2010 pre-compile web sites with build process?

VS 2010; TFS 2010; ASP.Net 4.0; Web Deployment Projects 2010;
I am using the build process templates in order to do one-click deploys (for dev and QA only). I want my sites to be pre-compiled. I can do it with the command line, using:
C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_compiler
-v /site_name
-p "C:\...\site_name"
-f "C:\...\site_name1"
and this works fine if I copy the files over from site_name1 to site_name...
but is there an option in the IDE for this?? It seems really silly to have to do this from the command line. I've read a lot about different options, but none seem applicable to building with the build definitions.
You can do this by adding the following to your .csproj file
<PropertyGroup>
<PrecompileVirtualPath>/whatever</PrecompileVirtualPath>
<PrecompilePhysicalPath>.</PrecompilePhysicalPath>
<PrecompileTargetPath>..\precompiled</PrecompileTargetPath>
<PrecompileForce>true</PrecompileForce>
<PrecompileUpdateable>false</PrecompileUpdateable>
</PropertyGroup>
<Target Name="PrecompileWeb" DependsOnTargets="Build">
<Message Importance="high" Text="Precompiling to $(PrecompileTargetPath)" />
<GetFullPath path="$(PrecompileTargetPath)">
<Output TaskParameter="fullPath" PropertyName="PrecompileTargetFullPath" />
</GetFullPath>
<Message Importance="high" Text="Precompiling to fullpath: $(PrecompileTargetFullPath)" />
<GetFullPath path="$(PrecompilePhysicalPath)">
<Output TaskParameter="fullPath" PropertyName="PrecompilePhysicalFullPath" />
</GetFullPath>
<Message Importance="high" Text="Precompiling from fullpath: $(PrecompilePhysicalFullPath)" />
<AspNetCompiler PhysicalPath="$(PrecompilePhysicalPath)" VirtualPath="$(PrecompileVirtualPath)" TargetPath="$(PrecompileTargetPath)" Debug="true" Force="$(PrecompileForce)" Updateable="$(PrecompileUpdateable)" FixedNames="true" />
Then in TFS2010's default template
your build definition
Process tab
Advanced parameters section
MSBuild Arguments
set /target="PrecompileWeb"
As it currently stands, I can not find any IDE option to pre-compile websites using the build process templates. I would love to be proved wrong, as using the command line aspnet_compiler requires us (in our setup) to crack open the actual build process template, which we are trying to avoid.
I would love to be proved wrong! :)
We have a website that is stored in TFS2010 as a Web application. I use a MSBuild command to deploy from TFS2010. If you open your project in VS2010 Team Explorer you will see there is a "Builds" option. If you add a build and in the process tab use a build argument like ...:/p:DeployOnBuild=True /p:DeployTarget=MsDeployPublish /p:CreatePackageOnPublish=True /p:MSDeployPublishMethod=RemoteAgent /p:MSDeployServiceUrl=http://111.111.111.111/msdeployagentservice /p:DeployIisAppPath=MySiteNameInIIS /p:UserName=myDomain\BuildUser /p:Password=BuildUserPassword In the Process tab where it says "Items to Build" you just point it to your .sln file (might work with a .cspro but then the syntax changes slightly)
We have a TFS2010 server and I deploy a few of our sites to a dev, qa, pre-production or production IIS server. I do unit testing on the dev build and if the test fail then I do not deploy.
The MSBuild command does the pre-compile, would that work for you?
A setting for precompiling has been added. The following works in Visual Studio 2015
Open a solution
Right click on the project
Select "Publish..."
Go to settings, expand "File
Check "Precompile during Publishing"

How do I create a jetty 6 and jetty 7 compatible jetty-web.xml file in the same war file?

In Jetty 6 I need to create a WEB-INF/jetty-web.xml file which contains this:
<Configure id="webAppCtx" class="org.mortbay.jetty.webapp.WebAppContext">
But in Jetty 7 I need the same exact file WEB-INF/jetty-web.xml to contain this:
<Configure id="webAppCtx" class="org.eclipse.jetty.webapp.WebAppContext">
Both files differ (org.mortbay vs org.eclipse). How do I create 1 war file which is compatible with both jetty 6 and jetty 7?
I don't know if this can be done in one file, but you could use an ANT build script to create two version-specific WARs (my bad if you're already doing this)
Before calling the war build, have ANT copy your Jetty 6 or 7 WEB-INF/jetty-web.xml file in your war basedir and then call something like:
<target name="buildwar">
<buildnumber />
<war basedir="dist/web" destfile="${warName}-jetty${jettyVersion}.war"
webxml="dist/WEB-INF/web.xml">
<webinf dir="dist/WEB-INF/">
<include name="**/*.jar" />
</webinf>
<manifest>
<attribute name="displayName" value="${warDisplayName} for Jetty ${jettyVersion}" />
<attribute name="Implementation-Version" value="${build.number}" />
</manifest>
</war>
</target>
Poor man's solution: build 2 wars for Jetty.
I am thinking about using maven assembly scripts to build multiple wars, However, I need to completely duplicate the jetty-web.xml file for both versions in my sources.