Solved

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

Posted on 2014-09-25
3
17 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
3 Comments
 
LVL 45

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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
MS SQL server Varchar and nvarchar, GMT_DATE 23 50
Shop sales Actual vs Forecast 2 26
Sql query 34 22
SQL Query 3 0
For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

743 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now