Fedex Webservices XML Error - xmlhttprequest

Im sending a XML request to Fedex Webservices to create a COD label, using EXPRESS services. The following XML request works for GROUND services, but it doesnt for EXPRESS.
I get following, here's the debug information. Where exactly is the package level?
Error confirming shipment: 2245 (COD can not be specified at package level for Express Shipments)
--------------------------------------------------
Debug Information
--------------------------------------------------
debugMode = 1
--------------------------------------------------
XML Sent
--------------------------------------------------
<ns:ProcessShipmentRequest xmlns:ns="http://fedex.com/ws/ship/v10" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://fedex.com/ws/ship/v10 ShipService v10.xsd">
<ns:WebAuthenticationDetail>
<ns:UserCredential>
<ns:Key>XXXX</ns:Key>
<ns:Password>XXXX</ns:Password>
</ns:UserCredential>
</ns:WebAuthenticationDetail>
<ns:ClientDetail>
<ns:AccountNumber>XXXX</ns:AccountNumber>
<ns:MeterNumber>XXXX</ns:MeterNumber>
</ns:ClientDetail>
<ns:TransactionDetail>
<ns:CustomerTransactionId>CreatePendingRequest</ns:CustomerTransactionId>
</ns:TransactionDetail>
<ns:Version>
<ns:ServiceId>ship</ns:ServiceId>
<ns:Major>10</ns:Major>
<ns:Intermediate>0</ns:Intermediate>
<ns:Minor>0</ns:Minor>
</ns:Version>
<ns:RequestedShipment>
<ns:ShipTimestamp>2012-11-13T18:59:09-07:00</ns:ShipTimestamp>
<ns:DropoffType>REGULAR_PICKUP</ns:DropoffType>
<ns:ServiceType>STANDARD_OVERNIGHT</ns:ServiceType>
<ns:PackagingType>YOUR_PACKAGING</ns:PackagingType>
<ns:Shipper>
<ns:Contact>
<ns:PersonName>John Doe</ns:PersonName>
<ns:CompanyName>Company</ns:CompanyName>
<ns:PhoneNumber>1123456789</ns:PhoneNumber>
</ns:Contact>
<ns:Address>
<ns:StreetLines>1234 Street Name</ns:StreetLines>
<ns:City>City</ns:City>
<ns:StateOrProvinceCode>FL</ns:StateOrProvinceCode>
<ns:PostalCode>12345</ns:PostalCode>
<ns:CountryCode>US</ns:CountryCode>
</ns:Address>
</ns:Shipper>
<ns:Recipient>
<ns:Contact>
<ns:PersonName>NAME</ns:PersonName>
<ns:CompanyName>COMPANY</ns:CompanyName>
<ns:PhoneNumber>0123456789</ns:PhoneNumber>
</ns:Contact>
<ns:Address>
<ns:StreetLines>STE</ns:StreetLines>
<ns:City>CITY NAME</ns:City>
<ns:StateOrProvinceCode>FL</ns:StateOrProvinceCode>
<ns:PostalCode>12345</ns:PostalCode>
<ns:CountryCode>US</ns:CountryCode>
</ns:Address>
</ns:Recipient>
<ns:ShippingChargesPayment>
<ns:PaymentType>SENDER</ns:PaymentType>
<ns:Payor>
<ns:AccountNumber>XXXX</ns:AccountNumber>
<ns:CountryCode>US</ns:CountryCode>
</ns:Payor>
</ns:ShippingChargesPayment>
<ns:SpecialServicesRequested>
</ns:SpecialServicesRequested>
<ns:LabelSpecification>
<ns:LabelFormatType>COMMON2D</ns:LabelFormatType>
<ns:ImageType>PNG</ns:ImageType>
<ns:LabelStockType>PAPER_8.5X11_TOP_HALF_LABEL</ns:LabelStockType>
</ns:LabelSpecification>
<ns:RateRequestTypes>LIST</ns:RateRequestTypes>
<ns:PackageCount>1</ns:PackageCount>
<ns:RequestedPackageLineItems>
<ns:Weight>
<ns:Units>LB</ns:Units>
<ns:Value>1</ns:Value>
</ns:Weight>
<ns:Dimensions>
<ns:Length>5</ns:Length>
<ns:Width>5</ns:Width>
<ns:Height>5</ns:Height>
<ns:Units>IN</ns:Units>
</ns:Dimensions>
<ns:SpecialServicesRequested>
<ns:SpecialServiceTypes>COD</ns:SpecialServiceTypes>
<ns:CodDetail>
<ns:CodCollectionAmount>
<ns:Currency>USD</ns:Currency>
<ns:Amount>115.00</ns:Amount>
</ns:CodCollectionAmount>
<ns:CollectionType>CASH</ns:CollectionType>
<ns:ReferenceIndicator>TRACKING</ns:ReferenceIndicator>
</ns:CodDetail>
</ns:SpecialServicesRequested>
</ns:RequestedPackageLineItems>
</ns:RequestedShipment>
</ns:ProcessShipmentRequest>
--------------------------------------------------
XML Response
--------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<v10:ProcessShipmentReply xmlns:v10="http://fedex.com/ws/ship/v10"><v10:HighestSeverity xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">ERROR</v10:HighestSeverity><v10:Notifications xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><v10:Severity>ERROR</v10:Severity><v10:Source>ship</v10:Source><v10:Code>2245</v10:Code><v10:Message>COD can not be specified at package level for Express Shipments</v10:Message><v10:LocalizedMessage>COD can not be specified at package level for Express Shipments</v10:LocalizedMessage></v10:Notifications><ns:TransactionDetail xmlns:ns="http://fedex.com/ws/ship/v10" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><ns:CustomerTransactionId>CreatePendingRequest</ns:CustomerTransactionId></ns:TransactionDetail><ns:Version xmlns:ns="http://fedex.com/ws/ship/v10" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><ns:ServiceId>ship</ns:ServiceId><ns:Major>10</ns:Major><ns:Intermediate>0</ns:Intermediate><ns:Minor>0</ns:Minor></ns:Version></v10:ProcessShipmentReply>
--------------------------------------------------
PHP Information
--------------------------------------------------
5.3.18
--------------------------------------------------
cURL Return Information
--------------------------------------------------
HTTP/1.1 100 Continue
HTTP/1.1 200 OK
Date: Wed, 14 Nov 2012 01:59:02 GMT
Server: Apache/2.2
Content-Length: 1167
x-wily-servlet: Clear appServerIp=204.135.252.191&agentName=ESB-servicebus-1&servletName=HttpTransportServlet&servletResponseTime=119&agentHost=qje20222&agentProcess=WebLogic
X-Powered-By: Servlet/2.5 JSP/2.1
x-wily-info: Clear guid=FCA41585CC87FCBF0C2A8683C9B05C6A
Vary: Accept-Encoding
Content-Type: text/xml; charset=utf-8
<?xml version="1.0" encoding="UTF-8"?>
<v10:ProcessShipmentReply xmlns:v10="http://fedex.com/ws/ship/v10"><v10:HighestSeverity xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">ERROR</v10:HighestSeverity><v10:Notifications xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><v10:Severity>ERROR</v10:Severity><v10:Source>ship</v10:Source><v10:Code>2245</v10:Code><v10:Message>COD can not be specified at package level for Express Shipments</v10:Message><v10:LocalizedMessage>COD can not be specified at package level for Express Shipments</v10:LocalizedMessage></v10:Notifications><ns:TransactionDetail xmlns:ns="http://fedex.com/ws/ship/v10" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><ns:CustomerTransactionId>CreatePendingRequest</ns:CustomerTransactionId></ns:TransactionDetail><ns:Version xmlns:ns="http://fedex.com/ws/ship/v10" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><ns:ServiceId>ship</ns:ServiceId><ns:Major>10</ns:Major><ns:Intermediate>0</ns:Intermediate><ns:Minor>0</ns:Minor></ns:Version></v10:ProcessShipmentReply>

