cancel
Showing results for 
Search instead for 
Did you mean: 

Get pdf file from soap webservice attachment

Hi Team,

I am trying to get a pdf file using soap 1.2 webservices. when I am using the service in SOAP UI it works fine but when I am using a code stage to execute the webservice in Blue Prism it returns some unreadable data in text form. Foe eg- "
%PDF-1.5
%￿￿￿￿
1 0 obj
<</Type/Catalog/Pages 2 0 R/Lang(en-US) /StructTreeRoot 8 0 R/MarkInfo<</Marked true>>>>
endobj
2 0 obj
<</Type/Pages/Count 1/Kids[ 3 0 R] >>
endobj
3 0 obj
<</Type/Page/Parent 2 0 R/Resources<</Font<</F1 5 0 R>>/ProcSet[/PDF/Text/ImageB/ImageC/ImageI] >>/MediaBox[ 0 0 612 792] /Contents 4 0 R/Group<</Type/Group/S/Transparency/CS/DeviceRGB>>/Tabs/S/StructParents 0>>
endobj
4 0 obj
<</Filter/FlateDecode/Length 162>>
stream
x￿M￿￿
￿@D￿￿]QA,|$$ ￿￿Ҙ￿￿?k￿￿￿￿3￿￿)￿T￿￿￿JF
o￿￿￿￿B￿A
e￿￿*u#￿￿P￿Hђ￿O ￿￿￿xG￿0L￿￿￿￿Oov"￿a8￿~￿￿NG￿￿￿-~￿￿￿￿%l￿￿￿? +?
endstream
endobj
5 0 obj
<</Type/Font/Subtype/TrueType/Name/F1/BaseFont/ABCDEE+Calibri/Encoding/WinAnsiEncoding/FontDescriptor 6 0 R/FirstChar 32/LastChar 117/Widths 15 0 R>>
endobj
6 0 obj
<</Type/FontDescriptor/FontName/ABCDEE+Calibri/Flags 32/ItalicAngle 0/Ascent 750/Descent -250/CapHeight 750/AvgWidth 521/MaxWidth 1743/FontWeight 400/XHeight 250/StemV 52/FontBBox[ -503 -250 1240 750] /FontFile2 16 0 R>>
endobj
7 0 obj"

Question 1 . Is it possible to get file using VB.net code with soap query?.
question 2 . if yes, then How ?
question 3. If not, Then is there any other way I can use to get the file.

Regards,
Yugal Pratap Singh

------------------------------
Yugal Pratap Singh
Project Engineer
Credit Suisse
Asia/Kolkata
------------------------------
3 REPLIES 3

ewilson
Staff
Staff
Hello @Yugal Pratap Singh,

Can you share some details about how you're invoking the SOAP web service from your Code stage? What .NET objects are you using?

To answer your main question, yes it's possible.

Cheers,​

------------------------------
Eric Wilson
Director, Integrations and Enablement
Blue Prism Digital Exchange
------------------------------

Hi Eric,
Thank You for replying so fast.

This is the code-
'Set and instantiate our working objects
Dim Req As Object
Dim sEnv As String
Dim Resp As Object
'Dim Resp As New MSXML2.DOMDocument60

'Dim Resp As Object
Req = CreateObject("MSXML2.XMLHTTP")
Resp = CreateObject("MSXML2.DOMDocument.6.0")

Req.Open ("Post", RequestURL, False, AuthenticationUsername, AuthenticationPassword)
Req.setRequestHeader ("Content-Type", "application/soap+xml;charset=UTF-8;action="""")
Req.setRequestHeader ("username", AuthenticationUsername)
Req.setRequestHeader ("password", AuthenticationPassword)
sEnv = ""
' we create our SOAP envelope for submission to the Web Service
sEnv = sEnv & "<soap:Envelope xmlns:soap = ""http://www.w3.org/2003/05/soap-envelope"" xmlns:req = "">"


Soap Query


sEnv = sEnv & "</soap:Envelope>"
'MsgBox(sEnv)
' Send SOAP Request
Req.send (sEnv)

' Display results in MessageBox
responseText = Req.responseText

'clean up code
Req = Nothing
Resp = Nothing

I am using ->System.Xml.Serialization,System.Collections.Generic,System.Net,text,webservice,IO,etc name spaces

------------------------------
Yugal Pratap Singh
Associate Consultant
Capgemini
------------------------------

Hi @Yugal Pratap Singh,

Within the Response object there should be a ResponseBody property. If all that's being returned to you is the PDF you should be able to take the content from ResponseBody and perform a binary write straight to disk (or pass it back to the calling process as a Binary data item). There's an example on this page although it's not the best I think.

Cheers,


------------------------------
Eric Wilson
Director, Integrations and Enablement
Blue Prism Digital Exchange
------------------------------