Solved

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

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

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

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

Why is this different from all of the other step by step guides?  Because I make a living as a DBA and not as a writer and I lived through this experience. Defining the name: When I talk to people they say different names on this subject stuff l…
Slowly Changing Dimension Transformation component in data task flow is very useful for us to manage and control how data changes in SSIS.
Via a live example, show how to shrink a transaction log file down to a reasonable size.
Viewers will learn how the fundamental information of how to create a table.

863 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

23 Experts available now in Live!

Get 1:1 Help Now