Hello,
I am trying to generate the wsdl interface description using the Ant
java2wsdl build task. I have attached the build.xml file and the actual
class to this mail. When I run the Ant Task, I get the following error.
I have tried with different java classes, always with the same result.
When I rename the java file to jws and place it in the Axis webapps
directory, it generates the wsdl just fine! Any ideas?
[java2wsdl] - Unable to find required classes
(javax.activation.DataHandler and
javax.mail.internet.MimeMultipart). Attachment support is disabled.
[java2wsdl] Java2WSDL LoanBrokerWS
[java2wsdl] [Fatal Error] :2:51: The value of the attribute
"prefix="xmlns",loca
lpart="impl",rawname="xmlns:impl"" is invalid. Prefixed namespace
bindings may n
ot be empty.
[java2wsdl] WSDLException: faultCode=PARSER_ERROR: Problem parsing '-
WSDL Docum
ent -'.: The value of the attribute
"prefix="xmlns",localpart="impl",rawname="xm
lns:impl"" is invalid. Prefixed namespace bindings may not be empty.:
org.xml.sa
x.SAXParseException: The value of the attribute
"prefix="xmlns",localpart="impl"
,rawname="xmlns:impl"" is invalid. Prefixed namespace bindings may not
be empty.
[java2wsdl] at org.apache.xerces.parsers.DOMParser.parse(Unknown
Source)
[java2wsdl] at
org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Sour
ce)
[java2wsdl] at com.ibm.wsdl.xml.WSDLWriterImpl.getDocument(Unknown
Source)
[java2wsdl] at com.ibm.wsdl.xml.WSDLWriterImpl.getDocument(Unknown
Source)
[java2wsdl] at
org.apache.axis.wsdl.fromJava.Emitter.emit(Emitter.java:340)
[java2wsdl] at
org.apache.axis.wsdl.fromJava.Emitter.emit(Emitter.java:430)
[java2wsdl] at
org.apache.axis.tools.ant.wsdl.Java2WsdlAntTask.execute(Java2
WsdlAntTask.java:243)
[java2wsdl] at
org.apache.tools.ant.UnknownElement.execute(UnknownElement.ja
va:275)
[java2wsdl] at org.apache.tools.ant.Task.perform(Task.java:364)
[java2wsdl] at org.apache.tools.ant.Target.execute(Target.java:341)
[java2wsdl] at
org.apache.tools.ant.Target.performTasks(Target.java:369)
[java2wsdl] at
org.apache.tools.ant.Project.executeSortedTargets(Project.jav
a:1216)
[java2wsdl] at
org.apache.tools.ant.Project.executeTarget(Project.java:1185)
[java2wsdl] at
org.apache.tools.ant.helper.DefaultExecutor.executeTargets(De
faultExecutor.java:40)
[java2wsdl] at
org.apache.tools.ant.Project.executeTargets(Project.java:1068
)
[java2wsdl] at org.apache.tools.ant.Main.runBuild(Main.java:668)
[java2wsdl] at org.apache.tools.ant.Main.startAnt(Main.java:187)
[java2wsdl] at
org.apache.tools.ant.launch.Launcher.run(Launcher.java:246)
[java2wsdl] at
org.apache.tools.ant.launch.Launcher.main(Launcher.java:67)
[java2wsdl]
[java2wsdl] at com.ibm.wsdl.xml.WSDLWriterImpl.getDocument(Unknown
Source)
[java2wsdl] at com.ibm.wsdl.xml.WSDLWriterImpl.getDocument(Unknown
Source)
[java2wsdl] at
org.apache.axis.wsdl.fromJava.Emitter.emit(Emitter.java:340)
[java2wsdl] at
org.apache.axis.wsdl.fromJava.Emitter.emit(Emitter.java:430)
[java2wsdl] at
org.apache.axis.tools.ant.wsdl.Java2WsdlAntTask.execute(Java2
WsdlAntTask.java:243)
[java2wsdl] at
org.apache.tools.ant.UnknownElement.execute(UnknownElement.ja
va:275)
[java2wsdl] at org.apache.tools.ant.Task.perform(Task.java:364)
[java2wsdl] at org.apache.tools.ant.Target.execute(Target.java:341)
[java2wsdl] at
org.apache.tools.ant.Target.performTasks(Target.java:369)
[java2wsdl] at
org.apache.tools.ant.Project.executeSortedTargets(Project.jav
a:1216)
[java2wsdl] at
org.apache.tools.ant.Project.executeTarget(Project.java:1185)
[java2wsdl] at
org.apache.tools.ant.helper.DefaultExecutor.executeTargets(De
faultExecutor.java:40)
[java2wsdl] at
org.apache.tools.ant.Project.executeTargets(Project.java:1068
)
[java2wsdl] at org.apache.tools.ant.Main.runBuild(Main.java:668)
[java2wsdl] at org.apache.tools.ant.Main.startAnt(Main.java:187)
[java2wsdl] at
org.apache.tools.ant.launch.Launcher.run(Launcher.java:246)
[java2wsdl] at
org.apache.tools.ant.launch.Launcher.main(Launcher.java:67)
BUILD FAILED
D:\development\eclipse\workspace\LoanBroker\build.xml:28: Error while
running or
g.apache.axis.tools.ant.wsdl.Java2WsdlAntTask
<?xml version="1.0" ?>
<project default="compile">
<property name="axis.dir" location="D:/development/axis-1_3"/>
<property name="j2ee.dir" location="C:/Sun/AppServer"/>
<path id="classpath">
<fileset dir="${axis.dir}/lib">
<include name="**/*.jar"/>
</fileset>
<pathelement path="bin"/>
</path>
<taskdef name="wsdl2java" classname="org.apache.axis.tools.ant.wsdl.Wsdl2javaAntTask"
loaderref="axis" >
<classpath refid="classpath"/>
</taskdef>
<taskdef name="java2wsdl" classname="org.apache.axis.tools.ant.wsdl.Java2WsdlAntTask"
loaderref="axis" >
<classpath refid="classpath"/>
</taskdef>
<target name="compile">
<java2wsdl output="LoanBrokerWS.wsdl"
className="ExampleWS"
location="http://localhost:8080/axis/LoanBrokerWS">
</java2wsdl>
</target>
</project>
import java.util.ArrayList;
public class LoanBrokerWS
{
public String getLoanQuote(int ssn, double loanamount, int loanduration) {
String results = "";
results = results + "Client with ssn= " + ssn + " requests a loan of amount= " + loanamount + " for " + loanduration + " months" + "\n\n";
results = results + this.getLoanQuotesWithScores(ssn,loanamount,loanduration);
return results;
}
private String getLoanQuotesWithScores(int de_ssn, double de_loanamount, int de_duration) {
String qws_results="Additional data for customer: credit score and length of credit history\n";
int ssn = de_ssn;
double loanamount = de_loanamount;
int loanduration = de_duration;
int credit_score = 0;
int credit_history_length = 0;
CreditProfile creditprofile = CreditAgencyGateway.getCustomerCreditProfile(ssn);
credit_score = creditprofile.getCreditScore();
credit_history_length = creditprofile.getCreditHistoryLength();
qws_results = qws_results + "Credit Score= " + credit_score + " Credit History Length= " + credit_history_length;
qws_results = qws_results + "\n\n";
qws_results = qws_results + "The details of the best quote from all banks that responded are shown below: \n\n";
qws_results = qws_results + getResultsFromLoanClearingHouse(ssn,loanamount,loanduration,credit_history_length,credit_score);
qws_results = qws_results + "\n\n";
return qws_results;
}
private String getResultsFromLoanClearingHouse(int ssn, double loanamount, int loanduration, int credit_history_length, int credit_score) {
String lch_results="Results from Loan Clearing House ";
ArrayList lenderlist = LenderGateway.getLenderList(loanamount, credit_history_length, credit_score);
BankQuote bestquote = BankQuoteGateway.getBestQuote(lenderlist,ssn,loanamount,loanduration,credit_history_length,credit_score);
lch_results = "Out of a total of " + lenderlist.size() + " quote(s), the best quote is from" + this.getLoanQuotesReport(bestquote);
return lch_results;
}
private String getLoanQuotesReport(BankQuote bestquote)
{
// TODO Auto-generated method stub
return null;
}
}