Highlighted
Absent Member.. Absent Member..
Absent Member..
553 views

Add attachments via web service for Request

Jump to solution

Hello,

 

I've recently been trying to get attachements to SM 9.40 using web services, more specifically i've been trying to upload attachements using the RequestManagement.wsdl. 

Given a certain request ID , I want to be able to attach a file in PDF format to that request.

Here is the code i'm using (C#):

 

 

public UpdateRMResponse SendFiles(string RequestID, ObservableCollection<FilesToSend> fileList)
        {
            UpdateRMRequest request = new UpdateRMRequest();
            UpdateRMResponse response = new UpdateRMResponse();

            RMInstanceType instance = new RMInstanceType();
            RMModelType model = new RMModelType();
            RMKeysType keys = new RMKeysType();
            RequestManagement manage = new RequestManagement();

            manage.Credentials = new NetworkCredential("minduser", "minduser");

            StringType requestID = new StringType();
            requestID.Value = RequestID;
            
            AttachmentType[] attachArray = new AttachmentType[fileList.Count];

            for(int i = 0; i < fileList.Count; i++)
            {
                attachArray[i] = new AttachmentType();
                attachArray[i].name = fileList[i].fileName;
                attachArray[i].len = fileList[i].size;
                attachArray[i].lenSpecified = true;
                attachArray[i].type = "application/pdf";
                attachArray[i].contentType = "application/pdf";
                attachArray[i].Value = fileList[i].bytes;
                attachArray[i].action = "add";
            }

            instance.recordid = requestID.Value;
instance.attachements = attachArray; keys.Number = requestID; model.keys = keys; model.instance = instance; request.model = model; request.attachmentData = true; request.attachmentDataSpecified = true; request.ignoreEmptyElements = true; request.attachmentInfo = true; request.attachmentInfoSpecified = true; try { response = manage.UpdateRM(request); } catch (Exception ex) { response.message = ex.Message; } return response; }

Now I can update any fields just fine, the problem is when I try sending files.

I get the response from server Success but checking the record and the actual resposne object reveals that no file was actually sent. 

I've tried using SOAP UI and got the same result, tried to follow the Axis2 example which is written in java, but they do kinda what I do in my code. 

I'm quite stuck with this and could really use some insight into what exactly i'm missing here.

 

Thank you and have a nice day !

Tags (1)
0 Likes
1 Solution

Accepted Solutions
Highlighted
Absent Member.. Absent Member..
Absent Member..

Re: Add attachments via web service for Request

Jump to solution

After some more searching i managed to upload small files, but anything over 15 MB will fail to upload with the following message:

 

Message = "Client found response content type of 'text/html;charset=utf-8', but expected 'text/xml'.\r\nThe request failed with the error message:\r\n--\r\n<html><head><title>Apache Tomcat/6.0.41 - Error report</title><style><!--H1 {font-family:Tahoma,Arial,sans-seri...

View solution in original post

0 Likes
3 Replies
Highlighted
Absent Member.. Absent Member..
Absent Member..

Re: Add attachments via web service for Request

Jump to solution

After some more searching i managed to upload small files, but anything over 15 MB will fail to upload with the following message:

 

Message = "Client found response content type of 'text/html;charset=utf-8', but expected 'text/xml'.\r\nThe request failed with the error message:\r\n--\r\n<html><head><title>Apache Tomcat/6.0.41 - Error report</title><style><!--H1 {font-family:Tahoma,Arial,sans-seri...

View solution in original post

0 Likes
Highlighted
Absent Member.. Absent Member..
Absent Member..

Re: Add attachments via web service for Request

Jump to solution

Hi,


How have you solved the problem?


I have the same problem, I try upload attachements on IncidentManagements and I get the response from server Success and upload all labels except attachments.


Can you help me?

0 Likes
Highlighted
Frequent Contributor.
Frequent Contributor.

Re: Add attachments via web service for Request

Jump to solution

Got any solution for adding attachment via soap to an existing incident?

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.