Hi,
I am trying to add an attachment in the request via web service call createAttachement but when i try to run the SOAP request,it give me an error "policy limit exceeded".
I have modified the NX_ROOT\samples\sdk\websvc\java\test3_attachments\create_attachment.java file. but still not working. i have added the following:
FileDataSource fds = new FileDataSource(filename);
DataHandler dhandler = new DataHandler(fds);
CA SDM._setProperty(Call.ATTACHMENT_ENCAPSULATION_FORMAT,
Call.ATTACHMENT_ENCAPSULATION_FORMAT_DIME);
CA SDM.addAttachment(dhandler);
String handle = CA SDM.createAttachment(sid, repHandle, objHandle,
description, filename);
import javax.xml.rpc.holders.StringHolder;
import javax.activation.DataHandler;
import javax.activation.FileDataSource;
import org.apache.axis.client.Call;
import org.apache.axis.AxisFault;
import com.ca.www.UnicenterServicePlus.ServiceDesk.*;
public class create_attachment
{
public create_attachment()
{
String endpoint = "http://localhost:8080/axis/services/USD_R11_WebService";
String username = "ServiceDesk";
String password = "ServiceDesk";
String filename = "./test_upload_file.txt";
String ServiceDeskDocumentRepository = "doc_rep:1002";
try
{
USD_WebServiceLocator ws = new USD_WebServiceLocator();
java.net.URL url = new java.net.URL(endpoint);
USD_WebServiceSoap usd = ws.getUSD_WebServiceSoap(url);
int sid = usd.login(username, password);
System.out.println("\nSID: " + sid);
String custHandle = usd.getHandleForUserid(sid, username);
System.out.println("Handle for '" + username + "' is: " + custHandle);
ArrayOfString attrVal = new ArrayOfString();
attrVal.setString(new String[]{
"customer", custHandle,
"description", "Request created for a createAttachment() test"});
ArrayOfString attr = new ArrayOfString();
attr.setString(new String[0]);
ArrayOfString prop = new ArrayOfString();
prop.setString(new String[0]);
StringHolder newRequestHandle = new StringHolder();
StringHolder newRequestNumber = new StringHolder();
String result;
result = usd.createRequest(sid, "", attrVal, prop, "", attr, newRequestHandle, newRequestNumber);
System.out.println("Created Request: " + newRequestNumber.value + ", Handle: " + newRequestHandle.value);
FileDataSource fds = new FileDataSource(filename);
DataHandler dhandler = new DataHandler(fds);
CA SDM._setProperty(Call.ATTACHMENT_ENCAPSULATION_FORMAT,Call.ATTACHMENT_ENCAPSULATION_FORMAT_DIME);
CA SDM.addAttachment(dhandler);
String handle = CA SDM.createAttachment(sid, repHandle, objHandle,description, filename);
String attmntHandle = usd.createAttachment(sid, ServiceDeskDocumentRepository, newRequestHandle.value, "createAttachment test file", filename);
if (attmntHandle.length() > 0)
System.out.println("\nSuccessfully uploaded the file to the Request, attachment handle: " + attmntHandle + "\n");
usd.logout(sid);
}
catch (AxisFault af)
{
System.out.println("...AxisFault...");
System.out.println(af.toString());
}
catch(Exception e)
{
e.printStackTrace();
}
}
static public void main(String[] argv)
{
new create_attachment();
}
}
How it can be resolved?
Thanks,