Did you try using a different CollectionType? CASH may not be an option for Express (only for Ground). Try one of the others, like ANY or GUARANTEED_FUNDS and see if you get better results. Fedex can return 'less than helpful' error messages that don't really point you in the right direction. (You might also need to leave out ReferenceIndicator for express - I think that might only be available for Ground)

Related

How can I configure CloudFront so it costs me a bit less?

I have a very static site, basically HTML and some Javascript on S3. I serve this through Cloudfront. My usage has gone up a bit plus one of my Javascript files is pretty large.
So what can I do to cut down the costs of serving those files? they need have very good uptime as it has thousands of active users all over the world.
This is the usage for yesterday:
Looking at other questions about this it seems like changing headers can help but I thought I already had caching enabled. This is what curl returns if I get one of those files:
* Connection state changed (MAX_CONCURRENT_STREAMS updated)!
< HTTP/2 200
< content-type: text/html
< content-length: 2246
< date: Fri, 03 Apr 2020 20:28:47 GMT
< last-modified: Fri, 03 Apr 2020 15:21:11 GMT
< x-amz-version-id: some string
< etag: "83df2032241b5be7b4c337f0857095fc"
< server: AmazonS3
< x-cache: Miss from cloudfront
< via: 1.1 somestring.cloudfront.net (CloudFront)
< x-amz-cf-pop: some string
< x-amz-cf-id: some string
This is what the cache is configured as on CloudFront:
This is what S3 says when I use curl to query the file:
< HTTP/1.1 200 OK
< x-amz-id-2: some string
< x-amz-request-id: some string
< Date: Fri, 03 Apr 2020 20:27:22 GMT
< x-amz-replication-status: COMPLETED
< Last-Modified: Fri, 03 Apr 2020 15:21:11 GMT
< ETag: "83df2032241b5be7b4c337f0857095fc"
< x-amz-version-id: some string
< Accept-Ranges: bytes
< Content-Type: text/html
< Content-Length: 2246
< Server: AmazonS3
So what can I do? I don't often update the files and when I do I don't mind if it takes a day or two for the change to propagate.
Thanks.
If your goal is to reduce CloudFront costs, then it's worth reviewing how it is charged:
Regional Data Transfer Out to Internet (per GB): From $0.085 to $0.170 (depending upon location of your users)
Regional Data Transfer Out to Origin (per GB): From $0.020 to $0.160 (data going back to your application)
Request Pricing for All HTTP Methods (per 10,000): From $0.0075 to $0.0090
Compare that to Amazon S3:
GET Requests: $0.0004 per 1000
Data Transfer: $0.09 per GB (Also applies for traffic coming from Amazon EC2 instances)
Therefore, some options for you to save money are:
Choose a lower Price Class that restricts which regions send traffic "out". For example, Price Class 100 only sends traffic from USA and Europe, which has lower Data Transfer costs. This will reduce Data Transfer costs for other locations, but will give them a lower quality of service (higher latency).
Stop using CloudFront and serve content directly from S3 and EC2. This will save a bit on requests (about half the price), but Data Transfer would be a similar cost to Price Class 100.
Increase the caching duration for your objects. However, the report is showing 99.9%+ hit rates, so this won't help much.
Configure the objects to persist longer in user's browsers so less requests are made. However, this only works for "repeat traffic" and might not help much. It depends on app usage. (I'm not familiar with this part. It might not work in conjunction with CloudFront. Hopefully other readers can comment.)
Typically, mosts costs are related to the volume of traffic. If you app is popular, those Data Transfer costs will go up.
Take a look at your bills and try to determine which component is leading to most of the costs. Then, it's a trade-off between service to your customers and costs to you. Changing the Price Class might be the best option for now.

