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 Dennis Carroll <De...@DOT.STATE.MN.US> on 2002/07/31 22:20:54 UTC
java2wsdl - javax.activation.DataHandler cannot be converted
into an xml schema type
Hi
I have a service that sends e-mail with attachments and am trying to generate a WSDL using java2wsdl. The attachments are sent using a data type of ns1:DataHandler.
running
org.apache.axis.wsdl.Java2WSDL
produces
Jul 31, 2002 3:17:22 PM org.apache.axis.wsdl.fromJava.Types isBeanCompatible
SEVERE: The class javax.activation.DataHandler is defined in a java or javax package and cannot be converted into an xml schema type. An xml schema anyType will be used to define this class in the wsdl file.
Is this impossible with this version (Beta3) of Axis?
Here is the client code that works:
call.setTargetEndpointAddress( new URL(opts.getURL()) ); //Set the target service host and service location,
call.setOperationName(new QName("MailService","postMail") ); //This is the target services method to invoke.
QName qnameAttachment = new QName("MailService", "DataHandler");
if (filename != null)
call.registerTypeMapping(attachments[0].getClass(),//Add serializer for attachment.
qnameAttachment,
JAFDataHandlerSerializerFactory.class,
JAFDataHandlerDeserializerFactory.class);
call.addParameter( "from", XMLType.XSD_STRING, ParameterMode.IN );
call.addParameter( "to", XMLType.SOAP_ARRAY, ParameterMode.IN );
call.addParameter( "cc", XMLType.SOAP_ARRAY, ParameterMode.IN );
call.addParameter( "subject", XMLType.XSD_STRING, ParameterMode.IN );
call.addParameter( "textMessage", XMLType.XSD_STRING, ParameterMode.IN );
call.addParameter( "source", XMLType.SOAP_ARRAY , ParameterMode.IN ); //Add the file.
call.addParameter( "fileNames", XMLType.SOAP_ARRAY, ParameterMode.IN );
call.setReturnType(XMLType.XSD_STRING);
call.setUsername( opts.getUser());
call.setPassword( opts.getPassword() );
Object ret = null;
try {
ret = call.invoke( new Object[] { from , to, cc, subject, message, attachments, fileNames } ); //Add the attachment.
} catch (AxisFault af) {....}
Here is the call to java2wsdl
java -classpath ".;%_CP%" org.apache.axis.wsdl.Java2WSDL -o MailService.wsdl -l"http://localhost:8080/axis/services/MailService" -n "urn:PostMail" -p"samples.mail" "MailService" samples.mail.PostMail