473,783 Members | 2,269 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

UPS Online Tools

OK, this is going to be a lengthy post with a lot of code. I have built a
class library in C# for communicating with UPS' online tools for package
tracking, time in transit and a few other services. I have used
serialization to form the requests and I use deserialization to read the
responses. The code for Rates and Services works beautifully but the Time in
transit deserialization states that there is no root element in the XML that
UPS kicks back. The deserialization method for the response was copied from
the working Rates and Rervices response with the only modification being the
type passed to the XmlSerializer constructor. Any Ideas? code listed below:
XML Request from Serialized object(s):
--------------------------------------
<?xml version="1.0" encoding="utf-16"?>
<AccessReques t xmlns:xsd="http ://www.w3.org/2001/XMLSchema"
xmlns:xsi="http ://www.w3.org/2001/XMLSchema-instance" xml:lang="en-US">
<AccessLicenseN umber>9BE571A78 CC539A8</AccessLicenseNu mber>
<UserId>ApolloD esignTech</UserId>
<Password>upsgb jyd</Password>
</AccessRequest>
<?xml version="1.0" encoding="utf-16"?>
<TimeInTransitR equest xmlns:xsd="http ://www.w3.org/2001/XMLSchema"
xmlns:xsi="http ://www.w3.org/2001/XMLSchema-instance" xml:lang="en-US">
<Request>
<TransactionRef erence>
<CustomerContex t>TNT_D Origin Country Code</CustomerContext >
<XpciVersion>1. 0002</XpciVersion>
</TransactionRefe rence>
<RequestAction> TimeInTransit</RequestAction>
<RequestOptio n />
</Request>
<TransitFrom>
<AddressArtifac tFormat>
<PoliticalDivis ion2>LONDON</PoliticalDivisi on2>
<PoliticalDivis ion1>CITY OF LONDON</PoliticalDivisi on1>
<Country />
<CountryCode>GB </CountryCode>
<PostcodePrimar yLow>EC03</PostcodePrimary Low>
</AddressArtifact Format>
</TransitFrom>
<TransitTo>
<AddressArtifac tFormat>
<PoliticalDivis ion2>NASSAU</PoliticalDivisi on2>
<PoliticalDivis ion1 />
<Country />
<CountryCode>BS </CountryCode>
<PostcodePrimar yLow />
</AddressArtifact Format>
</TransitTo>
<ShipmentWeight >
<UnitOfMeasurem ent>
<Code>KGS</Code>
<Description>Ki lograms</Description>
</UnitOfMeasureme nt>
<Weight>23</Weight>
</ShipmentWeight>
<TotalPackagesI nShipment>123</TotalPackagesIn Shipment>
<InvoiceLineTot al>
<CurrencyCode>U SD</CurrencyCode>
<MonetaryValue> 250</MonetaryValue>
</InvoiceLineTota l>
<PickupDate>200 60309</PickupDate>
<DocumentsOnlyI ndicator />
</TimeInTransitRe quest>
Raw XML Response from UPS.com
--------------------------------------
<?xml version="1.0"?>
<TimeInTransitR esponse>
<Response>
<TransactionRef erence>
<CustomerContex t>TNT_D Origin Country Code</CustomerContext >
<XpciVersion>1. 0002</XpciVersion>
</TransactionRefe rence>
<ResponseStatus Code>1</ResponseStatusC ode>
<ResponseStatus Description>Suc cess</ResponseStatusD escription>
</Response>
<TransitRespons e>
<PickupDate>200 6-03-15</PickupDate>
<TransitFrom>
<AddressArtifac tFormat>
<PoliticalDivis ion2>LONDON</PoliticalDivisi on2>
<PoliticalDivis ion1>CITY OF LONDON</PoliticalDivisi on1>
<Country>UNIT ED KINGDOM</Country>
<CountryCode>GB </CountryCode>
<PostcodePrimar yLow>EC03</PostcodePrimary Low>
</AddressArtifact Format>
</TransitFrom>
<TransitTo>
<AddressArtifac tFormat>
<PoliticalDivis ion2>NASSAU</PoliticalDivisi on2>
<Country>BAHAMA S</Country>
<CountryCode>BS </CountryCode>
</AddressArtifact Format>
</TransitTo>
<DocumentsOnlyI ndicator></DocumentsOnlyIn dicator>
<AutoDutyCode>0 2</AutoDutyCode>
<ShipmentWeight >
<UnitOfMeasurem ent>
<Code>KGS</Code>
</UnitOfMeasureme nt>
<Weight>0.2</Weight>
</ShipmentWeight>
<InvoiceLineTot al>
<CurrencyCode>U SD</CurrencyCode>
<MonetaryValue> 250.00</MonetaryValue>
</InvoiceLineTota l>
<Disclaimer>Ser vices listed as guaranteed are backed by a money-back
guarantee for transportation charges only. See Terms and Conditions in the
Service Guide for details. Certain commodities and high value shipments may
require additional transit time for customs clearance.</Disclaimer>
<ServiceSummary >
<Service>
<Code>11</Code>
<Description>UP S Express NA1</Description>
</Service>
<Guaranteed>
<Code>Y</Code>
</Guaranteed>
<EstimatedArriv al>
<BusinessTransi tDays>1</BusinessTransit Days>
<Time>23:30:0 0</Time>
<PickupDate>200 6-03-15</PickupDate>
<PickupTime>16: 00:00</PickupTime>
<HolidayCount>0 </HolidayCount>
<DelayCount>0 </DelayCount>
<Date>2006-03-16</Date>
<DayOfWeek>TH U</DayOfWeek>
<TotalTransitDa ys>1</TotalTransitDay s>
<CustomerCenter Cutoff>15:00:00 </CustomerCenterC utoff>
<RestDays>0</RestDays>
</EstimatedArriva l>
</ServiceSummary>
<ServiceSummary >
<Service>
<Code>01</Code>
<Description>UP S Worldwide Express</Description>
</Service>
<Guaranteed>
<Code>Y</Code>
</Guaranteed>
<EstimatedArriv al>
<BusinessTransi tDays>2</BusinessTransit Days>
<Time>23:30:0 0</Time>
<PickupDate>200 6-03-15</PickupDate>
<PickupTime>19: 00:00</PickupTime>
<HolidayCount>0 </HolidayCount>
<DelayCount>0 </DelayCount>
<Date>2006-03-17</Date>
<DayOfWeek>FR I</DayOfWeek>
<TotalTransitDa ys>2</TotalTransitDay s>
<CustomerCenter Cutoff>18:30:00 </CustomerCenterC utoff>
<RestDays>0</RestDays>
</EstimatedArriva l>
</ServiceSummary>
<MaximumListSiz e>35</MaximumListSize >
</TransitResponse >
</TimeInTransitRe sponse>
Deserialization Method of the TimeInTransitRe sponse object
--------------------------------------
public void Deserialize ( System.IO.Strea m xmlResponseStre am )
{

// Local Variables
TimeInTransitRe sponse r = null;
XmlSerializer xs = new XmlSerializer(t ypeof(TimeInTra nsitResponse));

// Begin

try
{

r = new TimeInTransitRe sponse();
r = (TimeInTransitR esponse) xs.Deserialize( xmlResponseStre am);

this.Response = r.Response;
this.TransitRes ponse = r.TransitRespon se;

}// end try
catch ( Exception appEx )
{

this.Deserializ eException = appEx;

}// end catch
finally
{

xmlResponseStre am.Close();

}// end finally
}// end Deserialize
Exception:
--------------------------------------
System.InvalidO perationExcepti on: There is an error in XML document (0,
0). ---> System.Xml.XmlE xception: The root element is missing.
at System.Xml.XmlT extReader.Read( )
at System.Xml.XmlR eader.MoveToCon tent()
at
Microsoft.Xml.S erialization.Ge neratedAssembly .XmlSerializati onReader1.Read1 3_TimeInTransit Response()
--- End of inner exception stack trace ---
at System.Xml.Seri alization.XmlSe rializer.Deseri alize(XmlReader
xmlReader, String encodingStyle, XmlDeserializat ionEvents events)
at System.Xml.Seri alization.XmlSe rializer.Deseri alize(XmlReader
xmlReader, XmlDeserializat ionEvents events)
at System.Xml.Seri alization.XmlSe rializer.Deseri alize(Stream stream)
at
ApolloDesignTec hnology.Shippin g.Ups.TimeInTra nsit.TimeInTran sitResponse.Des erialize(Stream
xmlResponseStre am)
--
Grant Harmeyer
Mar 14 '06 #1
2 4203
Would it be possible to see the TimeInTransitRe sponse Class and all the
relevant classes used in the Deserialise process of
TimeInTransitRe sponse

