Hi,

Can anyone help explain why I get an exception thrown at the last line
of this code snippet:

DocumentBuilder builder =
DocumentBuilderFactory.newInstance().newDocumentBuilder();
Document doc = builder.newDocument();
Element root = doc.createElementNS("EnvelopeService","getDetail");
doc.appendChild(root);
Element ele = doc.createElement("e1");
Node text = doc.createTextNode("myText");
ele.appendChild(text);
root.appendChild(ele);
SOAPBodyElement requestBody = new
SOAPBodyElement(doc.getDocumentElement());

The exception is:
java.lang.IllegalArgumentException: invalid QName local part
        at javax.xml.namespace.QName.<init>(QName.java:75)
        at javax.xml.namespace.QName.<init>(QName.java:60)
        at
org.apache.axis.message.PrefixedQName.<init>(PrefixedQName.java:30)
        at
org.apache.axis.message.MessageElement.copyNode(MessageElement.java:2044
)
        at
org.apache.axis.message.MessageElement.copyNode(MessageElement.java:1997
)
        at
org.apache.axis.message.MessageElement.<init>(MessageElement.java:195)
        at
org.apache.axis.message.SOAPBodyElement.<init>(SOAPBodyElement.java:70)
        at axisdoc.Client.main(Client.java:66)

This is the bit I really don't understand.
Can you explain why the exception is being thrown?
At line: Element root =
doc.createElementNS("EnvelopeService","getDetail");
Should the second argument have something like "prefix:getDetail" (I am
not sure how to handle name spaces at this point) And in the first
argument (the name space uri)"EnvelopeService"  matches the sever as
specified in the WSDD document i.e. <service name="EnvelopeService"
style="message"> is this correct?

Once I understand this process, my intention is to send a simple xml doc
that doesn't have namespace prefixes in it elements within the body of a
SOAP message e.g.
<e1>
  <e2>myText</e2>
</e1>

Thanks...

Tom

Reply via email to