Chris, From you posting I am a bit confused. As far as I understand, after the client has completed the call to the web service, the MessageContext object can still be accessed by retrieving it from the Call object by invoking the getMessageContext() method. So, how can it be said that the message context has disappeared (as mentioned in your posting) after the call to the service has been made?
In effect, to answer Gloria's question in he original posting - Her question - Does MessageContext only exist with the service, but not accessible from a client? My answer would be - No, MessageContext is accessible from the client as well and does not exist only with the service. Here is a snippet of code that I have and works perfectly. Especially note the lines where I call the service; after which, I get the message context from the "call" and extract the attachments. //will go through the TCP monitor listening on 7080 String endPoint = "http://localhost:7080/cuis/services/Email"; String method = "sendMailWithAttachment"; System.out.println("calling web service at - "+endPoint); try { Service service = new Service(); org.apache.axis.client.Call call = (org.apache.axis.client.Call) service.createCall(); call.setTargetEndpointAddress(new java.net.URL(endPoint)); //////// ping System.out.println("pinging the service..with an attachement"); call.setOperationName(new QName("Email", "ping")); call.addParameter( "op1", XMLType.XSD_STRING, ParameterMode.IN); call.setReturnType(XMLType.AXIS_VOID); //call.setProperty(Call.ATTACHMENT_ENCAPSULATION_FORMAT,Call.ATTACHMENT_ENCAPSULATION_FORMAT_DIME); String[] array = new String[1]; array[0] = "hello"; //add an attachment call.addAttachmentPart(new AttachmentPart(dh)); //call the service String returnValue = (String) call.invoke(array); //get the message context and extract the attachments org.apache.axis.MessageContext messageContext = call.getMessageContext(); org.apache.axis.Message responseMessage = messageContext.getResponseMessage(); System.out.println("Number of attachments is -> "+responseMessage.countAttachments()); responseMessage.getAttachments(); } catch(Exception e) { e.printStackTrace(); } Please feel free to correct me. Thanks Srinivas -----Original Message----- From: chris [mailto:[EMAIL PROTECTED] Sent: Thursday, November 13, 2003 7:25 PM To: [EMAIL PROTECTED] Subject: RE: MessageContext doesn't work at client side? Gloria - At what step are you attempting to capture the message context? MessageContext is *only* present and valid while the client is processing the SOAP method call. Until the call method is triggered by ClientMain, a message context doesn't exist. By the time control is returned to ClientMain after calling a stub method, the message context has disappeared. After the SOAP response is processed, all relevant context information is held in the Stub, Call, or Service object. /Chris http://cvs.apache.org/~haddadc -----Original Message----- From: Yan Lin [mailto:[EMAIL PROTECTED] Sent: Thursday, November 13, 2003 5:09 PM To: [EMAIL PROTECTED] Subject: MessageContext doesn't work at client side? Hi, I have created a service and successfully deployed. At client side, I created a ClientMain.java which only contains a "main" method for the purpose of testing. I tried to use "MessageContext.getCurrentContext()", but I always get NullPointerException. Does MessageContext only exist with the service, but not accessible from a client? Thanks! Gloria __________________________________ Do you Yahoo!? Protect your identity with Yahoo! Mail AddressGuard http://antispam.yahoo.com/whatsnewfree