Mar 15 '06 #2

Grant could you send me your work, I am working on a similar project.
Please let me know and I will pass on my email.

--
samstraub
------------------------------------------------------------------------
Posted via http://www.codecomments.com
------------------------------------------------------------------------

Apr 6 '06 #3

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

Similar topics

9
2088
by: David | last post by:
I am setting up a web community with a feature that will display whether or not a member is currently online. I intend on implementing this by holding a column in the dbase simply called online. When a user logs on, the status of this will be updated to yes. When the user clicks to log out, we simply change the state of this field to no. The problem comes when a user does not execute the log out script and simply closes their browser,...
2
2300
by: Mario | last post by:
Hi, I'm experiencing a nasty problem with Visual Studio .Net 2003. Most Online Resources in the Start Page doesnt work, showing the following message: "This feature requires that you have connected to the internet previously or are currently online"
21
1821
by: Paulb1us | last post by:
In VS .net 2003 There is a online resources tab on the start page. When I click the links such as headlines, downloads or xml services I get a message stating that this feature requires a connection to the Internet. But I have a always on connection to the Internet. The other links like what's new and search online work fine. Thanks Paul
0
1245
by: Lior Bobrov | last post by:
Hello . I now have Visual Studio 2005 Common Technology Preview (CTP) February 2005 with no MSDN . I try to use the MSDN Online from within the IDE , as follows : In the IDE , I click Help->Search (use Online content is checked in Tools -> Options -> Online and MSDN Online is checked too) . Now , I click the MSDN Online tab in the right of the Search window .
2
1553
by: shank | last post by:
Has anyone ever set up code samples for using UPS online tools? I need it for international shipping. I've been trying to setup the tools myself. Some countries work fine, others produce validation errors. Other errors include no shipping solutions between origin and destination. When I manually check on the UPS site, they resolve without problems. thanks!
1
1725
by: Ken VdB | last post by:
Hi everyone, I am trying to integrate UPS's Online Tools into my classic ASP project. Does anyone have some examples of this that I could look at? I am specifically looking for information on the "Rates and Service Selection" tool. Thanks, Ken.
9
7279
by: Daven Thrice | last post by:
If I have a fairly big Access MDB, that is relational, and has, say, 100 objects (forms, reports, modules, etc.), what is the path to get this database "online". Is there a way to put the tables online and then distribute the front end to each user? What if I want to have all the forms and stuff online? How do you approach something like that? Is it a total rewrite with another tool?
1
1072
by: dan heskett | last post by:
Hello group, I have been making a measured but successful transition from a number of development platforms to NET/VB.NET over the last year or so. One thing I've yet to get into is online or context sensitive help in "Smart Client" style applications. What tools do y'all use for authoring and creating help files? Previously in various other circumstances I've used a "roll-your own" approach to
0
2700
by: raylopez99 | last post by:
10 years ago, the below was written (see very end, after my signature RL). What, if anything, has changed? I have Access 2003 and soon Access 2007 on a Windows XP Professional or Windows Vista Ultimate machine, with SQL Server Express running on it, and I want somebody, with a password (which I will provide) to be able to log onto a A03 or A07 dB from the internet. Now that I type this I realize that unless I put the database onto a...
15
2440
by: dreen1 | last post by:
Hello! Does any one of you know about some kind of PHP IDE (or at least an editor with syntax highlighting) that works online? It would be absolutely great if there was something like Google Docs, but for programmers with at least some features normal IDEs provide (support for JS and HTML would be great too). Reason for such need (at least in my case) is I change computers often. I have all my stuff on USB stick, but each time I go...
0
9643
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9480
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10313
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10147
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9946
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8968
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7494
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
1
4044
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 we have to send another system
3
2875
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.