473,473 Members | 1,535 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Use SSL to talk to fedex

I am trying to implement talk directly to the fedex servers so i can use
there online services. I need to first establish an SSL connection then
send some information to the fedex servers and wait for and process the
response.

I have seen some code that will allow me to recieve info over ssl and some
that will allow me to send info over ssl but not both.
Thanks in advance for any help,
~Logan

I have attached the VB sample code fedex provides
----------
Private Sub Command1_Click()

qq$ = Chr$(34) 'The " character

'DNS name of FedEx server

'contact FedEx for correct server name and port

SvcAddr = "SSLserver.fedex.com"

SvcPort = 8000

SvcName = "/GatewayDC"

' Set proxy - Examine this method to set specific proxy address

WinHttpReq.SetProxy HTTPREQUEST_PROXYSETTING_DIRECT

'Specify https for Secure Sockets

RequestHeader = "https://" + SvcAddr + ":" + SvcPort + SvcName

' Open an HTTP Request.

WinHttpReq.Open "POST", RequestHeader, False

' Substitute your Company name for MyApplication

WinHttpReq.SetRequestHeader "User-Agent", "MyApplication"

WinHttpReq.SetRequestHeader "Content-type", "image/gif"

WinHttpReq.SetRequestHeader "Accept", "image/gif, image/x-xbitmap,

image/jpeg, image/pjpeg, */*"

'A simple 402 tracking transaction

APITrans = "0," + qq$ + "402" + qq$ + "29," + qq$ + "821343443862" + qq$

+ "99," + qq$ + qq$

' Send the HTTP Request.

WinHttpReq.Send APITrans

' Put status and content type into status text box.

Text1.Text = WinHttpReq.Status & " - " & WinHttpReq.StatusText

Text2.Text = WinHttpReq.ResponseText

End Sub

--------------------------

Nov 16 '05 #1
1 5423
Logan,

You can do this easily in .NET. You want to use the HttpWebRequest and
HttpWebResponse classes in the System.Net namespace. Here is that sample,
translated into .NET:

// Create a Uri builder.
UriBuilder uriBuilder = new UriBuilder("https", SvcAddr, SvcPort,
GatewayDC);

// Get the uri.
Uri uri = uriBuilder.Uri;

// Create an HttpWebRequest.
HttpWebRequest request = (HttpWebRequest) WebRequest.Create(uri);

// Set the method.
request.Method = "POST";

// Set the user agent.
request.UserAgent = "MyApplication";

// Set the content type.
request.ContentType = "image/gif";

// Set the accept header.
request.Accept = "image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */*";

// The qq.
string qq = new String(new char[]{Convert.ToChar(34)});

// The body of the request.
// You could use a StringBuilder here as well, better for lots of appending
operations to strings.
string body = "0," + qq + "402" + qq + "29," + qq + "821343443862" + qq +
"99," + qq + qq;

// Convert to bytes.
byte[] bytes = Encoding.ASCII.GetBytes(body);

// Set the content length.
request.ContentLength = bytes.Length;

// Now send the text, get the request stream.
Stream stream = request.GetRequestStream();

// Write the bytes to the stream.
stream.Write(bytes, 0, bytes.Length);

// Now get the response.
HttpWebResponse response = (HttpWebResponse) request.GetResponse();

// You can now get the status through the Status property on
// the HttpWebResponse, and get the text of the response by calling
// GetResponseStream and getting the bytes and decoding them into unicode.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com
"Logan" <lo***@globalweb.net> wrote in message
news:%2***************@TK2MSFTNGP09.phx.gbl...
I am trying to implement talk directly to the fedex servers so i can use
there online services. I need to first establish an SSL connection then
send some information to the fedex servers and wait for and process the
response.

I have seen some code that will allow me to recieve info over ssl and some
that will allow me to send info over ssl but not both.
Thanks in advance for any help,
~Logan

I have attached the VB sample code fedex provides
----------
Private Sub Command1_Click()

qq$ = Chr$(34) 'The " character

'DNS name of FedEx server

'contact FedEx for correct server name and port

SvcAddr = "SSLserver.fedex.com"

SvcPort = 8000

SvcName = "/GatewayDC"

' Set proxy - Examine this method to set specific proxy address

WinHttpReq.SetProxy HTTPREQUEST_PROXYSETTING_DIRECT

'Specify https for Secure Sockets

RequestHeader = "https://" + SvcAddr + ":" + SvcPort + SvcName

' Open an HTTP Request.

WinHttpReq.Open "POST", RequestHeader, False

' Substitute your Company name for MyApplication

WinHttpReq.SetRequestHeader "User-Agent", "MyApplication"

WinHttpReq.SetRequestHeader "Content-type", "image/gif"

WinHttpReq.SetRequestHeader "Accept", "image/gif, image/x-xbitmap,

image/jpeg, image/pjpeg, */*"

'A simple 402 tracking transaction

APITrans = "0," + qq$ + "402" + qq$ + "29," + qq$ + "821343443862" + qq$

+ "99," + qq$ + qq$

' Send the HTTP Request.

WinHttpReq.Send APITrans

' Put status and content type into status text box.

Text1.Text = WinHttpReq.Status & " - " & WinHttpReq.StatusText

Text2.Text = WinHttpReq.ResponseText

End Sub

--------------------------

Nov 16 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: grant | last post by:
hi folks: Does anyone know how to calculate the shipping rate on Fedex? There was a web module to handle the web query for rate at http://grd.fedex.com/cgi-bin/rrr2010.exe?func=Rate Currently...
3
by: Ashish Kanoongo | last post by:
Hello I would like to calculate freight online for UPS and Fedex. However I have already calculate freight for ABF, Roadway and MyYellow, because they have provided sufficient documentation of...
1
by: someone | last post by:
Does anyone have any experience integrating with FedEx via C# and ASP.NET? I am really frustrated with the lack of help from FedEx. Their example ASP.NET code consists of an empty form and a C#...
6
by: Alvin Bruney [MVP] | last post by:
Has anybody interfaced with fedex thru an application to get shipping/package tracking info? I'm not interested in a screen scrape solution. -- Regards, Alvin Bruney...
1
by: Terry Graham | last post by:
This is a total shot in the dark, but does anyone have any experience in setting up an ASP.NET project that only gets the shipping Rates from FedEx's live server? All I really want to accomplish...
3
by: injanib via AccessMonster.com | last post by:
Does anyone know what kind of codes Fedex uses for its barcodes and how it is translated into the tracking number. I have a database to I use to log incoming packages. I am able to scan any other...
3
by: supperham | last post by:
hi: can sone one tell me how to use fedex web service in php to calculate shipping fee? i already have fedex account and 4 keys used to test application Test...
0
by: Raymond | last post by:
Hi All, Has any one work with FedEx Webservice with ASP? I am using ASP via SOAP to talk to FedEx Webservice, I have no problem printing the FedEx label with PNG or PDF, my problem is to print...
6
by: tankchintan | last post by:
I am working on this FedEx web service integration project for some time. I am using PHP to make calls to the FedEx server. Everything seems to be working properly. But I am having problems with...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.