Hi,
I am having trouble consuming a web service. The function I am calling is of the form: retrieveXMLFile(Datahandler dh,
String name, Date startDate, Date endDate);
I pass a file datasource as a datahandler of the form: DataHandler dh = new DataHandler(new FileDataSource("d:/test.xml"));
But I receive the following error message:
faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
faultSubcode:
faultString: java.io.IOException: End of stream encountered before final boundary marker.
I am new to web services and only received a WSDL file. I used this to create artifacts in Eclipse.
My code is as follows:
public class
test {
test(){
try {
FICCFileEndPoint fep = new FICCFileEndPointServiceLocator().getFICCWS();
Stub stub = (Stub)fep;
stub.setUsername("username");
stub.setPassword("password");
String add = new FICCFileEndPointServiceLocator().getFICCWSAddress();
DataHandler dh = new DataHandler(new FileDataSource("d:/test.xml"));
String
pattern = "yyyy-MM-dd'T'HH:mm:ss";
String date1 = "2012-08-03T00:00:01";
String date2 = "2012-08-03T23:59:59";
SimpleDateFormat pDate1 = new SimpleDateFormat(pattern);
Date startDate = pDate1.parse(date1);
Date endDate = pDate1.parse(date2);
Calendar cStartDate = Calendar.getInstance();
Calendar cEndDate = Calendar.getInstance();
cStartDate.setTime(startDate);
cEndDate.setTime(endDate);
System.out.print(cStartDate);
System.out.print(cEndDate);
Object obj = fep.retrieveXMLFile(dh, "Acumen - Acuity One Fund", startDate, endDate);
OutputStream out = null;
try {
out = new FileOutputStream("d:/testout.xml");
} catch (FileNotFoundException e) {
e.printStackTrace();
}
try {
dh.writeTo(out);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
try {
out.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
catch (ServiceException e) {
e.printStackTrace();
}
catch (RemoteException e) {
e.printStackTrace();
} catch (java.text.ParseException e) {
e.printStackTrace();
}
}
/**
* @param args
*/
public static void main(String[] args) {
new test();
}
}