Getting the error "Number of packages exceeds maximum" from FedEX API - perl

I am getting "FedEx Ship Error: (8522) Number of packages exceeds maximum" error. I am trying to send a multiple-package shipment request to fedEX, but it is getting failed in first package request only.
For sending multiple shipment request to FedEX, we have to send separate request for each package, the master tracking information will be returned in reply from the first package requested. That master tracking information is then inserted into the requests for each additional package requested for that multiple-package shipment.
The example below is first package request.
Below is the XML request Body I am sending to FedEX API "https://wsbeta.fedex.com:443/xml"
The code is just preparing the data structure, converting it into XML and hitting the fedEX API with XML request.
my $http_request = HTTP::Request->new('POST', $config->{'URL'});
$http_request->content_type('application/x-www-form-urlencoded');
$http_request->content(Encode::encode_utf8($xml_request_body));
my $http_response;
eval {
$http_response = $ua->request($http_request);
};
return errorShipResponse($p) if (!defined $http_response || !$http_response->is_success);
my $response;
eval {
$response = XML::Simple::XMLin(
$http_response->content,
ForceArray => 1,
NSExpand => 1
);
};
$xml_request_body
<?xml version="1.0" encoding="UTF-8"?>
<ProcessShipmentRequest xmlns="http://fedex.com/ws/ship/v12">
<WebAuthenticationDetail>
<UserCredential>
<Key>aaaaaaaaaaa</Key>
<Password>aaaaaaaaaaaaaaaa</Password>
</UserCredential>
</WebAuthenticationDetail>
<ClientDetail>
<AccountNumber>111111111</AccountNumber>
<MeterNumber>111111111111</MeterNumber>
</ClientDetail>
<Version>
<ServiceId>ship</ServiceId>
<Major>12</Major>
<Intermediate>0</Intermediate>
<Minor>0</Minor>
</Version>
<RequestedShipment>
<ShipTimestamp>2016-09-06T06:42:41-04:00</ShipTimestamp>
<DropoffType>REGULAR_PICKUP</DropoffType>
<ServiceType>SMART_POST</ServiceType>
<PackagingType>YOUR_PACKAGING</PackagingType>
<TotalWeight>
<Units>LB</Units>
<Value>15.00</Value>
</TotalWeight>
<Shipper>
<AccountNumber>111111111111</AccountNumber>
<Tins>
<TinType>BUSINESS_STATE</TinType>
<Number444444444444</Number>
</Tins>
<Contact>
<CompanyName>aaaaaaaaaaaa</CompanyName>
<PhoneNumber>11111111</PhoneNumber>
</Contact>
<Address>
ADDRESS HERE
</Address>
</Shipper>
<Recipient>
<Contact>
<PersonName>mukta jain</PersonName>
<PhoneNumber>1234567899</PhoneNumber>
</Contact>
<Address>
<StreetLines>lwehcfkwdjh</StreetLines>
<City>NY</City>
<StateOrProvinceCode>NY</StateOrProvinceCode>
<PostalCode>12345</PostalCode>
<CountryCode>US</CountryCode>
<Residential>true</Residential>
</Address>
</Recipient>
<ShippingChargesPayment>
<PaymentType>SENDER</PaymentType>
<Payor>
<ResponsibleParty>
<AccountNumber>444444444</AccountNumber>
<Tins>
<TinType>BUSINESS_STATE</TinType>
<Number>4444444444</Number>
</Tins>
<Contact>
<CompanyName>aaaaaaaaa</CompanyName>
<PhoneNumber>111111111</PhoneNumber>
</Contact>
<Address>
<ADDRESS HERE>
</Address>
</ResponsibleParty>
</Payor>
</ShippingChargesPayment>
<SmartPostDetail>
<Indicia>PARCEL_SELECT</Indicia>
<AncillaryEndorsement>ADDRESS_CORRECTION</AncillaryEndorsement>
<SpecialServices>USPS_DELIVERY_CONFIRMATION</SpecialServices>
<HubId>1234</HubId>
<CustomerManifestId>123456</CustomerManifestId>
</SmartPostDetail>
<LabelSpecification>
<LabelFormatType>COMMON2D</LabelFormatType>
<ImageType>EPL2</ImageType>
<LabelStockType>STOCK_4X6</LabelStockType>
</LabelSpecification>
<RateRequestTypes>LIST</RateRequestTypes>
<PackageCount>3</PackageCount>
<RequestedPackageLineItems>
<SequenceNumber>1</SequenceNumber>
<GroupPackageCount>1</GroupPackageCount>
<Weight>
<Units>LB</Units>
<Value>5</Value>
</Weight>
<Dimensions>
<Length>7</Length>
<Width>7</Width>
<Height>7</Height>
<Units>IN</Units>
</Dimensions>
<CustomerReferences>
<CustomerReferenceType>INVOICE_NUMBER</CustomerReferenceType>
<Value>E2315141</Value>
</CustomerReferences>
<CustomerReferences>
<CustomerReferenceType>CUSTOMER_REFERENCE</CustomerReferenceType>
<Value>E2315141</Value>
</CustomerReferences>
</RequestedPackageLineItems>
</RequestedShipment>
</ProcessShipmentRequest>

