You are viewing a plain text version of this content. The canonical link for it is here.
Posted to soap-user@xml.apache.org by EnricoTriolo <et...@libero.it> on 2000/11/30 16:58:09 UTC
SOAP "datagram"
Does anybody know how can I create and send a simple SOAP "datagram", something like:
<SOAP-ENV:Envelope xmlns:....>
<SOAP-ENV:Body>
<user>
<name value="..."/>
<address value="..."/>
</user>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
Since now, I only succeded in creating the envelope and the body, but I can't add any element to the body!
I don't want to use SOAP as an RPC right now, so I don't either want to use the RPCRouter...
Here's the code I've written till now:
Envelope e = new Envelope();
Body b = new Body();
Header h = new Header();
Vector be = new Vector();
DocumentImpl doc = new DocumentImpl();
ElementImpl entry = new ElementImpl(doc, "user");
TextImpl entrydata = new TextImpl(doc, "name");
entry.appendChild(entrydata);
be.addElement(new Bean(ElementImpl.class, entry));
b.setBodyEntries(be);
e.setBody(b);
e.setHeader(h);
SOAPTransport t = new SOAPHTTPConnection();
URL u = new URL("http://localhost:8080/SLS/servlet/SLSServlet");
t.send(u, "", null, e, new SOAPMappingRegistry());
I know that I need an object implementing Serializer as the Bean constructor argument, but I don't know where to find it or how to implement the marshall method!
Thanks,
Enrico