View Full Version : xml request problems...

29 May 2007, 7:15 AM
Im trying to make a xml request to the usps to for zipcode validation. Im not very familer with xml, and am having some problems. I think its an encoding issue... but Im not sure.

This is my code:

function testXML(){
var zipDataStore;
var XMLString = '<ZipCodeLookupRequest%20USERID=\"xxxxxxxxxxx\"><Address ID=\"0\"><Address1></Address1><Address2>6406 Ivy Lane</Address2><City>Greenbelt</City><State>MD</State></Address></ZipCodeLookupRequest>';

zipDataStore = new Ext.data.Store({
proxy: new Ext.data.ScriptTagProxy({
url: 'http://testing.shippingapis.com/ShippingAPITest.dll'

reader: new Ext.data.XmlReader({
record: "ZipCodeLookupResponse",
totalRecords: "totalCount",
id: "Address ID"
{name: 'Address', mapping: 'Address2'},
{name: 'City', mapping: 'City'},
{name: 'State', mapping: 'State'},
{name: 'Zip5', mapping: 'Zip5'},
{name: 'Zip4', mapping: 'Zip4'}

baseParams: {
API: 'ZipCodeLookup',
XML: XMLString,
totalCount: '1'



This is what my post looks like:

API ZipCodeLookup
XML <ZipCodeLookupRequest%20USERID="xxxxxxxxx"><Address ID="0"><Address1></Address1><Address2>6406 Ivy Lane</Address2><City>Greenbelt</City><State>MD</State></Address></ZipCodeLookupRequest>
_dc 1180451819968
callback stcCallback1002
totalCount 1

and this is what the location looks like, which is a 400 response from the server saying it does not understand the request:


this is the format the server wants:

http://SERVERNAME/ShippingAPITest.dll?API=ZipCodeLookup&XML=<ZipCodeLookupRequest%20USERID="xxxxxxx"><Address ID="0"><Address1></Address1>

<Address2>6406 Ivy Lane</Address2><City>Greenbelt</City><State>


What am I missing?

Thanks in advance,


29 May 2007, 10:50 AM
Does everything look right here?:-/

29 May 2007, 10:55 AM
You're trying to post to a dll - is your server configured right to allow that?

29 May 2007, 11:01 AM
Well, I think so. That was my understanding of how the web service worked. I send it my xml string, and it responds.

here is link to the web api docs if you want to take a peak


Does my code look right other then that?