You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Rolando Pablos Sánchez <rp...@tid.es> on 2003/01/17 14:43:36 UTC
Skeleton problem
I am been doing a service program that sends an attachment. I used the DataHandler for the attachment param.
But now I have done my own class and de/serializers for this class. I did this because I need extra attributes, apart of href, in my attachment element and Axis cannot do it, as far I know.
The client serializes correctly but in the server I get:
No such operation "SendAttachment"
I only modified the skeleton in the param description to put my class:
new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("", "Content"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("urn:myAttachment", "Attach_attr"), myAttachment.Attach_attr.class, false, false),
and besides I modified the my param method interface to use the new class.
I don't know how the skeleton works, so I don´t know what I have done incorrectly.
Please, if you know how to do it or you have experience with deserializers, let me know.
below my class and deserializer:
//MY CLASS
package myAttachment;
class Attach_attr {
public String at1;
public String at2;
public javax.activation.DataHandler attachment;
public Attach_attr(String at1, String at2, javax.activation.DataHandler attachment) {
//copia de los argumentos
this.at1 = at1;
this.at2 = at2;
this.attachment = attachment;
}
}
////DESERIALIZER
package myAttachment;
import org.apache.axis.encoding.DeserializationContext;
import org.apache.axis.encoding.Deserializer;
import org.apache.axis.encoding.DeserializerImpl;
import org.apache.axis.encoding.FieldTarget;
import org.apache.axis.Constants;
import org.apache.axis.message.SOAPHandler;
import org.apache.axis.attachments.AttachmentPart;
import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
import javax.xml.namespace.QName;
import java.util.Hashtable;
public class Attach_attr_Deser extends DeserializerImpl
{
public Attach_attr_Deser() {
}
/** DESERIALIZER STUFF - event handlers
*/
/**
* This method is invoked when an element start tag is encountered.
* @param namespace is the namespace of the element
* @param localName is the name of the element
* @param prefix is the element's prefix
* @param attributes are the attributes on the element...used to get the type
* @param context is the DeserializationContext
*/
public void StartElement(String namespace,
String localName,
String prefix,
Attributes attributes,
DeserializationContext context)
throws SAXException
{
String at1 = attributes.getValue("","att1");
String at2 = attributes.getValue("","att2");
String cid = attributes.getValue("","href");
try {
AttachmentPart ap = (AttachmentPart)context.getMessageContext().getCurrentMessage().getAttachmentsImpl().getAttachmentByReference(cid);
value = new Attach_attr(at1,at2,ap.getDataHandler());
} catch (Exception e) { throw new SAXException("Error mydeserializer"+e);}
}
}