[WSS4J] AW: WSDoAllReceiver/AxisUtil problem report
Dittmann Werner <[email protected]> Tue, 10 Feb 2004 13:56:09 +0100
| Newsgroups | gmane.text.xml.wss4j |
|---|---|
| Message-ID | <79D5F4B2D775204D9C7852EE41C547730141A5A8@mchh2a1e.mchh.siemens.de> |
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=FCngliche Nachricht----- > Von: Sashka [mailto:[email protected]]=20 > Gesendet: Dienstag, 10. Februar 2004 12:38 > An: Dittmann Werner; Davanum Srinivas > Betreff: WSDoAllReceiver/AxisUtil problem report >=20 >=20 > Werner, Dims, hi. > It seems there is a problem in the call to=20 > AxisUtil.updateSOAPMessage(doc, sm) in WSDoAllReceiver - the=20 > document=20 > is corrupted while the message is updated in this point: > ///--------------------- > WSSecurityEngineResult wsResult =3D null; > try { > wsResult =3D > secEngine.processSecurityHeader( > doc, > null, > cbHandler, > sigCrypto, > decCrypto); > } catch (Exception ex) { > throw new AxisFault( > "WSDoAllReceiver: security processing failed", > ex); > } > try { > AxisUtil.updateSOAPMessage(doc, sm); /// <<--- Here > ........... > ///------------------------- >=20 > Full description. > ------------------ > I'm testing the WSS4J with a standard basic axis sample:=20 > samples.addr.=20 > On the call AddressBook.addEntry(String name, Address addr) <executed = > as rpc/encoded, for more exactness> I receive unexpected server-side=20 > exception while Address object deserialization: > //----- start of except. stack ------------ > java.lang.NumberFormatException: For input string: '\n1 ' at=20 > java.lang.NumberFormatException.forInputString=20 > (NumberFormatException.java:48) at=20 > java.lang.Integer.parseInt(Integer.java:426) at=20 > java.lang.Integer.<init>(Integer.java:567) at > sun.reflect.NativeConstructorAccessorImpl.newInstance0 > (Native Method) at=20 > sun.reflect.NativeConstructorAccessorImpl.newInstance > (NativeConstructorAccessorImpl.java:39) at=20 > sun.reflect.DelegatingConstructorAccessorImpl.newInstance > (DelegatingConstructorAccessorImpl.java:27) at = > =20 > java.lang.reflect.Constructor.newInstance(Constructor.java:274) at=20 > org.apache.axis.encoding.ser.SimpleDeserializer.makeValue > (SimpleDeserializer.java:284) at=20 > org.apache.axis.encoding.ser.SimpleDeserializer.onEndElement > (SimpleDeserializer.java:214) at=20 > org.apache.axis.encoding.DeserializerImpl.endElement > (DeserializerImpl.java:544) at=20 > org.apache.axis.encoding.DeserializationContextImpl.endElement > (DeserializationContextImpl.java:1092) at=20 > ..... etc ...... > //----- end of except. stack ------------ >=20 > As the check shows, the problematic whitespaces were added in the=20 > mentioned point: =20 > AxisUtil.updateSOAPMessage(doc, sm). This claim may be proved by = > next: > In my case the document returned after description call > wsResult =3D > 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=20 > contains data entries corrupted by extra white spaces, as appears in=20 > the corrupted_doc.xml > Just to check the assuption that the problem caused within=20 > AxisUtil.updateSOAPMessage() code by the DOMSource class, it was=20 > changed by much worse, but suitable for test purposes: >=20 > original: > public static SOAPMessage updateSOAPMessage( > Document doc, > SOAPMessage message) > throws Exception { > DOMSource domSource =3D new DOMSource(doc); > message.getSOAPPart().setContent(domSource); > return message; > } > changed: > public static SOAPMessage updateSOAPMessage( > Document doc, > SOAPMessage message) > throws Exception { > String msgstr =3D=20 > org.apache.axis.utils.XMLUtils.DocumentToString(doc); > java.io.StringBufferInputStream sbis =3D new=20 > java.io.StringBufferInputStream(msgstr); > javax.xml.transform.stream.StreamSource source =3D > new = javax.xml.transform.stream.StreamSource(sbis); > sm.getSOAPPart().setContent(source);=09 > } >=20 > which solves the serialization problem.=20 >=20 > Sincerely > Sasha >=20 ------------------------------------------------------- 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