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 Jacinta Remedios <ja...@opennms.org> on 2000/10/12 00:35:35 UTC

how to use setbodyentries()?

Hello,

How can I eliminate this error?

env [Attributes={ xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:SOAP-ENV:encoding
Style="http://129.1.1.33/xerces-docs/event.schema"
xmlns:xsi="http://www.w3.org/1999/XMLSchema-insta
nce" xmlns:xsd="http://www.w3.org/1999/XMLSchema"}] [Header=[Attributes={}]
[HeaderEntries={}]] [Bod
y=[Attributes={}] [BodyEntries=
[(0)=SOAPBean@3d0108]
]] [EnvelopeEntries=]
before send
SOAPStructure : [SOAPException: faultCode=SOAP-ENV:Client; msg=Body entries
must implement the Seria
lizer interface.; targetException=java.lang.IllegalArgumentException: Body
entries must implement th
e Serializer interface.]
[SOAPException: faultCode=SOAP-ENV:Client; msg=Body entries must implement
the Serializer interface.
; targetException=java.lang.IllegalArgumentException: Body entries must
implement the Serializer int
erface.]
        at
org.apache.soap.transport.http.SOAPHTTPConnection.send(SOAPHTTPConnection.ja
va:115)
        at SOAPStructure.sendSoapStructure(SOAPStructure.java:183)
        at SOAPStructure.sendOut(SOAPStructure.java:82)
        at SOAPStructure.main(SOAPStructure.java:258)



I want to simply set a the bean to (Class.forName("java.lang.String"),
"<log></log>"))
How do I implement the marshall method of interface serializer?
Please gimme an example if you can or an alternate method of setting the
body entries (to send the string across using the send() of
SOAPHTTPConnection).

This is the SOAPBean class, whose object is set to each element of
bodyvector.

public class SOAPBean extends org.apache.soap.util.Bean implements
org.apache.soap.util.xml.Serializer
{
	SOAPBean(Class type, Object value)
	{
		super(type, value);
	}

	public void marshall(
					String inScopeEncStyle,
					Class javaType,
					Object src,
                       		Object context,
					Writer sink,
					NSStack nsStack,
                       		XMLJavaMappingRegistry xjmr) throws
IllegalArgumentException, IOException
	{
		String tmp = (String)value;
		try
		{
			sink.write(tmp);
		}
		catch(IOException e)
		{
			e.printStackTrace();
		}
	}
}



Thanks,
Jacinta