Highlighted
Regular Contributor.
Regular Contributor.
81 views

I need to upload an image through XMLFile Upload Using SOAP request

I need to upload an image through XML

Able to create a record, however image file is not getting uploaded.

Tried adding the file to extra files and given path in below tag

"<documentPrimaryFileContent>{P_Filepath}</documentPrimaryFileContent>"

let me know is there any way to upload the image as well

below is XML

soap_request("StepName=SOAP Request",
"URL=https://hostname.com/ws/document",
"SOAPEnvelope="
"<soap:Envelope xmlns:soap=\"http://www.w3.org/2003/05/soap-envelope\" xmlns:wsdl=\"http://service.abc.compname.com/2015/10/wsdl\">"
"<soap:Header></soap:Header>"
"<soap:Body>"
"<wsdl:CheckinRequest>"
"<ApplicationArea>"
"<Version>?</Version>"
"<CreateTime>?</CreateTime>"
"<ReferenceNumber>?</ReferenceNumber>"
"<ResponseMethod>?</ResponseMethod>"
"<MsgStatus>?</MsgStatus>"
"<SourceSystemHostName>?</SourceSystemHostName>"
"<TargetSystem>?</TargetSystem>"
"<Environment>?</Environment>"
"</ApplicationArea>"
"<DataArea>"
"<IdCService>CHECKIN_UNIVERSAL</IdCService>"
"<documentName>TS_Dname_3</documentName>"
"<documentAuthor>authorname</documentAuthor>"
"<documentType>Image</documentType>"
"<documentSecurityGroup>Assets</documentSecurityGroup>"
"<documentTitle>TS_Title_3</documentTitle>"
"<documentAccount></documentAccount>"
"<documentPrimaryFile>TS_Image3.jpg</documentPrimaryFile>"
//"<documentLocation>C:\\Test\\2MB.jpg</documentLocation>"
"<documentPrimaryFileContent>{P_Filepath}</documentPrimaryFileContent>"
//"<documentPrimaryFileContent=\"file\">C:\\Test\\2MB.jpg</documentPrimaryFileContent>"
"<documentFileCopy>false</documentFileCopy>"
"<documentFormat>image/jpg</documentFormat>"
"</DataArea>"
"</wsdl:CheckinRequest>"
"</soap:Body>"
"</soap:Envelope>",

 

0 Likes
2 Replies
Highlighted
Acclaimed Contributor.. Acclaimed Contributor..
Acclaimed Contributor..

Re: I need to upload an image through XMLFile Upload Using SOAP request

@jagadeeswara19k, specify a file name in an XML message is by LR just seen as data that needs to be sent to the server. LR does not analyze the XML for extra activity. Each XML use a different specification.

But check the help on soap_request() in VuGen (Tip: put cursor on function name and press F1).

In the function help a remark is found on Attachments. Examine and experiment with it.

Success, Erik

P.S. I checked the help of LR 2020.0.

Signature:
Reward community members who take time to respond and help.
0 Likes
Highlighted
Micro Focus Frequent Contributor
Micro Focus Frequent Contributor

Re: I need to upload an image through XMLFile Upload Using SOAP request

Hi @jagadeeswara19k 

Frist of all, you need to understand how does your soap application upload the the image file.

I mean, it will not only send an xml with SOAPEnvelop, but also send the binary data with MTOM or anyother multipart protocol.

For example, if I send a image with MTOM, the request body may be below

--uuid:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx

Content-Id: <rootpart*xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx@example.com>
Content-Type: application/xop+xml;charset=utf-8;type="text/xml"
Content-Transfer-Encoding: binary
<?xml version="1.0" ?>
...
</S:Envelope>
--uuid:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
Content-Id: <xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx@example.com>
Content-Type: image/png
Content-Transfer-Encoding: binary
(Binary data here)FFFFFFFFFFFF.............

 

As @JHF Remmelzwaal  has explained, you only specify a file name in an XML, not really upload the brinay data. That's the root cause.

 

Regards,

Wei-Wei Zhang

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.