Yeah. It works now. Its my bad. Sorry about that.

BUt I have another problem. When I execute that method, I get the following
exception.

Caught SOAPException (SOAP-ENV:Client): No data.

What does this mean? I double checked that my soap method exists in the
descriptor and the implementation also exists on the server side. But the
call doesn't reach the server at all.

Praveen
----- Original Message -----
From: "Scott Nichol" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, January 03, 2003 2:28 PM
Subject: Re: Soap With attachments example


> This sample that I created from you code works for me, i.e. it does not
> throw an NPE.
>
> Scott Nichol
>
> import java.io.*;
> import java.util.*;
> import java.net.*;
> import org.w3c.dom.*;
> import org.xml.sax.*;
> import org.apache.soap.util.xml.*;
> import org.apache.soap.util.mime.*;
> import org.apache.soap.*;
> import org.apache.soap.transport.*;
> import org.apache.soap.encoding.*;
> import org.apache.soap.encoding.soapenc.*;
> import org.apache.soap.rpc.*;
> import org.apache.soap.messaging.*;
> import javax.activation.*;
> import javax.mail.internet.*;
> import javax.xml.parsers.*;
>
> public class TestAttachments {
>  public static void main(String[] args) {
>   try {
>       URL url = new URL(args[0]);
>
>    // Build the call.
>    SOAPMappingRegistry smr = new SOAPMappingRegistry();
>    Call call = new Call();
>    call.setSOAPMappingRegistry(smr);
>    call.setTargetObjectURI("urn:MyServiceName");
>    call.setMethodName("myMethodName");
>    call.setEncodingStyleURI(Constants.NS_URI_SOAP_ENC);
>
>    byte[] sourceBytes = new byte[0];
>
>    Vector params = new Vector();
>    DataSource ds = new ByteArrayDataSource(sourceBytes,
> "application/octet-stream");
>    DataHandler dh = new DataHandler(ds);
>    params.addElement(new Parameter("source",
>     javax.activation.DataHandler.class, dh, null));
>
>    DataSource ds2 = new ByteArrayDataSource(sourceBytes,
> "application/octet-stream");
>    DataHandler dh2 = new DataHandler(ds);
>    params.addElement(new Parameter("thumb",
>      javax.activation.DataHandler.class,
>     dh2, null));
>
>    call.setParams(params);
>
>    // Invoke the call.
>    Response resp;
>
>    try {
>     resp = call.invoke(url, "");
>     //System.out.println("Response is: " + resp);
>    } catch (SOAPException e) {
>     System.err.println("Caught SOAPException");
>     e.printStackTrace();
>    }
>   } catch (Exception e) {
>    e.printStackTrace();
>   }
>  }
> }
>
>
> --
> To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
>


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to