You give us almost nothing to work with, so it's hard to be any help at all. But there's one thing that seems strange in your request body. Assuming that you're showing us a dump of a Perl data structure, it seems weird that all of your scalar values are implemented as anonymous arrays. For example, the line defining the package count is:
'PackageCount' => [ 3],
Where I'd expect to see:
'PackageCount' => 3,
It's possible that you have access to some documentation that tells you to do it this way, but it seems strange to me.
It would also explain the error message as the array reference would be interpreted as an integer which would almost certainly be far greater than any number expected by the API!
Update: When I wrote this answer, the question included what looked like a large Perl data structure which exhibited the weirdness that I discuss above. Now that has been changed to an XML document which seems to have the correct values. I have no idea where the original data structure came from or how it was used. And, in the absence of any feedback from the original poster, I have no idea how useful this answer is.

Related

LogRhythm SOAP Api problems

Anyone here manage to get something from LR soap API ?
My query is quite simple, here is an extract:
<soap:Body>
<GetAlarmHistoryByID
xmlns="http://www.logrhythm.com/webservices"
xmlns:ns2="http://schemas.microsoft.com/2003/10/Serialization/Arrays"
xmlns:ns3="http://schemas.microsoft.com/2003/10/Serialization/">
<alarmID>140</alarmID>
<includeNotifications>false</includeNotifications>
<includeComments>false</includeComments>
</GetAlarmHistoryByID>
</soap:Body>
I receive the following in response, which makes no sense, because of "Include notifcations or include comments is required." but the values are found lower:
includeNotifications: 140 include comments: False (inversed from the values i passed...)
<s:Fault>
<faultcode>s:Client</faultcode>
<faultstring xml:lang="en-US">Include notifcations or include comments is required.</faultstring>
<detail>
<LogRhythmWebServiceFault
xmlns="http://www.logrhythm.com/webservices"
xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<FaultID>4d12a9ed-bff7-4dfb-ad71-29372c12544d</FaultID>
<Details>Error getting Alarm history (includeNotifications: 140 include comments: False) for ID False</Details>
<FaultTime>2017-09-07T17:46:22.5779477Z</FaultTime>
<ErrorID>3024</ErrorID>
</LogRhythmWebServiceFault>
</detail>
</s:Fault>
Method: GetAlarmHistoryByID
Retrieve a list of alarm status and comment updates. The Alarm ID would be derived from one of the GetFirstPageAlarms or a GetNextPageAlarms method call.
alarmID long No The unique ID of the alarm.
includeNotifications boolean No If true, include notification history.
includeComments boolean No If true, include comments history.
Output
The alarm history.
I had a similar problem and it ended up being a bug with the calls on LogRhythm's side. I'd advise to make a ticket with them for a resolution. If you haven't figured it out yet

