[WSS4J] Re: AW: WSDoAllReceiver/AxisUtil problem report

Davanum Srinivas <dims-/[email protected]> Tue, 10 Feb 2004 05:03:03 -0800 (PST)
Newsgroups gmane.text.xml.wss4j
Message-ID <[email protected]>
Can one of you set disableFormatting to true in Axis' SOAPBody.java (line 93) and see if that
helps? if it does, i can add a global switch to disable formatting.

thanks,
dims

--- Dittmann Werner <[email protected]> wrote:
> Sashka,
> 
> just to make sure: as I understand your report
> the problem is soemwhere in class DOMSource?
> 
> Well, I checked this beast (contained in Axis
> sources) and found that it does nothing to the
> content at all, just stores the node an provides
> a way to access the node.
> 
> That means, that the problem is somewhere in Axis
> serialization as we just replace the nodes,
> basically.
> 
> Dims, do you know of any problem there?
> 
> BTW, while implementing and testing the interop
> scenarios I discovered a similar problem. That's
> the reason why I do a String.trim() on the String
> input parameter at the server side to get rid
> of unwanted \n. Well, I didn't follow up that
> problem then, but it seems that something is wrong
> with Axis serialization when there is a new node.
> 
> Regards,
> Werner
> 
> 
> 
> > -----Ursprüngliche Nachricht-----
> > Von: Sashka [mailto:[email protected]] 
> > Gesendet: Dienstag, 10. Februar 2004 12:38
> > An: Dittmann Werner; Davanum Srinivas
> > Betreff: WSDoAllReceiver/AxisUtil problem report
> > 
> > 
> > Werner, Dims, hi.
> > It seems there is a problem in the call to 
> >  AxisUtil.updateSOAPMessage(doc, sm) in WSDoAllReceiver - the 
> > document 
> > is corrupted while the message is updated in this point:
> > ///---------------------
> >     WSSecurityEngineResult wsResult = null;
> >     try {
> >         wsResult =
> >                 secEngine.processSecurityHeader(
> >                         doc,
> >                         null,
> >                         cbHandler,
> >                         sigCrypto,
> >                         decCrypto);
> >     } catch (Exception ex) {
> >         throw new AxisFault(
> >                 "WSDoAllReceiver: security processing failed",
> >                 ex);
> >     }
> >     try {
> >       AxisUtil.updateSOAPMessage(doc, sm); /// <<--- Here
> >     ...........
> > ///-------------------------
> > 
> > Full description.
> > ------------------
> > I'm testing the WSS4J with a standard basic axis sample: 
> > samples.addr. 
> > On the call AddressBook.addEntry(String name, Address addr) <executed 
> > as rpc/encoded, for more exactness> I receive unexpected server-side 
> > exception while Address object deserialization:
> > //----- start of except. stack ------------
> >     java.lang.NumberFormatException: For input string: '\n1 ' at 
> >     java.lang.NumberFormatException.forInputString 
> >                                (NumberFormatException.java:48) at 
> >     java.lang.Integer.parseInt(Integer.java:426) at 
> >     java.lang.Integer.&lt;init&gt;(Integer.java:567) at
> >     sun.reflect.NativeConstructorAccessorImpl.newInstance0
> >                                      (Native Method) at 
> >     sun.reflect.NativeConstructorAccessorImpl.newInstance
> >                        (NativeConstructorAccessorImpl.java:39) at 
> >     sun.reflect.DelegatingConstructorAccessorImpl.newInstance
> >                        (DelegatingConstructorAccessorImpl.java:27) at 
> >     
> > java.lang.reflect.Constructor.newInstance(Constructor.java:274) at 
> >     org.apache.axis.encoding.ser.SimpleDeserializer.makeValue
> >                        (SimpleDeserializer.java:284) at 
> >     org.apache.axis.encoding.ser.SimpleDeserializer.onEndElement
> >                        (SimpleDeserializer.java:214) at 
> >     org.apache.axis.encoding.DeserializerImpl.endElement
> >                       (DeserializerImpl.java:544) at 
> >     org.apache.axis.encoding.DeserializationContextImpl.endElement
> >                       (DeserializationContextImpl.java:1092) at 
> >     ..... etc ......
> > //----- end of except. stack ------------
> > 
> > As the check shows, the problematic whitespaces were added in the 
> > mentioned point:  
> >      AxisUtil.updateSOAPMessage(doc, sm). This claim may be proved by 
> > next:
> > In my case the document returned after description call
> >  			wsResult =
> > 				secEngine.processSecurityHeader(
> > 					doc,
> > 					null,
> > 					cbHandler,
> > 					sigCrypto,
> > 					decCrypto);
> > is fine, it may be seen in attached fine_doc.xml
> > The updated after the the AxisUtil.updateSOAPMessage() call Message 
> > contains data entries corrupted by extra white spaces, as appears in 
> > the corrupted_doc.xml
> > Just to check the assuption that the problem caused within 
> > AxisUtil.updateSOAPMessage() code by the DOMSource class, it was 
> > changed by much worse, but suitable for test purposes:
> > 
> >   original:
> > 	public static SOAPMessage updateSOAPMessage(
> > 		Document doc,
> > 		SOAPMessage message)
> > 		throws Exception {
> > 		DOMSource domSource = new DOMSource(doc);
> > 		message.getSOAPPart().setContent(domSource);
> > 		return message;
> > 	}
> >   changed:
> > 	public static SOAPMessage updateSOAPMessage(
> > 		Document doc,
> > 		SOAPMessage message)
> > 		throws Exception {
> >             String msgstr = 
> > org.apache.axis.utils.XMLUtils.DocumentToString(doc);
> >             java.io.StringBufferInputStream sbis = new 
> > java.io.StringBufferInputStream(msgstr);
> >             javax.xml.transform.stream.StreamSource source =
> >                     new javax.xml.transform.stream.StreamSource(sbis);
> >             sm.getSOAPPart().setContent(source);	
> >       }
> > 
> > which solves the serialization problem. 
> > 
> > Sincerely
> > Sasha
> > 


=====
Davanum Srinivas - http://webservices.apache.org/~dims/


-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn