"[EMAIL PROTECTED]" 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
View the original post :
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3867620#3867620
Reply to the post :
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3867620
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user