I implemented a web service that takes an org.codehaus.xfire.attachments.Attachment as a parameter. I used the web service explorer to view this web service and all seemed well, but I couldn’t test this method because I see no way of attaching a file through the explorer.
I decided to use the web service client wizard so that I could attach a file and test with, but ran into a problem when generating the code. Any thoughts of wisdom?
src-resolve. 4.2: Error resolving component ‘ns1:Attachment’. It was detected that ‘ns1:Attachment’ is in namespace ‘http://attachments.xfire.codehaus.org’, but components from this namespace are not referenceable from schema.
My web service method is a snippet I found on another post in these forums.
public String testAttachment(Attachment file) {
try {
MessageContext ctx = AbstractInvoker.getContext();
AttachmentUtil util = new AttachmentUtil();
Attachment attachment = util.getAttachment(file.getId(), ctx
.getInMessage());
DataHandler handler = attachment.getDataHandler();
InputStream input = handler.getInputStream();
// read the attachment from the input...
return "Found " + input.available() + " bytes.";
} catch (Exception ex) {
return ex.getMessage();
}
}
MyEclipse Enterprise Workbench
Version: 6.0.1 GA
Build id: 6.0.1-GA-200710