?
Solved

I am trying to Use a web service to fax base64 data

Posted on 2014-09-25
3
Medium Priority
?
33 Views
Last Modified: 2016-06-14
I am trying to call a fax web service and send it a base64 encoded pdf for processing.
When I make the call I get the message that the URI is too large.

I am generating the url based on data from my sql table and then use the following statements:
EXEC sp_OACreate 'MSXML2.XMLHTTP', @Object OUT;
EXEC sp_OAMethod @Object, 'open', NULL, 'POST', @sURL1, 'false'
EXEC sp_OAMethod @Object, 'send'
EXEC sp_OAMethod @Object, 'responseText', @ResponseText OUTPUT

EXEC sp_OADestroy @Object          
SET @ResultText = @ResponseText
select @ResultText

the @sURL1 looks something like this:
http://api.vitelity.net/fax.php?login=xxxxx&pass=xxxx&cmd=sendfax&faxnum=407xxxxxxx&faxsrc=407xxxxxxx&file1=20140922024830.pdf&data1=JVBERi0xLjQK...
the full string is 53784 characters long.

Any assistance would be appreciated.

Thank you,

Art
0
Comment
Question by:amccabe
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 46

Expert Comment

by:aikimark
ID: 40345965
I would have expected to see you send a SOAP envelop that contained the base64 data
0
 
LVL 40

Accepted Solution

by:
Vadim Rapp earned 2000 total points
ID: 40346855
Try to specify @sURL1 just as http://api.vitelity.net/fax.php and send the rest in send:

EXEC sp_OACreate 'MSXML2.XMLHTTP', @Object OUT;
EXEC sp_OAMethod @Object, 'open', NULL, 'POST', 'http://api.vitelity.net/fax.php', 'false'
EXEC sp_OAMethod @Object, 'send','login=xxxxx&pass=xxxx&cmd=sendfax&faxnum=407xxxxxxx&faxsrc=407xxxxxxx&file1=20140922024830.pdf&data1=JVBERi0xLjQK...
EXEC sp_OAMethod @Object, 'responseText', @ResponseText OUTPUT


Also, add another sp_OAMethod to specify setRequestHeader Content-Type="application/x-www-form-urlencoded"
It's that by default, but just to to make sure.
0

Featured Post

Free Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
In this article we will learn how to fix  “Cannot install SQL Server 2014 Service Pack 2: Unable to install windows installer msi file” error ?
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…
Suggested Courses

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question