?
Solved

ups web service

Posted on 2014-11-06
5
Medium Priority
?
163 Views
Last Modified: 2014-11-20
I have below web service in Vb. It is very old codes for UPS web services. I can build it in VB studio without any errors and issues. But no result. And I find out there is no parameter for UPS license number. And see anyone can help me to valid it is still working.

Thanks

<%@ WebService language="VB" class="UPS" %>
imports system
imports system.web
imports System.Net
imports System.IO
imports System.Web.Services
Imports Microsoft.VisualBasic

Public Class UPS : Inherits System.Web.Services.WebService

 <WebMethod()> _
 Public Function GetPrice(SvcCode as String,RateChart as String,ShipperZIP as String,ReceiverZIP as String, _
                          ReceiverCountry as String,PkgWeight as String,IsResidential as String,IsCOD as String, _
                          IsSatPickup as String,IsSatDelivery as String,PkgType as String) as string
        Dim sReturn As String = ""
        Dim WebReq As WebRequest
        Dim WebResp As WebResponse
        Dim strStream As StreamReader
        Dim URLRequest As String
        Dim line As String

        URLRequest = BuildUPSRequest(SvcCode, RateChart, ShipperZIP, ReceiverZIP, "US", PkgWeight, IsResidential, IsCOD, IsSatPickup, IsSatDelivery, PkgType)

        WebReq = WebRequest.Create(URLRequest)
        'WebReq.KeepAlive = false
        WebResp = WebReq.GetResponse()
        strStream = New StreamReader(WebResp.GetResponseStream(), System.Text.Encoding.ASCII)
        Try
            line = strStream.ReadLine()
            Do While line <> ""
                line = strStream.ReadLine()
                If instr(1, lcase(line), "upsonline") <> 0 Then
                    Dim strArrayData() As String
                    strArrayData = Split(line, "%")
                    If left(strArrayData(3), 4) = "0000" Then
                        sReturn = strArrayData(12)
                    Else
                        sReturn = "ERR : " & right(strArrayData(3), len(strArrayData(3)) - 4)
                    End If
                    Exit Do
                End If
            Loop
        Catch ex As Exception
            sReturn = ex.Message
        End Try
        Return sReturn
    End Function
 
    Private Function BuildUPSRequest(SvcCode As String, RateChart As String, ShipperZIP As String, ReceiverZIP As String, _
                            ReceiverCountry As String, PkgWeight As String, IsResidential As String, IsCOD As String, _
                            IsSatPickup As String, IsSatDelivery As String, PkgType As String) As String

        Dim UPSPayload As String
        UPSPayload = ""
        UPSPayload = "http://www.ups.com/using/services/rave/qcost_dss.cgi?"
        UPSPayload = UPSPayload & "AppVersion=1.2&AcceptUPSLicenseAgreement=YES&"
        UPSPayload = UPSPayload & "ResponseType=application/x-ups-rss&ActionCode=3&"
        UPSPayload = UPSPayload & "ServiceLevelCode=" & SvcCode & "&RateChart=" & RateChart & "&"
        UPSPayload = UPSPayload & "ShipperPostalCode=" & ShipperZIP & "&ConsigneePostalCode=" & ReceiverZIP & "&"
        UPSPayload = UPSPayload & "ConsigneeCountry=" & ReceiverCountry & "&PackageActualWeight=" & PkgWeight & "&"
        UPSPayload = UPSPayload & "ResidentialInd=" & IsResidential & "&CODInd=" & IsCOD & "&SatDelivInd=" & IsSatDelivery
        UPSPayload = UPSPayload & "&SatPickupInd=" & IsSatPickup & "&PackagingType=" & PkgType
        Return UPSPayload
    End Function

End Class
0
Comment
Question by:ITsolutionWizard
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 96

Expert Comment

by:Bob Learned
ID: 40428627
UPS has a few web services (Shipping API, Tracking API, Rating API, ...).  What API are you working with?

What UPS APIs are Available?
http://www.ups.com/content/us/en/resources/sri/apidefinition.html
0
 
LVL 1

Author Comment

by:ITsolutionWizard
ID: 40428770
Rating
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 40429173
Things have changed since I last used UPS.  I find here that you have to login to see the API documentation.

UPS Developer Kit
https://www.ups.com/upsdeveloperkit/downloadresource?loc=en_US

You must Log-in to download the API documentation.
0
 
LVL 1

Author Comment

by:ITsolutionWizard
ID: 40429319
I need codes for rating not a link
0
 
LVL 96

Accepted Solution

by:
Bob Learned earned 2000 total points
ID: 40429358
I am trying to tell you that I can't help you.
0

Featured Post

Enroll in August's Course of the Month

August's CompTIA IT Fundamentals course includes 19 hours of basic computer principle modules and prepares you for the certification exam. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

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

ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Suggested Courses

765 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