Problem with with accessing a web service!
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

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. " +
"

" +
"
" +
" " +
"[ Registrieren Sie sich " +
"&nbsp[ Hauptseite ] "+
"
");
}
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

Re: Problem with with accessing a web service!

Posted By:   Laurent_Mihalkovic  
Posted On:   Saturday, August 10, 2002 01:55 AM

First of all, i would suggest that you shift from Apache SOAP to Apache AXIS which is the next generation SOAP library from the Apache group.

Second, i'd suggest that you configure LOG4J so that the SOAP library starts printing debugging information, either to the console, or to a log file. This helped me a lot when i was debugging some SOAP code.

cheers,
laurent

About | Sitemap | Contact