You are viewing a plain text version of this content. The canonical link for it is here.
Posted to soap-user@xml.apache.org by "陳照東) <alex@erp.ncu.edu.tw>" <Alex> on 2001/05/21 05:06:53 UTC

Object Deliver via SOAP

hi All:
            i am trying to deliver a File object via soap. 
            but actually, i got some @#$% eoor messages.
            but, at first , i describe my work process to u all.
            
below is my Client-code  main-part:

     SOAPMappingRegistry smr = new SOAPMappingRegistry();
     BeanSerializer beanSer = new BeanSerializer();
     
     smr.mapTypes(Constants.NS_URI_SOAP_ENC,new QName("urn:javawork", "file"),File.class, beanSer, beanSer);
     URL url = new URL( "http://localhost:8080/soap/servlet/rpcrouter" );
     String urn = "urn:javawork:exchange";
             
     Call call = new Call(); // prepare the service invocation
     call.setTargetObjectURI( urn );
     call.setMethodName( "getFile" );
     call.setEncodingStyleURI( Constants.NS_URI_SOAP_ENC );
     call.setSOAPMappingRegistry(smr);
     Vector params = new Vector();
     params.addElement( new Parameter( "country1", String.class, "2", null ) );
     params.addElement( new Parameter( "country2", String.class, "2", null ) );
     call.setParams( params );
     System.out.println( "invoke service\n" + "  URL= " + url + "\n  URN =" +urn );
     response1 = call.invoke( url, "" ); // invoke the service



Below is my Server-code  main-part:


public File getFile( String country1, String country2 )
  throws IllegalArgumentException
  {
    if (country1==null && country2==null)
    {
      throw new IllegalArgumentException("The name argument must not be " +
                                         "null.");
    }
  
    String serverpath="d:/jakarta-tomcat-3.2.1/webapps/ROOT/upload/";
    File file = new File(serverpath);
    File files[] = file.listFiles();
    father fat=new father(2,2);
    return files[0]; 
    }


and i register the type mapping from SOAP-Admin
      ID urn:javawork:exchange 
      Scope Application 
      Provider Type java 
      Provider Class Exchange 
      Use Static Class false 
      Methods getFile 
      Type Mappings [TypeMapping encodingStyle=http://schemas.xmlsoap.org/soap/encoding/,elementType=urn:javawork:file,javaType=java.io.File,java2XMLClassName=org.apache.soap.encoding.soapenc.BeanSerializer,xml2JavaClassName=org.apache.soap.encoding.soapenc.BeanSerializer 



but i got error like this:

Fault= SOAP-ENV:Server, java.lang.IllegalArgumentException: Unable to ret
rieve 'canonicalPath' property value: null.


i dont which part i lose or make mistake, Please tell me !!!!!!!



IT DEP. Special Team-XML 
       System Engineer
       Alex     陳照東 
Tel:+886-3-422-7151  Ext: 6024
Mobile:+886-0939-011-336

alex@ERP.NCU.EDU.TW
=Business to Business=