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>",

 

  • , 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.

  • Hi  

    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   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