Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > VB How-To
|
VB How-To Ask your "How do I do this with VB?" questions in this forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 15th, 2005, 04:52 PM
Authorized User
 
Join Date: Oct 2003
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
Default how to return binary from web service

Hi everyone

I need to return a binary stream from a web service which is a PDF file. And, the kicker, I have to do it using Visual Basic 6.

Does anyone have a resource I can tap for this? I can get the response working properly but I can't figure out how to get it out of the binary stream.

Any help is great.

Thanks!

"A spirit with a vision is a dream with a mission"
__________________
\"A spirit with a vision is a dream with a mission\"
 
Old August 15th, 2005, 05:43 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 627
Thanks: 0
Thanked 0 Times in 0 Posts
Default

if your stream is in a string, try this:

dim b as byte[]
b = StringFromPDF

Marco
 
Old August 16th, 2005, 10:19 AM
Authorized User
 
Join Date: Oct 2003
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
Default

dim b as byte[] shows an "expected end of statement error".

"A spirit with a vision is a dream with a mission"
 
Old August 16th, 2005, 12:25 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 627
Thanks: 0
Thanked 0 Times in 0 Posts
Default

sorry I am messing up VB6 with C# (the language I currently use), and I created a language of my own :)

This is in VB6 (this time I tested it)

dim b() as byte
b = "This is a string"

Marco
 
Old August 23rd, 2005, 02:39 PM
Authorized User
 
Join Date: Oct 2003
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
Default

This is being sent as an attachment. I think we have to do other manipulation here. Any insight?

"A spirit with a vision is a dream with a mission"
 
Old August 23rd, 2005, 04:52 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 627
Thanks: 0
Thanked 0 Times in 0 Posts
Default

which attachment?
Marco
 
Old August 24th, 2005, 07:44 AM
Authorized User
 
Join Date: Oct 2003
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
Default

The PDF is sent as what appears to be a MIME attachment. I can get a response but I need some help figuring out how to parse the attachment on the end of the response into a PDF.

This is the XML part of the response:
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><soapenv:Body><getFileNamedResponse xmlns="http://presentment.docucorp.ib.mycompany.com"><getFileNam edReturn href="cid:F573BFC87EB8C37A61865B6CB3878528" xmlns:apachesoap="http://xml.apache.org/xml-soap"/></getFileNamedResponse></soapenv:Body></soapenv:Envelope>

And this is the Attachment part of the response

------=_Part_3_1439847890.1124402317089
Content-Type: application/pdf
Content-Transfer-Encoding: binary
Content-Id: <F573BFC87EB8C37A61865B6CB3878528>

%PDF-1.3
%âãÏÓ
    11 0 obj<</Linearized 1/L 9768/H[ 659 295]/O 13/E 8627/N 1/T 9501>>
endobj

xref
    11 17
0000000016 00000 n [truncated]

"A spirit with a vision is a dream with a mission"





Similar Threads
Thread Thread Starter Forum Replies Last Post
Web Service, Custom Control, Custom Return Type robzyc ASP.NET 2.0 Basics 6 June 10th, 2008 08:03 AM
Web Service Consuming another web service CraigWhitfield EJB 0 January 10th, 2008 08:38 AM
Return a custom type from a web service gabrieldcr2 .NET Web Services 1 November 27th, 2005 01:26 PM
Service Oriented Web Service aldwinenriquez .NET Web Services 2 September 15th, 2005 03:25 AM
Downloading Binary file with web method syedjavid .NET Web Services 2 August 16th, 2004 08:23 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.