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 fi...@utimaco.be on 2001/04/10 17:49:13 UTC
How can I add more than one element to the soap request?
Hi
I tried to use the call method to send a request with more than one
parameter, but when I add different elements to a Vector and than add that
Vector to the call by setParams(Vector). The error I get looks as follows:
Exception in thread "main" java.lang.ClassCastException:
org.apache.xerces.dom.ElementImpl
at
org.apache.soap.rpc.RPCMessage.serializeParams(RPCMessage.java:326)
at org.apache.soap.rpc.RPCMessage.marshall(RPCMessage.java:307)
at org.apache.soap.Body.marshall(Body.java:145)
at org.apache.soap.Envelope.marshall(Envelope.java:195)
at soaptest.main(soaptest.java:128)
The code I wrote looks as follows:
//to create a xml tree with the parameters
XMLParserLiaison xpl = new XercesParserLiaison();
Document doc = xpl.createDocument();
Element header = doc.createElement("header");
Element mrequest = doc.createElement("mUSTRequest");
Element user = doc.createElement("userID");
user.appendChild(doc.createTextNode("beb"));
Element algo = doc.createElement("algorithmID");
algo.appendChild(doc.createTextNode("SHA_B64_PADDING"));
Element transaction = doc.createElement("transactionID");
transaction.appendChild(doc.createTextNode
("dlmfkmflkeffzefzefzefzef"));
header.appendChild(transaction);
mrequest.appendChild(user);
mrequest.appendChild(algo);
Vector entries = new Vector();
entries.addElement(header);
entries.addElement(mrequest);
// the call itself
Call call = new Call();
call.setSOAPTransport(st);
call.setTargetObjectURI("urn:mUST");
call.setMethodName("mUSTGetStrongPassword");
call.setEncodingStyleURI(Constants.NS_URI_SOAP_ENC);
call.setParams(entries);
afterr this when I invoke the call I get the error. I also tried the
following to add parameters, but I got the same error
Vector total = new Vector();
Vector head = new Vector();
Vector request = new Vector();
head.addElement(new Parameter("header", Vector.class,
transaction, null));
request.addElement(new Parameter("mUSTRequest", Vector.class, req, null));
total.addElement(head);
total.addElement(request);
call.setParams(total);
Any comment or help is welcome.
Greetings
Met vriendelijke groeten,
Utimaco Safeware Belgium - Securing the information highway.
Filip Van Praet
Research Engineer
Tel. +32 (0)16 440135
Fax. +32 (0)16 440140
mailto:filip.vanpraet@utimaco.be
Internet http://www.utimaco.com
---------------------------------------------------------------------
To unsubscribe, e-mail: soap-user-unsubscribe@xml.apache.org
For additional commands, email: soap-user-help@xml.apache.org