You are viewing a plain text version of this content. The canonical link for it is here.
Posted to soap-dev@ws.apache.org by Jacinta Remedios <ja...@opennms.org> on 2000/10/04 16:10:09 UTC
Soap BodyEntries??
Hi,
I am using Apache SOAP API for Java...
I was able to get the SOAP Envelope structure as follows:
[Attributes={ xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w
3.org/1999/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/1999/XMLSchema"}] [Header=[Attributes={}
] [HeaderEntries={}]] [Body=[Attributes={}] [BodyEntries=
[(0)= value]
]] [EnvelopeEntries=]
Well, I want to add name-value pairs such as id:"jacinta" , passwd:"pwd"
There is a method in class org.apache.soap.Body:
void setBodyEntries(java.util.Vector bodyEntries )
My doubt is that when I do the following:
vtBody = new Vector();
vtBody.add("id: jacinta");
sbody.setBodyEntries((Vector)vtBody);
I get the following the following envelope structure
[Attributes={ xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w
3.org/1999/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/1999/XMLSchema"}] [Header=[Attributes={}
] [HeaderEntries={}]] [Body=[Attributes={}] [BodyEntries=
[(0)=id: jacinta]
]] [EnvelopeEntries=]
and when I try to send this structure using SOAPHTTPConnection class' send :
sendTo = new URL ("http://localhost:8080/examples/servlet/soapimp");
action = "";
soapHttpConnection.send(sendTo,
"",
new Hashtable(),
envelope,
new SOAPMappingRegistry());
I get an exception
java.lang.ClassCastException
at org.apache.soap.Body.marshall(Body.java, Compiled Code)
at org.apache.soap.Envelope.marshall(Envelope.java, Compiled Code)
at
org.apache.soap.transport.http.SOAPHTTPConnection.send(SOAPHTTPConnection.ja
va:100)
Can anyone help me solve this problem
If possible can anyone help me set the vector for BodyEntries ?
If I do not set the SOAP Body Entries Vector, I am able to successfully
receive at the server the following structure generated by the SOAP API...
<SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xm
lns:xsi="http://www.w3.org/1999/XMLSchema-instance"
xmlns:xsd="http://www.w3.org
/1999/XMLSchema">
<SOAP-ENV:Body>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
Is there an alternate way to set name/value pairs?
Awaiting a reply at the earliest
Regards,
Jacinta