You are viewing a plain text version of this content. The canonical link for it is here.
Posted to soap-user@ws.apache.org by Founaboui Haman <ha...@online.de> on 2002/07/27 14:07:44 UTC

Why am I getting null!

Hello all together!

I am trying to access a web service, that retrieve data from a MySQL database.
The service uses some JavaBeans to serialize the Types. The service uses also a class
that create an XML-doc(it is a string). These all together is working well, because
I tested them as a normal programm and I get somme results outputted.
But as a web service I am getting as result:
<pre>
<ns1:zeigeAlleArtikelResponse xmlns:ns1="urn:AnfrageService" 
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<return xsi:type="xsd:string" xsi:nil="true"/>
</pre>
I am using soap-2.3.1, tomcat-4.0.4. and j2sdk1.4.0. 
I do not know, what I am doing wrong!
Thanks for your help!
Hier ist a part of my soapclient:

<pre>
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);

        //  Call
        Call call = new Call();
        call.setSOAPMappingRegistry(smr);
        call.setTargetObjectURI("urn:AnfrageService");
        call.setMethodName("zeigeAlleArtikel");
        call.setEncodingStyleURI(Constants.NS_URI_SOAP_ENC);
        

        // calling.
        Response resp = null;

        try{
            URL url = new URL(RPCROUTER);
            resp = call.invoke(url, "");
        }
        catch (SOAPException e){
                out.println("Caught SOAPException (" +
                             e.getFaultCode() + "): " +
                             e.getMessage());
        }

        // Checking the response

        if (!resp.generatedFault()){ // no faults
            Parameter results = resp.getReturnValue();
            Artikel values = (Artikel)results.getValue();             
            if (values != null) // values were returned
                out.println("<pre>"+values+"</pre>");
            else // no values returned
                out.println("<center><table><tr><td align=center>"+
                    "<font face='Arial Narrow' size='2'>Success " +
                    ", but there are no articles in the database.</font> " +
                    " <br><br></td></tr></table></center>");
        }
        else // there are soap-faults
        {
            Fault fault = resp.getFault();
            out.println("<table><tr><td colspan=2>Generated Fault<br>: ");
            out.println ("Faultr-Code   = " + fault.getFaultCode());
            out.println ("<br>Fault-Text = " + fault.getFaultString());
            out.println ("</td></tr></table>");
        }
 </pre>

 
 Haman