I've seen questions like this but so far they don't help.
I'm currently having an issue setting a prefix for an element within my SOAP body. The request I'm trying to build looks like this:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:sen="http://company.org/sendmailaTTACH">
<soapenv:Header/>
<soapenv:Body>
<sen:SendMail>
<sen:plainbody>?</sen:plainbody>
</sen:SendMail>
</soapenv:Body>
</soapenv:Envelope>
Was able to build it to the point of the SendMail
object by following this answer, but when it gets to the part of adding the prefix: <sen:plainbody>
i.e adding the sen
prefix to plainbody
I get the error:
org.w3c.dom.DOMException: NAMESPACE_ERR: An attempt is made to create or change an object in a way which is incorrect with regard to namespaces.
The SendMail
object looks like this:
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(
name = "",
propOrder = {"from", "displayname", "to", "cc", "bcc", "htmlbody", "plainbody", "subject", "imageurl"}
)
@XmlRootElement(
name = "SendMail"
)
public class SendMail {
protected String from;
protected String displayname;
protected String to;
protected String cc;
protected String bcc;
protected String htmlbody;
protected String plainbody;
protected String subject;
protected String imageurl;
public SendMail() {
}
.
.
.
//getters and setters
I'm guessing maybe it's because the plainbody and other fields there are String?
Is there any way around this?
Thank you!