Posted By:
Founaboui_Haman
Posted On:
Wednesday, July 24, 2002 06:46 AM
Hello all together, I am trying to access a web service, that retieve and submit data to a MySQL database. The Web Service is composed of some JavaBeans defining adress, phone number and so fort and a class that uses these Beans. All these seem to work well, because I tested it with a normal Java Programming. I wrote an ApacheSOAPclient to access the service. Compiling and running is working well, but nothing is returned. I am using win 2000 Professional, tomcat4.04., apacheSOAP2.3.1 and j2sdk1.4.0 I don't known what I am doing wrong. Please help me. Thank you! Hier a shnippet of the Java(Servlet) Client I wrote:
More>>
Hello all together,
I am trying to access a web service, that retieve and submit data
to a MySQL database.
The Web Service is composed of some JavaBeans defining adress,
phone number and so fort
and a class that uses these Beans. All these seem to work well,
because I tested it with
a normal Java Programming.
I wrote an ApacheSOAPclient to access the service. Compiling and running
is working well,
but nothing is returned.
I am using win 2000 Professional, tomcat4.04., apacheSOAP2.3.1 and j2sdk1.4.0
I don't known what I am doing wrong.
Please help me. Thank you!
Hier a shnippet of the Java(Servlet) Client I wrote:
...
protected void processRequest(HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html");
PrintWriter out = response.getWriter();
out.println("
");
out.println("
");
out.println("
" +
"
"size='5'>
Artikel Zeigen
" +
"
|
");
SOAPMappingRegistry smr = new SOAPMappingRegistry();
BeanSerializer beanSer = new BeanSerializer();
// Mapping the types
smr.mapTypes(Constants.NS_URI_SOAP_ENC,
new QName("urn:artikel", "artikel"),
Artikel.class, beanSer, beanSer);
// invoking the call
Call call = new Call();
call.setSOAPMappingRegistry(smr);
call.setTargetObjectURI("urn:AnfrageService");
call.setMethodName("zeigeAlleArtikel");
call.setEncodingStyleURI(Constants.NS_URI_SOAP_ENC);
Response resp = null;
try{
URL url = new URL(RPCROUTER);
resp = call.invoke(url, null);
}
catch (SOAPException e){
out.println("Caught SOAPException (" +
e.getFaultCode() + "): " +
e.getMessage());
}
// checking the response
if (!resp.generatedFault()){ // SUCCESS
Parameter ret = resp.getReturnValue();
Artikel value = (Artikel)ret.getValue();
if (value != null) // Werte wurden zurückgeliefert
out.println(value);
else // Werte wurden nicht geliefert
out.println("
"+
"
Erfolgreiche Anfrage" +
", aber es wurden keine Artikel gefunden.
" +
"
|
" +
"
");
}
else // SOAP-FAULT
{
Fault fault = resp.getFault();
out.println("
Generierter Fehler
: ");
out.println ("Fehler-Code = " + fault.getFaultCode());
out.println ("
Fehler-Text = " + fault.getFaultString());
out.println ("
|
");
}
out.println("
");
out.close();
}
...
<<Less