You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Gregor Kovaè <gr...@mikropis.si> on 2002/09/19 08:27:36 UTC
messaging
Hi!
I'm still trying to send an org.w3c.dom.Document XML document with Axis.
Since in user's doc there is a section about this stating that Axis
supports also the
public Document method(Document doc)
type of methods on the service side I tried using JAXM to send it:
SOAPConnectionFactory factory = SOAPConnectionFactory.newInstance();
SOAPConnection con = factory.createConnection();
MessageFactory msgFactory = MessageFactory.newInstance();
SOAPMessage message = msgFactory.createMessage();
SOAPPart soapPart = message.getSOAPPart();
SOAPEnvelope envelope = soapPart.getEnvelope();
SOAPHeader header = envelope.getHeader();
SOAPBody body = envelope.getBody();
header.detachNode(); // don't need SOAP header part
Name bodyName = envelope.createName("message");
SOAPBodyElement gltp = body.addBodyElement(bodyName);
Name name = envelope.createName("symbol");
SOAPElement symbol = gltp.addChildElement(name);
symbol.addTextNode(out.outputString(doc));
Then I noticed that SOAPElement does not have a method to pass the
org.w3c.dom.Document (or did I miss something) so I tried sending it as an
attachment:
AttachmentPart attachment = message.createAttachmentPart();
attachment.setContent(doc, "text/xml");
attachment.setContentId("povprasevanje");
message.addAttachmentPart(attachment);
but calling message.createAttachmentPart() throws:
Exception in thread "main" java.lang.NullPointerException
at org.apache.axis.Message.createAttachmentPart(Message.java:588)
Does that mean that Axis does not support attachments like this ?
Any ideas what I'm doing wrong ?
Best regards,
Kovi