WebService Correct Serializing
WebService Correct Serializing
- Subject: WebService Correct Serializing
- From: Ute Hoffmann <email@hidden>
- Date: Tue, 6 Jan 2004 11:31:15 +0100
Hi,
Perhaps someone can help me with this, please, as I'm completely
stuck...
I have a WO App providing a webservice. Here is the interesting part of
the generated wsdl:
- <complexType name="Minfoterminal">
- <complexContent>
- <extension base="tns2:EOGenericRecord">
- <sequence>
<element name="bild" nillable="true" type="xsd:string" />
<element name="bildbreite" nillable="true" type="xsd:string" />
<element name="bildhoehe" nillable="true" type="xsd:string" />
<element name="bildtemplate" nillable="true" type="xsd:string" />
<element name="kurzinfo" nillable="true" type="xsd:string" />
<element name="template" nillable="true" type="xsd:string" />
<element name="ueberschrift" nillable="true" type="xsd:string" />
</sequence>
</extension>
</complexContent>
</complexType>
And this is the Class which I wrote with the halp of the amazon example
to get the values into the Client:
// Minfoterminal.java
// Created on Tue Nov 18 11:29:19 Europe/Berlin 2003 by Apple EOModeler
Version 5.2
import com.webobjects.foundation.*;
import com.webobjects.appserver.*;
import org.apache.axis.description.ElementDesc;
import org.apache.axis.description.FieldDesc;
import org.apache.axis.description.TypeDesc;
import javax.xml.namespace.QName;
public class Minfoterminal extends Object {
private static TypeDesc typeDesc = new TypeDesc(Minfoterminal.class);
public String bild;
public String bildbreite;
public String bildhoehe;
public String bildtemplate;
public String kurzinfo;
public String template;
public String ueberschrift;
static {
FieldDesc field = new ElementDesc();
field.setFieldName("bild");
field.setXmlName(new QName("", "Bild"));
typeDesc.addFieldDesc(field);
field = new ElementDesc();
field.setFieldName("bildbreite");
field.setXmlName(new QName("", "Bildbreite"));
typeDesc.addFieldDesc(field);
field = new ElementDesc();
field.setFieldName("bildhoehe");
field.setXmlName(new QName("", "Bildhoehe"));
typeDesc.addFieldDesc(field);
field = new ElementDesc();
field.setFieldName("bildtemplate");
field.setXmlName(new QName("", "Bildtemplate"));
typeDesc.addFieldDesc(field);
field = new ElementDesc();
field.setFieldName("kurzinfo");
field.setXmlName(new QName("", "Kurzinfo"));
typeDesc.addFieldDesc(field);
field = new ElementDesc();
field.setFieldName("template");
field.setXmlName(new QName("", "Template"));
typeDesc.addFieldDesc(field);
field = new ElementDesc();
field.setFieldName("ueberschrift");
field.setXmlName(new QName("", "Ueberschrift"));
typeDesc.addFieldDesc(field);
};
public static TypeDesc getTypeDesc() {
return typeDesc;
}
public Minfoterminal() {
super();
}
public void setBild(String aBild) {
bild = aBild;
}
public String getBild() {
return bild;
}
public void setBildbreite(String aBildbreite) {
bildbreite = aBildbreite;
}
public String getBildbreite() {
return bildbreite;
}
public void setBildhoehe(String aBildhoehe) {
bildhoehe = aBildhoehe;
}
public String getBildhoehe() {
return bildhoehe;
}
public void setBildtemplate(String aBildtemplate) {
bildtemplate = aBildtemplate;
}
public String getBildtemplate() {
return bildtemplate;
}
public void setKurzinfo(String aKurzinfo) {
kurzinfo = aKurzinfo;
}
public String getKurzinfo() {
return kurzinfo;
}
public void setTemplate(String aTemplate) {
template = aTemplate;
}
public String getTemplate() {
return template;
}
public void setUeberschrift(String aUeberschrift) {
ueberschrift = aUeberschrift;
}
public String getUeberschrift() {
return ueberschrift;
}
public String toString() {
StringBuffer buff = new StringBuffer(1000);
buff.append(getUeberschrift());
buff.append("\n");
buff.append(getKurzinfo());
buff.append("\n");
return buff.toString();
}
}
This is the invoking Action:
public Minfoterminal invokeWebService() {
// try {
WOWebServiceClient client = getClient();
Object retval = null;
registerSerializersForClient(client);
Object[] parameters = {
new Integer(1)
};
retval =
client.invoke((String)client.serviceNames().objectAtIndex(0),
"ausgabe", parameters);
return (Minfoterminal)retval;
/* } catch (Exception ex) {
return null;
}*/
}
And this is the Exception I cannot get rid of which comes up when I
invoke the Webservice:
Error: java.lang.ClassCastException:
com.webobjects.webservices.support.xml.WOStringKeyMap
Reason: com.webobjects.webservices.support.xml.WOStringKeyMap
I suppose my error is very straightforward... I suppose I did something
wrong in the Minfoterminal Class. What is the meaning of extension
base="tns2:EOGenericRecord"?
If Minfoterminal extends EOGenericRecord in place of Object the
exception stays the same.
Sorry for bothering you again with this basic question.
Regards,
Ute
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.