Solved

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

Posted on 2014-09-25
3
26 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Introduction SQL Server Integration Services can read XML files, that’s known by every BI developer.  (If you didn’t, don’t worry, I’m aiming this article at newcomers as well.) But how far can you go?  When does the XML Source component become …
For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

733 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