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 Jian Zhang <jz...@symcor.com> on 2002/08/26 16:32:29 UTC

Get: Caught SOAPException (SOAP-ENV:Client): Can't yet deserializ e non-null Objects

I have a SOAP client class that provides all the API for soap client
applicaitons to
talk to SOAP server. For instance, SoapClient has methods called 
void logon (String userName, String password)
and 
ImageDocument getDoc(String ID)

I have two client applications, one is a command line test program that
calls
my soapClient object to logon and get an image document. I have another
servlet who uses the does same thing. The only difference is that command
line
program saves the image data into a file while the servlet returns the data
to the browser that shows the image to the end user.

The problem that I have is that I can get the image data retrieved back and
saved
in a file with the command line program while when I do the same with
servlet,
it gets an exception:
Caught SOAPException (SOAP-ENV:Client): Can't yet deserialize non-null
Objects

The call statements in both programs are exactly the same, as:
                docId = "5014-5015-BAA1-2FAAA-0-34495-0-34495-85-68-0-1-0";
                soapClient = new
SoapClient("http://arcdev99:20400/odtest/servlet/rpcrouter",
"urn:archive-service");
                ImageDocument doc = soapClient.getDoc(docId);

The following code is soapClient.getDoc():

    public ImageDocument getDoc(String docId) {

        System.out.println("getDoc(), id " + docId);

        // Process the arguments.
        String encodingStyleURI = Constants.NS_URI_SOAP_ENC;
        String archiveNameURN = serviceName;
        String methodName = "getDocument";

        URL url = null;
        try {
            url = new URL(serverUrl);
        } catch (java.net.MalformedURLException e) {
            e.printStackTrace();
        }

        SOAPMappingRegistry smr = new SOAPMappingRegistry();
        BeanSerializer beanSer = new BeanSerializer();

        // Map the types.
        smr.mapTypes(Constants.NS_URI_SOAP_ENC,
                     new QName("urn:odserver-mapping", "folder"),
                     com.symcor.od.common.soap.message.Folder.class,
beanSer, beanSer);
        smr.mapTypes(Constants.NS_URI_SOAP_ENC,
                     new QName("urn:odserver-mapping", "criterion"),
                     com.symcor.od.common.soap.message.Criterion.class,
beanSer, beanSer);
        smr.mapTypes(Constants.NS_URI_SOAP_ENC,
                     new QName("urn:odserver-mapping", "document"),
                     com.symcor.od.common.soap.message.ImageDocument.class,
beanSer, beanSer);
        smr.mapTypes(Constants.NS_URI_SOAP_ENC,
                     new QName("urn:odserver-mapping", "hit"),
                     com.symcor.od.common.soap.message.Hit.class, beanSer,
beanSer);

        // Build the call.
        Call call = new Call();

        call.setSOAPMappingRegistry(smr);
        call.setTargetObjectURI(archiveNameURN);
        call.setMethodName(methodName);
        call.setEncodingStyleURI(encodingStyleURI);

        Vector params = new Vector();
        params.addElement(new Parameter("getdoc", java.lang.String.class,
                                        docId, null));

        call.setParams(params);

        // Invoke the call.
        Response resp;
        ImageDocument doc = null;

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

        // Check the response.
        if (!resp.generatedFault()) {
              Parameter ret = resp.getReturnValue();
              doc = (ImageDocument)ret.getValue();

              //logging
              System.out.println("document, id: " + doc.getId());
        }  else {
              Fault fault = resp.getFault();
              System.out.println("Generated fault: " + fault);
        }

      return doc;
    }


I deploy the service before I try either of them and I can verify that the
service
is there. With servlet, I can logon, no problem at all.
Anything special I should do for the servlet? 

Thanks,


Jian