Skip to main content

Issue with Axis WS methods

1 reply [Last post]
vaishakh_hegde
Offline
Joined: 2010-08-12

Hi,
I have written a web service, which accepts two strings as parameter(echoService method). And created WSDD file for the same and it works fine. Then I created a webservice which supports attachments, this code also works fine. When I merge this two WebServices and try to invoke "echoService" from client code, I am getting the following error.

java.io.IOException: Type {ElementService}DataHandler is referenced but not defined.

I assume, its the problem with the wsdd file "typeMapping". Please let me know if I am right or wrong? Also let me know the solution for the same.

Regards,
Vaishakh

Code is below:

ElementService.java (Web Service Code)

public class ElementService {

public String echoService(String command, String data) {
System.out.println("Echo Service [" + command + "] Data [" + Data + "]");
return "Success;
}

public Object getDimeData(DataHandler dh) throws InputValidationException, AttachmentServiceException {
MessageContext msgContext = MessageContext.getCurrentContext();
Message rspmsg = msgContext.getResponseMessage();
log.info("org.apache.axis.attachments.Attachments.SEND_TYPE_DIME : " + org.apache.axis.attachments.Attachments.SEND_TYPE_DIME);
int inputAttachmentType = rspmsg.getAttachmentsImpl().getSendType();
log.info("inputAttachmentType : " + inputAttachmentType);
if (inputAttachmentType != Attachments.SEND_TYPE_DIME) {
String failMsg = "Attachment passed is not a DIME attachment, please check.";
throw new InputValidationException("Invalid input data error : " + failMsg);
}

String inputStr = getInputString(dh);

//Do some process with the input String and construct an output String.
//Since the processing is out of context for our disucussion,
//just an output xml String from a file is returned.
String result = null;
try {
result = "Successfully Read the input file";
} catch (IOException e) {
String errorMsg = "Error occured while sending the output xml in DIME format.";
log.error(errorMsg, e);
throw new AttachmentServiceException(errorMsg, e);
}
log.info("setting the DIME type of attachment as the sender sends it as DIME.");
rspmsg.getAttachmentsImpl().setSendType(org.apache.axis.attachments.Attachments.SEND_TYPE_DIME);

ByteArrayDataSource dataSource = new ByteArrayDataSource(result, "UTF-8");
dh = new DataHandler(dataSource);
return dh;
}
}

deploy.wsdd file

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
chrisadam2
Offline
Joined: 2010-09-07

Axis is essentially a SOAP engine -- a framework for constructing SOAP processors such as clients, servers, gateways, etc. The current version of Axis is written in Java, but a C++ implementation of the client side of Axis is being developed.

_______________________________________

Want to get-on Google's first page and loads of traffic to our website? Hire a SEO Specialist from Ocean Groups[url=http://oceangroups.org/] seo specialist [/url]