highrise API, put unprocessable entity , 37 Signals

i´m playing arround with the HIGHRISE API, and they understood the meaning of rest, its pretty cool and at some points gracefully forgivingly, but
has anybody any idea why the xml i PUT is not accepted ?
here is some relevant logging :
2014-02-23 00:00:04] app.INFO: Updating:Person:Highrise-API = people/11834527375.xml [] []
[2014-02-23 00:00:04] app.INFO: request body is :
<?xml version="1.0" encoding="UTF-8"?>
<person>
<first-name><![CDATA[Johnny]]></first-name>
<last-name><![CDATA[B. Good]]></last-name>
<visible-to><![CDATA[Everyone]]></visible-to>
<subject_datas type="array">
<subject_data>
<subject_field_id type="integer"><![CDATA[43212]]></subject_field_id>
<value><![CDATA[dsa328394OOKD323H]]></value>
</subject_data>
<subject_data>
<subject_field_id type="integer"><![CDATA[470259]]></subject_field_id>
<value><![CDATA[provider://w184071823/fmdks/2032]]></value>
</subject_data>
<subject_data>
<subject_field_id type="integer"><![CDATA[469130]]></subject_field_id>
<value><![CDATA[CORE]]></value>
</subject_data>
<subject_data>
<subject_field_id type="integer"><![CDATA[469132]]></subject_field_id>
<value><![CDATA[Way too cool]]></value>
</subject_data>
</subject_datas>
<contact-data>
<phone-numbers>
<phone-number type="array">
<number><![CDATA[081 6418273]]></number>
<location><![CDATA[Work]]></location>
</phone-number>
</phone-numbers>
<addresses type="array">
<address>
<city><![CDATA[New York City]]></city>
<country><![CDATA[US]]></country>
<state><![CDATA[New York]]></state>
<street><![CDATA[Siplingerstreet 11]]></street>
<zip><![CDATA[87527]]></zip>
<location><![CDATA[Work]]></location>
</address>
</addresses>
</contact-data>
</person>
[] []
[2014-02-23 00:00:04] app.INFO: request set [] []
[2014-02-23 00:00:04] app.ERROR: Guzzle/3.8.1 curl/7.28.1 PHP/5.4.10 - [2014-02-22T23:00:04+00:00] "PUT /people/11834527375.xml HTTP/1.1" 422 103 [] []
[2014-02-23 00:00:04] app.INFO: Caught client-error-exception in HighriseService updatePerson(): exception 'Guzzle\Http\Exception\ClientErrorResponseException' with message 'Client error response
[status code] 422
[reason phrase] Unprocessable Entity
i dont see the error :/
I´m very sure the subject_field_id´s are correct and those custom fields are set
Posting e.g saving that xml works, i saw from the response that are fields were set,
only thing i can guess is, that i´m trying to PUT a version where nothing has changed,
is that the problem ?
because my code only checks if that person exists at all and if so update it instead of creating
You should get back some XML in the body of the response. It should look like this:
<?xml version="1.0" encoding="UTF-8"?>
<errors>
<error>Phone number '555-555-5555' has already been taken</error>
</errors>
If you include the id for the existing phone number in your PUT request, then we know that you want to update the existing address, rather than adding a new one: https://github.com/basecamp/highrise-api/blob/master/sections/people.md#update-person
Contact data and Subject data that include an id will be updated, data that doesn’t will be assumed to be new and created from scratch. To remove a piece of data, prefix its id with a minus sign (e.g. -1).

RavenDB Document Deleted Before Expiration

I am attempting to write a document to RavenDB with an expiration 20 minutes in the future. I am not using the .NET client, just curl. My request looks like this:
PUT /databases/FRUPublic/docs/test/123 HTTP/1.1
Host: ravendev
Connection: close
Accept-encoding: gzip, deflate
Content-Type: application/json
Raven-Entity-Name: tests
Raven-Expiration-Date: 2012-07-31T22:23:00
Content-Length: 14
{"data":"foo"}
In the studio I see my document saved with Raven-Expiration-Date set exactly 20 minutes from Last-Modified, however, within 5 minutes the document is deleted.
I see this same behavior (deleted in 5 minutes) if I increase the expiration date. If I set an expiration date in the past the document deletes immediately.
I am using build 960. Any ideas about what I'm doing wrong?
I specified the time to 10 millionth of a second and now documents are being deleted just as I would expect.
For example:
Raven-Expiration-Date: 2012-07-31T22:23:00.0000000
The date have to be in UTC, and it looks like you are sending local time.

QBMS (Quickbooks Merchant Services) Scheduled Billing doesn't show up in Dashboard

I have added a wallet and scheduled billing for the future, I receive the scheduled billing ID and a success message, but when I go to recurring payments (this is all in the sandbox -- ptc), I don't see anything.
This is my request:
POST https://webmerchantaccount.ptc.quickbooks.com/j/AppGateway HTTP/1.1
Content-Type: application/x-qbmsxml
Content-Length: 770
<?xml version="1.0" encoding="utf-8"?>
<?qbmsxml version="4.5"?>
<QBMSXML>
<SignonMsgsRq>
<SignonTicketRq>
<ClientDateTime>2012-01-30T17:03:42</ClientDateTime>
<SessionTicket>***********************</SessionTicket>
</SignonTicketRq>
</SignonMsgsRq>
<QBMSXMLMsgsRq>
<CustomerScheduledBillingAddRq>
<CustomerID>1234721</CustomerID>
<WalletEntryID>102142113311000320665100</WalletEntryID>
<PaymentType>CreditCard</PaymentType>
<Amount>1.06</Amount>
<SalesTaxAmount>0.06</SalesTaxAmount>
<StartDate>2012-01-31</StartDate>
<FrequencyExpression>0 0 0 1 * ?</FrequencyExpression>
<ScheduledBillingStatus>Active</ScheduledBillingStatus>
</CustomerScheduledBillingAddRq>
</QBMSXMLMsgsRq>
</QBMSXML>
Then I get this response:
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE QBMSXML PUBLIC "-//INTUIT//DTD QBMSXML QBMS 4.5//EN" "http://webmerchantaccount.ptc.quickbooks.com/dtds/qbmsxml45.dtd">
<QBMSXML>
<SignonMsgsRs>
<SignonTicketRs statusCode="0" statusSeverity="INFO">
<ServerDateTime>2012-01-30T23:07:46</ServerDateTime>
<SessionTicket>***********************</SessionTicket>
</SignonTicketRs>
</SignonMsgsRs>
<QBMSXMLMsgsRs>
<CustomerScheduledBillingAddRs statusCode="0" statusMessage="Status OK" statusSeverity="INFO">
<ScheduledBillingID>5225</ScheduledBillingID>
</CustomerScheduledBillingAddRs>
</QBMSXMLMsgsRs>
</QBMSXML>
Can anyone tell me why I can't see this in the dashboard? Or where I should see it?
Thanks!
If you're using a TEST/PTC merchant account, the transactions won't show up in the GUI dashboard. That's just how Intuit's system works. :-(

Invalid Flickr API response

I've come across a very puzzling issue with the Flickr API.
Basically, there's certain queries I (and some developer friends) can run which result in broken resultsets.
Basically, what you request, isn't always returned...
Here's a few examples:
Request:
http://api.flickr.com/services/rest/?method=flickr.photos.search&safe_search=1&media=photos&extras=o_dims&per_page=30&page=1&format=json&nojsoncallback=1&api_key=XXXXXXX
Response:
HTTP/1.1 200 OK
Content-Length: 793
Date: Thu, 05 Jan 2012 23:30:56 GMT
P3P: policyref="http://p3p.yahoo.com/w3c/p3p.xml", CP="CAO DSP COR CUR ADM DEV TAI PSA PSD IVAi IVDi CONi TELo OTPi OUR DELi SAMi OTRi UNRi PUBi IND PHY ONL UNI PUR FIN COM NAV INT DEM CNT STA POL HEA PRE GOV"
Access-Control-Allow-Origin: *
Cache-Control: private
X-Served-By: www71.flickr.mud.yahoo.com
Vary: Accept-Encoding
Connection: close
Content-Type: text/plain; charset=utf-8
{"photos":{"page":1, "pages":19886, "perpage":30, "total":"596560", "photo":[{"id":"6643915631", "owner":"74181952#N00", "secret":"8bc611c556", "server":"7023", "farm":8, "title":"IMG_5642", "ispublic":1, "isfriend":0, "isfamily":0}, {"id":"6643911681", "owner":"7240073#N04", "secret":"34837024f0", "server":"7004", "farm":8, "title":"26 weeks!!", "ispublic":1, "isfriend":0, "isfamily":0, "o_width":"768", "o_height":"1024"}, {"id":"6643919177", "owner":"54899865#N02", "secret":"170d3a336f", "server":"7153", "farm":8, "title":"IMGA0072", "ispublic":1, "isfriend":0, "isfamily":0}, {"id":"6643916265", "owner":"51191328#N06", "secret":"05905197ce", "server":"7034", "farm":8, "title":"IMG_1781", "ispublic":1, "isfriend":0, "isfamily":0, "o_width":"2736", "o_height":"3648"}]}, "stat":"ok"}
Notice there's only 4 images returned, when we asked for 30? (and there's 596560 pics matching)
If I change the perpage count to something different it may work, like right now, if I change it to 3, it'll return 3, but yesterday when I was testing, it only returned 2! and when I changed it to 10 it returned none!?
We've come across another example, this time with image size data:
Request
http://api.flickr.com/services/rest/?method=flickr.interestingness.getList&extras=o_dims&per_page=3&page=1&format=rest&api_key=XXXXXXXXXX
Response
<?xml version="1.0" encoding="utf-8" ?>
<rsp stat="ok">
<photos page="1" pages="167" perpage="3" total="500">
<photo id="6743082503" owner="29789996#N00" secret="7d6a1ab340" server="7165" farm="8" title="Glittering Marina [2]" ispublic="1" isfriend="0" isfamily="0" />
<photo id="6741988715" owner="44789014#N04" secret="ab1528fa9f" server="7009" farm="8" title="Heavy metal warrior" ispublic="1" isfriend="0" isfamily="0" o_width="1200" o_height="1202" />
<photo id="6741320397" owner="54880604#N06" secret="7b3bd8530f" server="7030" farm="8" title="Greetings from below, Village near Can Tho" ispublic="1" isfriend="0" isfamily="0" />
</photos>
</rsp>
Note only one of the images has image size data.
It's a very difficult issue to reproduce as it only happens every now and then, but once you've found a page/pagecount combo that causes an issue, you'll consistently get the incorrect response (I assume it's due to some form of caching).
Has anyone else come across this?
As you can see in my resultset above, there's no error, no warning, just an incorrect response.
Thanks in advance.
Aaron
Huh. I've filed myself a bug; let me look into it. Possibly a pagination bug on our end, or a caching thing as suggested.