You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by ax...@ws.apache.org on 2004/10/01 08:49:32 UTC
[jira] Commented: (AXIS-1469) Updates not effective after saveChanges() or writeTo()
The following comment has been added to this issue:
Author: Ashutosh Shahi
Created: Thu, 30 Sep 2004 11:48 PM
Body:
Hi Matt,
I guess i have found the solution to your problem. Each time soapMessage.saveChanges() is called (it's also called automatically when u call soapMessage.writeTo()) the form of soapEnvelope is changed from FORM_SOAPENVELOPE to FORM_OPTIMIZED (constants in org.apache.axis.SOAPPart) (line 487, class: org.apache.axis.SOAPPart).
This change avoids the changes u made to soap message from reflecting in subsequent calls to writeTo().
To get over it, u can add the statement:
((org.apache.axis.SOAPPart)part).setSOAPEnvelope((org.apache.axis.message.SOAPEnvelope)soapEnvelope);
where part is a SOAPPart,after u make changes to soap message. This function setSOAPEnvelope() sets the soap envelope back to FORM_SOAPENVELOPE.
Taking your example, if the code is now:
SOAPMessage soapMessage = MessageFactory.newInstance().createMessage();
SOAPPart part = soapMessage.getSOAPPart();
SOAPEnvelope soapEnvelope = part.getEnvelope(); // Get handle to envelope
soapMessage.writeTo(System.out); // This would give the same results
//soapMessage.saveChanges(); // This converts the SOAP message to String form (as a Fix for Bug 16418???)
System.out.print("\nBREAK\n");
SOAPBody body = soapEnvelope.getBody();
body.addChildElement("foo", "bar", "http://foo/bar"); // Add child elements
((org.apache.axis.SOAPPart)part).setSOAPEnvelope((org.apache.axis.message.SOAPEnvelope)soapEnvelope);
soapMessage.writeTo(System.out); // The changes are reflected now
The second write to should have the changes reflected in soap message. Hope it helps.
Ashutosh
---------------------------------------------------------------------
View this comment:
http://issues.apache.org/jira/browse/AXIS-1469?page=comments#action_53576
---------------------------------------------------------------------
View the issue:
http://issues.apache.org/jira/browse/AXIS-1469
Here is an overview of the issue:
---------------------------------------------------------------------
Key: AXIS-1469
Summary: Updates not effective after saveChanges() or writeTo()
Type: Bug
Status: Unassigned
Priority: Critical
Project: Axis
Components:
Basic Architecture
Versions:
1.2 Beta
Assignee:
Reporter: Mattias Jiderhamn
Created: Wed, 21 Jul 2004 8:24 AM
Updated: Thu, 30 Sep 2004 11:48 PM
Environment: JDK 1.4.2, Resin 2.1.14
Description:
Not sure how to explain this in an understandable manner, but run this code and you will clearly see the problem:
SOAPMessage soapMessage = MessageFactory.newInstance().createMessage();
SOAPEnvelope soapEnvelope = soapMessage.getSOAPPart().getEnvelope(); // Get handle to envelope
// soapMessage.writeTo(System.out); // This would give the same results
soapMessage.saveChanges(); // This converts the SOAP message to String form (as a Fix for Bug 16418???)
soapEnvelope.addChildElement("foo", "bar", "http://foo/bar"); // Add child elements
soapMessage.writeTo(System.out); // The message is already in String form, and changes have no effect
---------------------------------------------------------------------
JIRA INFORMATION:
This message is automatically generated by JIRA.
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
If you want more information on JIRA, or have a bug to report see:
http://www.atlassian.com/software/jira