ValidationError when sparse updating a Payment trying to specify new LinkedTxn lines

I am trying to perform a sparse update on a QuickBooks Online Payment object using the .NET SDK. For some reason as soon as I try to specify a <Line> element in the update request, I get a ValidationError requiring a CustomerRef.
Request:
<?xml version="1.0"?>
<Payment xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" sparse="true" xmlns="http://schema.intuit.com/finance/v3">
<Id>1060</Id>
<SyncToken>3</SyncToken>
<TxnDate>2014-11-25</TxnDate>
<PrivateNote />
<Line>
<Amount>390.0000</Amount>
<LinkedTxn>
<TxnId>1308</TxnId>
<TxnType>Invoice</TxnType>
</LinkedTxn>
</Line>
<TotalAmt>390.0000</TotalAmt>
</Payment>
Response:
{"Fault": {
"Error": [{
"Message":"Required param missing, need to supply the required value for the API",
"Detail":"Required parameter CustomerRef is missing in the request",
"code":"2020",
"element":"Payment"}],
"type":"ValidationFault"},
"time":"2015-01-20T07:20:15.191-08:00"}
I thought a sparse update meant that anything you did not specify stayed the same as the original entity. I can't see anything that says one way or the other in the documentation. Do I need to fetch the CustomerRef from the current entity to feed it back to the API and keep it happy, or am I just doing something wrong?
Although this is Sparse update but I believe the customerref is required, as a 'validation check for Customer' is needed when you send the Update request. This check is needed to verify that CustomerRef for Updated payment is same as the Invoice's CustomerRef. So, you should send it in your request.

What is an InstallationID in Quickbooks QBMSXML

I have a qbmsxml that I'm sending that continues to get a response error 2000.
<qbmsxml>
<signonmsgsrq>
<signondesktoprq>
<clientdatetime>2014-04-03T09:37:23</clientdatetime>
<applicationlogin>my.application.login.id</applicationlogin>
<connectionticket>SDK-MY-Connection-Ticket</connectionticket>
<language>English</language>
<appid>9999999999</appid>
<appver>1.0</appver>
</signondesktoprq>
</signonmsgsrq>
<qbmsxmlmsgsrq>
<customercreditcardauthrq>
<transrequestid>140403937231</transrequestid>
<creditcardnumber>4111111111111111</creditcardnumber>
<expirationmonth>12</expirationmonth>
<expirationyear>2017</expirationyear>
<isecommerce>true</isecommerce>
<amount>0.01</amount>
<nameoncard>John Doe</nameoncard>
<creditcardaddress>1234 Main Street</creditcardaddress>
<creditcardpostalcode>12345</creditcardpostalcode>
</customercreditcardauthrq>
</qbmsxmlmsgsrq>
</qbmsxml>
As I've been reviewing the information on creating a request, I found an 'InstallationID' tag referenced. It goes in the element like so:
<signonmsgsrq>
<signondesktoprq>
<clientdatetime>2014-04-03T09:37:23</clientdatetime>
<applicationlogin>my.application.login.id</applicationlogin>
<connectionticket>SDK-MY-Connection-Ticket</connectionticket>
<installationid>IDTYPE</installationid>
<language>English</language>
<appid>9999999999</appid>
<appver>1.0</appver>
</signondesktoprq>
</signonmsgsrq>
My question is: What is the IDTYPE for InstallationID? Where can I get it? What options can I set it to?
I think the problem is not related to your InstallationID field at all. I think the problem is that your XML isn't conforming to what Intuit expects.
Specifically, everything in your XML request is lowercase, when Intuit expects it to be camel case. You're also missing a qbmsxml version header, and a xml version header.
Here's an example of a correctly formed request:
<?xml version="1.0" encoding="utf-8"?>
<?qbmsxml version="3.0"?>
<QBMSXML>
<SignonMsgsRq>
<SignonTicketRq>
<ClientDateTime>2009-10-09T13:14:16</ClientDateTime>
<SessionTicket>xxxxxxxxxxxxky4yL6eBtCULX1zgQ:106892184</SessionTicket>
</SignonTicketRq>
</SignonMsgsRq>
<QBMSXMLMsgsRq>
<CustomerCreditCardChargeRq>
<TransRequestID>35f9cf7cb20994e8a32e6b3e91e8e602</TransRequestID>
<CreditCardNumber>xxxxxxxxxxxx5100</CreditCardNumber>
<ExpirationMonth>10</ExpirationMonth>
<ExpirationYear>2009</ExpirationYear>
<Amount>295.00</Amount>
<NameOnCard>Keith Palmer</NameOnCard>
<CreditCardAddress>56 Cowles Road</CreditCardAddress>
<CreditCardPostalCode>06279</CreditCardPostalCode>
</CustomerCreditCardChargeRq>
</QBMSXMLMsgsRq>
</QBMSXML>
Where are you getting your syntax from? It seems very wrong... here are some good examples:
http://wiki.consolibyte.com/wiki/doku.php/quickbooks_qbms_integration

