Re: Response of SOAP message wtih Attachment

2005-10-04 Thread Gabsaga Tata
Günter,
 
Thank you for your help. I made the change just like you pointed out and it works just as expected.
 
Gabsaga
 
-Original Message-From: Grossberger, Guenter [mailto:[EMAIL PROTECTED]Sent: Tuesday, October 4, 2005 04:58 AMTo: axis-user@ws.apache.orgSubject: RE: Response of SOAP message wtih Attachment
Hi!
 
I think you attached the file to the wrong (i.e. request) message.
 
Replace
SOAPMessage msg = msgCntxt.getMessage();
with
org.apache.axis.Message msg = msgCntxt.getRepsonseMessage();
Then it should work.
 
Best regars,--DI Günter GrossbergerConsultant Tel: +43 1 329 50 161Software AG Österreich Fax: +43 1 329 50 171Guglgasse 7-9  GSM: +43 676 833 29 2611030 Wien  http://www.softwareag.com/austria
 



From: Gabsaga Tata [mailto:[EMAIL PROTECTED] Sent: Monday, October 03, 2005 4:38 PMTo: axis-user@ws.apache.orgSubject: Response of SOAP message wtih Attachment

I am using Apache Axis 1.2 / Tomcat 4
Is it possible for a client application to get back data as MIME attachment from a web service?From the example code snippets below, the service successfully attaches a file to a SOAP messagebut when the client application tries to get the attachment count, it is zero. Any ideas why?
 
Thanks.
 
Gabsaga
Code snippet for MyMessageService message-style service.MessageContext msgCntxt = MessageContext.getCurrentContext();SOAPMessage msg = msgCntxt.getMessage();DataHandler dataHander = new DataHandler(new FileDataSource("C:webapps\\axis\\WEB-INF\\attachments\\res_message.xml"));AttachmentPart attachment = msg.createAttachmentPart(dataHander);attachment.setContentId("attached_processed_file");msg.addAttachmentPart(attachment);
Code snippet for Client application sending request to MyMessageService message-style service.SOAPConnection conn = SOAPConnectionFactory.newInstance().createConnection();SOAPMessage response = conn.call(message, "http://localhost/axis/services/MyMessageService"); 
SOAPPart responseSp = response.getSOAPPart();SOAPEnvelope responseSe = responseSp.getEnvelope();SOAPBody responseBody = responseSe.getBody();
//Get attached messageif(!responseBody.hasFault()){ int numOfAttachments = response.countAttachments(); System.out.println("\n\nNumber of attachments in message = " + numOfAttachments);}


RE: Response of SOAP message wtih Attachment

2005-10-04 Thread Grossberger, Guenter



Hi!
 
I think you attached the file to the wrong (i.e. 
request) message.
 
Replace
SOAPMessage msg = 
msgCntxt.getMessage();
with
org.apache.axis.Message msg = 
msgCntxt.getRepsonseMessage();
Then it should 
work.
 
Best 
regars,--DI Günter 
GrossbergerConsultant 
Tel: +43 1 329 50 161Software AG Österreich Fax: +43 1 329 50 
171Guglgasse 7-9  GSM: 
+43 676 833 29 2611030 
Wien  
http://www.softwareag.com/austria
 

  
  
  From: Gabsaga Tata 
  [mailto:[EMAIL PROTECTED] Sent: Monday, October 03, 2005 
  4:38 PMTo: axis-user@ws.apache.orgSubject: Response of 
  SOAP message wtih Attachment
  
  I am using Apache Axis 1.2 / Tomcat 
  4
  Is it possible for a client application to get 
  back data as MIME attachment from a web service?From the example code 
  snippets below, the service successfully attaches a file to a SOAP 
  messagebut when the client application tries to get the attachment count, 
  it is zero. Any ideas why?
   
  Thanks.
   
  Gabsaga
  Code 
  snippet for MyMessageService message-style 
  service.MessageContext 
  msgCntxt = MessageContext.getCurrentContext();SOAPMessage msg = 
  msgCntxt.getMessage();DataHandler dataHander = new DataHandler(new 
  FileDataSource("C:webapps\\axis\\WEB-INF\\attachments\\res_message.xml"));AttachmentPart 
  attachment = 
  msg.createAttachmentPart(dataHander);attachment.setContentId("attached_processed_file");msg.addAttachmentPart(attachment);
  Code snippet 
  for Client application sending request to MyMessageService message-style 
  service.SOAPConnection 
  conn = SOAPConnectionFactory.newInstance().createConnection();SOAPMessage 
  response = conn.call(message, "http://localhost/axis/services/MyMessageService"); 
  
  SOAPPart responseSp = response.getSOAPPart();SOAPEnvelope 
  responseSe = responseSp.getEnvelope();SOAPBody responseBody = 
  responseSe.getBody();
  //Get attached messageif(!responseBody.hasFault()){ int 
  numOfAttachments = 
  response.countAttachments(); System.out.println("\n\nNumber of 
  attachments in message = " + 
numOfAttachments);}


Response of SOAP message wtih Attachment

2005-10-03 Thread Gabsaga Tata
I am using Apache Axis 1.2 / Tomcat 4
Is it possible for a client application to get back data as MIME attachment from a web service?From the example code snippets below, the service successfully attaches a file to a SOAP messagebut when the client application tries to get the attachment count, it is zero. Any ideas why?
 
Thanks.
 
Gabsaga
Code snippet for MyMessageService message-style service.MessageContext msgCntxt = MessageContext.getCurrentContext();SOAPMessage msg = msgCntxt.getMessage();DataHandler dataHander = new DataHandler(new FileDataSource("C:webapps\\axis\\WEB-INF\\attachments\\res_message.xml"));AttachmentPart attachment = msg.createAttachmentPart(dataHander);attachment.setContentId("attached_processed_file");msg.addAttachmentPart(attachment);
Code snippet for Client application sending request to MyMessageService message-style service.SOAPConnection conn = SOAPConnectionFactory.newInstance().createConnection();SOAPMessage response = conn.call(message, "http://localhost/axis/services/MyMessageService"); 
SOAPPart responseSp = response.getSOAPPart();SOAPEnvelope responseSe = responseSp.getEnvelope();SOAPBody responseBody = responseSe.getBody();
//Get attached messageif(!responseBody.hasFault()){ int numOfAttachments = response.countAttachments(); System.out.println("\n\nNumber of attachments in message = " + numOfAttachments);}