-
1. Re: NullPointerException in SOAPBodyAxisImpl.addDocument
omatzura Feb 21, 2005 6:00 AM (in response to agdolla)Hi..
Our experience is that addDocument is pretty buggy in the current jbossws implementation, for example it doesnt seem to handle entities correctly, etc..
We have created our own method to convert a DOM element to a SOAPElement, which works fine with XmlBeans as well ..
good luck!
/Ole -
2. Re: NullPointerException in SOAPBodyAxisImpl.addDocument
agdolla Feb 21, 2005 6:42 AM (in response to agdolla)"omatzura" wrote:
We have created our own method to convert a DOM element to a SOAPElement, which works fine with XmlBeans as well ..
Hi
how do you do that ???
addDocument works with plain axis....
thanks
Gabor -
3. Re: NullPointerException in SOAPBodyAxisImpl.addDocument
thomas.diesler Feb 23, 2005 8:48 AM (in response to agdolla)SOAPBody.addDocument(Document) is suposed to work.
Could you create a jira issue with simple test cases that show your problem?
thanks -
4. Re: NullPointerException in SOAPBodyAxisImpl.addDocument
agdolla Feb 23, 2005 10:07 AM (in response to agdolla)"thomas.diesler@jboss.com" wrote:
SOAPBody.addDocument(Document) is suposed to work.
Could you create a jira issue with simple test cases that show your problem?
Hi
OK I can try that but I'm not sure if I can create a simple test case.
I have a complex schema (3gpp MMS) and I created java classes from
xsd with XMLBeans.
When I try to post it via SOAP I create a new SAAJ message, and
tried to use the addDocument() function. Then I received the nullpointerexception, and I'm not sure if it can be reproduced with a simple Document.
The strange thing is that I created a private addDocument method by copying code from jboss and that code works.
SOAPMessage soapMessage = messageFactory.createMessage();
SOAPPart sp = soapMessage.getSOAPPart();
SOAPEnvelope se = sp.getEnvelope();
SOAPHeader sh = se.getHeader();
Name name = se.createName("TransactionID","tr",
"http://www.3gpp.org/ftp/Specs/archive/23_series/23.140/schema/REL-5-MM7-1-0");
SOAPHeaderElement she = sh.addHeaderElement(name);
she.setMustUnderstand(true);
she.setValue(trid);
SOAPBody main = se.getBody();
myAddDocument(se, main, body.getDocumentElement());
// main.addDocument(body);
private static SOAPElement myAddDocument(SOAPEnvelope se, SOAPElement soapParent, Element domElement) {
try
{
Name name = se.createName(domElement.getLocalName(), domElement.getPrefix(), domElement.getNamespaceURI());
SOAPElement soapChild = soapParent.addChildElement(name);
NamedNodeMap attrs = ((Element)domElement).getAttributes();
for (int i = 0; i < attrs.getLength(); i++)
{
Node att = attrs.item(i);
soapChild.setAttributeNS(att.getNamespaceURI(), att.getLocalName(), att.getPrefix());
}
StringBuffer content = new StringBuffer();
NodeList children = domElement.getChildNodes();
for (int i = 0; i < children.getLength(); i++)
{
Node domChild = children.item(i);
if (domChild.getNodeType() == Node.ELEMENT_NODE)
myAddDocument(se, soapChild, (Element)domChild);
if (domChild.getNodeType() == Node.TEXT_NODE && domChild.getNodeValue().trim().length() > 0)
content.append(domChild.getNodeValue());
}
if (content.length() > 0)
{
String value = content.toString();
soapChild.addTextNode(value);
}
return soapChild;
}
catch (Exception e)
{
e.printStackTrace(System.err);
}
return null;
}
the difference between my method and jboss's addDocument is that
my method uses classes from standard packages while jboss's addDocument/importDOMElement uses NameImpl and SOAPElementAxisImpl and so on....
Gabor -
5. Re: NullPointerException in SOAPBodyAxisImpl.addDocument
thomas.diesler Feb 24, 2005 7:12 AM (in response to agdolla)This is assigned to jira issue
http://jira.jboss.com/jira/browse/JBWS-127 -
6. Re: NullPointerException in SOAPBodyAxisImpl.addDocument
agdolla Feb 24, 2005 7:14 AM (in response to agdolla)Hi
I'm working on a test case
Gabor -
7. Re: NullPointerException in SOAPBodyAxisImpl.addDocument
omatzura Feb 24, 2005 7:23 AM (in response to agdolla)Hi!
we had a null-pointer issue in this method; in.. Name name = se.createName(domElement.getLocalName(), domElement.getPrefix(), domElement.getNamespaceURI()); ..
domElement.getPrefix() sometimes returned null which havoced createName(..)
maybe this is the same NullPointer you are getting?
regards!
/Ole -
8. Re: NullPointerException in SOAPBodyAxisImpl.addDocument
agdolla Feb 24, 2005 7:29 AM (in response to agdolla)Hi
From the stack trace the problem is in:
org.apache.axis.message.SOAPElementAxisImpl.setAttribute(SOAPElementAxisImpl.java:1170)
It might related to your problem, though
Gabor -
9. Re: NullPointerException in SOAPBodyAxisImpl.addDocument
thomas.diesler Feb 24, 2005 7:35 AM (in response to agdolla)Where do you see this code? It is probably incorrect to assume that the element the name is created from will be qualified.
The current implementation in Branch_4_0 is like this/** Recursive function */ private SOAPElementAxisImpl importDOMElement(SOAPElementAxisImpl soapParent, Element domElement) { try { NameImpl name; if (domElement.getNamespaceURI() != null) name = new NameImpl(domElement.getLocalName(), domElement.getPrefix(), domElement.getNamespaceURI()); else name = new NameImpl(domElement.getLocalName()); ...
You might find that this issue is already fixed with this change.
cvs co -r Branch_4_0 jboss-4.0 -
10. Re: NullPointerException in SOAPBodyAxisImpl.addDocument
agdolla Feb 24, 2005 8:17 AM (in response to agdolla)I'd like to try that version but cvs cannot check it out
cvs checkout: [13:15:54] waiting for jboss-build's lock in /cvsroot/jboss/jbosstest/src/main/org/jboss/test/webservice/hello
4.0.1SP1 also contains this modification ?
Gabor