Retrieve a List of All Checks for an Account using qbXML

I'm working on a website for a client that integrates into QuickBook desktop. I need to get a listing of all the checks for a specific account (ideally I would like all transactions for that account [regardless of their type] but if I have to get them one at a time that's fine). When I send the following XML:
<ns1:sendRequestXMLResponse>
<ns1:sendRequestXMLResult>
<xml version="1.0" encoding="utf-8" ?>
<qbxml version="12.0"?>
<QBXML>
<QBXMLMsgsRq onError="stopOnError">
<CheckQueryRq>
<AccountFilter>
<ListID>800000F1-1362066981</ListID>
</AccountFilter>
<IncludeLineItems>true</IncludeLineItems>
</CheckQueryRq>
</QBXMLMsgsRq>
</QBXML>
</ns1:sendRequestXMLResult>
</ns1:sendRequestXMLResponse>
I receive the following error:
<CheckQueryRs statusCode="1" statusSeverity="Info" statusMessage="A query request did not find a matching object in QuickBooks" />
If I go into QuickBooks I can see there are checks associated with the account so I'm not sure why this doesn't return a result.
Update 1: I rewrote this without the AccountFilter so it returned every check and I found checkes with the 800000F1-1362066981 account. It's also 10 MB so it's really hard to work with. :-)

Referring to Dumped LinkedIn API data

Quick problem here that I don't know how to solve and thought you guys could give me a heads-up on which way to go. I have successfully pulled all my connection data using the LinkedIn REST API both in XML and JSON and dumped them (the former using the cPickle plugin). The issue is that I need to refer to a single field within the data and so decided to use XML as it seemed to be the easiest one to use by far. When I refer to the specific field in my .pickle file, it gives me the following error:
AttributeError: 'str' object has no attribute 'location'
However, opening the pickle file with notepad, I can see that all my connections do have their location field stored in the XML format. It's very strange!
Here's my referral code:
import cPickle
connections_data = 'linkedin_connections.pickle'
response = cPickle.load(open(connections_data))
print response
locations = [ec.location for ec in response]
I have a print function set up to show what's in my file and all of the data appears as a normal XML output using the people call of the REST API. The XML data appears as follows:
<person>
<id>ID_number</id>
<first-name>blah</first-name>
<last-name>blah</last-name>
<headline>Business Development and Sales Executive at Computaris</headline>
<picture-url>picture_url</picture-url>
<api-standard-profile-request>
<url>profile_request</url>
<headers total="1">
<http-header>
<name>x-li-auth-token</name>
<value>name</value>
</http-header>
</headers>
</api-standard-profile-request>
<site-standard-profile-request>
<url>request_url</url>
</site-standard-profile-request>
<location>
<name>location</name>
<country>
<code>country_code</code>
</country>
</location>
<industry>industry</industry>
Any help will be much appreciated.