Solved

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

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

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

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…
Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.

776 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