I'm trying this:
<target name="generate" depends="clean,init">
<mkdir dir="${source.dir}/generated"/>
<java classname="org.apache.cxf.tools.wsdlto.WSDLToJava" fork="true">
<sysproperty key="http.proxyHost" value="proxy.example.com"/>
<sysproperty key="http.proxyPort" value="8080"/>
<sysproperty key="http.proxyUser" value="secretUser"/>
<sysproperty key="http.proxyPassword" value="complexPass"/>
<arg value="-d"/>
<arg value="${source.dir}/generate"/>
<arg value="-client"/>
<arg value="http://example.com/WS?wsdl"/>
<classpath refid="project.classpath"/>
</java>
</target>
And when I execute the target I get 407 error, auth required
Problem parsing 'http://example.com/WS?wsdl'.: java.io.IOException: Server returned HTTP response code: 407 for URL: http://example.com/WS?wsdl
I get same error if I set https proxy, and when I don't set proxy I get:
Problem parsing 'http://example.com/WS?wsdl'.: java.net.ConnectException: Connection refused
I also try using a incorrect password to verify if as expected 401 error returned, but 407 was returned.
There is no service at http://example.com/WS?wsdl. That's just an example web address. You need to enter a real web service URI pointing at a valid WSDL for that service. E.g.
http://ws.cdyne.com/emailverify/Emailvernotestemail.asmx?WSDL
Related
I am using the following ant sql task and its throwing "No suitable Driver exception" java.sql.SQLException: No suitable Driver for
at org.apache.tools.ant.taskdefs.JDBCTask.getConnection(JDBCTask.java:370)
at org.apache.tools.ant.taskdefs.SQLExec.getConnection(SQLExec.java:961)
at org.apache.tools.ant.taskdefs.SQLExec.execute(SQLExec.java:628)
I have verified that the ojdbc6 jar is present in the location and echoing classpath also includes the location of jar.
<property name="jdbc.driver.jar" value="${wl.home}/server/lib/ojdbc6.jar"/>
<property name="jdbc.driver" value="oracle.jdbc.OracleDriver"/>
<sql driver="${jdbc.driver}"
url="${datasource_url}"
userid="${datasource_user}"
password="${datasource_password}"
src="${sqlfile}"
output="${outfile}"
print="true"
onerror="abort"
expandProperties="true">
<classpath>
<pathelement location="${jdbc.driver.jar}"/>
</classpath>
</sql>
I would like to have ANT script (not Maven) to generate Stub from wsdl url.I know how to do that if the file wsdl stays in my local (c drive), but not able to do that when wsdl stays remotely.
Please help.
Have you tried this?
<target name="cxfWSDLToJava">
<java classname="org.apache.cxf.tools.wsdlto.WSDLToJava" fork="true">
<arg value="-client"/>
<arg value="-d"/>
<arg value="src"/>
<arg value="http://somehost.com/service?wsdl"/>
<classpath>
<path refid="cxf.classpath"/>
</classpath>
</java>
</target>
I have an Ant script which is used to deploy my application on two different machines at a time. With the local machine i do not have a problem, but when it comes to the remote machine, I want to check if Jboss is up or not. If it is up then I want to shut it down but if it is not then nothing should be done. I tried to do this by keeping the attribute of <sshexec> as failonerror="on". This works well when the Jboss is already down and the shutdown command only gives some errors. But the real problem that i faced was when Jboss was running and when the shutdown command was executed, it did not shutdown properly and gave some error. It is in these situations that I want to stop my build script and let the user know that there is something wrong with Jboss on the other machine and it needs to be looked at.
The target code for stopping the remote Jboss is
<target name="stopRemoteJboss" description="Stops Remote Instance of Jboss">
<echo message="Stopping Remote Jboss" />
<sshexec trust="true" host="${jboss.remote.host}" username="${jboss.remote.username}" password="${jboss.remote.password}" command="${jboss.remote.home}/bin/shutdown.sh -S" port="${jboss.remote.port}"/>
</target>
After a short check, I've found following, maybe you could reuse/or use as an inspiration for your script: http://shrubbery.homeip.net/c/display/W/Starting+JBoss+with+ANT
The relevant part for you seem to be:
<java jvm="#{jdkHome}/bin/java"
classname="org.jboss.Shutdown" fork="true" failonerror="false" resultproperty="shutdown.rc">
<arg line="-s jnp://#{bindAddr}:#{jnpPort}"/>
<classpath>
<pathelement path="#{jbossInstallDir}/bin/shutdown.jar"/>
<pathelement path="#{jbossInstallDir}/client/jbossall-client.jar"/>
</classpath>
</java>
<echo>Shutdown rc = ${shutdown.rc}</echo>
<condition property="shutdown.okay">
<equals arg1="${shutdown.rc}" arg2="0"/>
</condition>
<fail unless="shutdown.okay" message="Unable to shut down JBoss (maybe it hasn't fully started yet?)."/>
<echo>Waiting for #{bindAddr}:#{jnpPort} to stop listening...</echo>
Why not check to see if the remote port is active?
<project name="demo" default="check">
<condition property="server.running" value="running" else="not running">
<socket server="remoteserver" port="80"/>
</condition>
<target name="check" description="Print status message">
<echo message="Web server status: ${server.running}"/>
</target>
</project>
If your JBoss instance is configured as a reverse proxy you could use the alternative http condition to check the HTTP response code (which would be 503 "Service unavailable", if the appserver is down)
We are trying to create a symbolic link in our fitnesse suite to an external folder. It is working perfectly with URL. But not working with command line or with ant script.
Following is the URL (Working):
http://localhost:8080/root?responder=symlink&linkName=FitNesseSuite&linkPath=file://FitNesseRoot/TestSuite
Command line (Not working):
java -jar fitnesse.jar -c "root?responder=symlink&linkName=FitNesseSuite&linkPath=file://FitNesseRoot/TestSuite"
Ant script (Not working):
<target name="my_fitnesse_tests">
<java jar="fitnesse.jar" failonerror="true" fork="true">
<arg value="-c" />
<arg value="root?responder=symlink&linkName=FitNesseSuite&linkPath=file://FitNesseRoot/TestSuite" />
<arg value="-p" />
<arg value="9234" />
</java>
</target>
Getting following exception:
Exception in thread "main" java.lang.IllegalArgumentException: Command
specification
[root?responder=symlink&linkName=FitNesseSuite&linkPath=file://FitNesseRoot/TestSuite]
invalid. Format shold be /cmd or user:pass:/cmd at
fitnesse.http.MockRequestBuilder.validate(MockRequestBuilder.java:48)
Please help us to solve this.
Same problem, I have solve the problem with the following command:
...&linkPath=file%3A///... ==> change the ":" by "%3A"
I am using:
<exec executable="cmd">
<arg line="${argLine}" />
</exec>
when argLine
<property name="argLine" value="http://127.0.0.1:/product/findSameStyleSku.json?skuId=305&style=120662"/>
with 2 params ,and i use & escape & symbols
but only open http://127.0.0.1/product/findSameStyleSku.json?skuId=305
the style param lost
In short,i want run
<target name="111test">
<exec executable="cmd" output="e:/test.txt">
<arg line="/c start '' 'http://127.0.0.1/product/findSameStyleSku.json?skuId=305&%3bstyle=120662'" />
</exec>
</target>
2012-05-23 update
Yes,Windows system
I change code to
<target name="111test">
<exec executable="cmd" output="e:/test.txt">
<arg value="/c" />
<arg value="start" />
<arg value="" />
<arg value="http://127.0.0.1/product/findSameStyleSku.json?skuId=305&%3bstyle=120662" />
</exec>
</target>
run ant
only open
http://127.0.0.1/product/findSameStyleSku.json?skuId=305
I change "&%3b" to "&"
also only open
http://127.0.0.1/product/findSameStyleSku.json?skuId=305
But in cmd, i use
start "" "http://127.0.0.1/product/findSameStyleSku.json?skuId=305&style=120662"
can open http://127.0.0.1/product/findSameStyleSku.json?skuId=305&style=120662
Not exactly understanding what it's trying to open. Is it literally trying to open a URL with ***?skuId=305, or are you trying to say it's trying to open the URL you gave it up to, but not including the semicolon?
If you are saying that it is leaving off the last part of your URL, you should understand that semicolons cannot be part of the actual URL you're sending. They're reserved and must be specially encoded.
Make sure that semicolon is even suppose to be there. When you do a GET request, you have the basic URL, and then after that URL a question mark. After that, you have a series of parameters you're passing to the URL with each parameter separated by ampersands. In your case, it looks like you want to send a request to URL:
http://127.0.0.1:/product/findSameStyleSku.json
With the following two parameters:
skuId = 305
style = 120662
So, it looks like the semicolon is bogus. Otherwise, you're passing the parameter ;style and not style. And, that doesn't seem it would be correct.
If you've determined that the semicolon is really suppose to be there, try replacing the semicolon in the URL with %3b:
<property name="argLine" value="http://127.0.0.1:/product/findSameStyleSku.json?skuId=305&%3bstyle=120662"/>
Response
,i'm sorry ,it does't Work correctly,I updated my question – feeling
Unfortunately, since this is on a Windows machine, and is something running locally on your machine, I can't run a test myself.
However, according to the first part of your post, you are attempting to run the following command:
C> cmd http://127.0.0.1:/product/findSameStyleSku.json?skuId=305&style=120662
Later in your post, you say you want to run:
C> cmd /c start '' 'http://127.0.0.1/product/findSameStyleSku.json?skuId=305&%3bstyle=120662'
The first certainly won't work from the command line. Does the second one?
I've done a few tests on my current computer using this:
<property name="argLine"
value="http://etzahaim.org/index.php?option=com_content&task=blogcategory&id=15&Itemid=34"/>
<exec executable="curl">
<arg value="${argLine}"/>
<arg value="--include"/>
<arg value="--output"/>
<arg value="curl.out"/>
</exec>
This is the curl command which fetches the URL. This URL is also uses a GET method, so it also has a question mark and some asterisks in the URL. This works for me.
Try switching from <arg line='start' '' 'http://...> to using <arg line> and see if that helps:
<target name="111test">
<exec executable="cmd" output="e:/test.txt">
<arg value="/c"/>
<arg value="start"/>
<arg value=""/>
<arg value="${argline}" />
</exec>