USPS 500 error

  • Posts: 16
  • Thank you received: 3
11 years 1 week ago #131874

I have installed a clean Joomla version and clean Hikashop version on my local server where I can guaranteed there is no problem with connecting to the USPS API website. Errors persist.

Apparently USPS had done something to their API which Hikashop will have to change in the plugin.

In the meantime, I have reverted to a more complicated manual shipping setup I used before enabling the USPS plugin.

Hopefully this can be resolved soon.

Please Log in or Create an account to join the conversation.

  • Posts: 26158
  • Thank you received: 4028
  • MODERATOR
11 years 1 week ago #131878

Hi,

By giving us useful information for debugging.
Like explain in the post 131863 : www.hikashop.com/forum/shipping-methods/...00-error.html#131863
We do not have USPS account so we can't test. So we are like blind people.

You can also follow the instruction that Nicolas gave you by mails.
And you know, we are also closed today :)

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

Please Log in or Create an account to join the conversation.

  • Posts: 73
  • Thank you received: 1
11 years 1 week ago #131882

Hi timerlinetom

I cannot contact usps today, so can you tell me how you managed that:
"In the meantime, I have reverted to a more complicated manual shipping setup I used before enabling the USPS plugin."

Thank you

Please Log in or Create an account to join the conversation.

  • Posts: 16
  • Thank you received: 3
11 years 1 week ago #131889

I had setup several manual shipping options increasing in price with increases in weight. This was pure guess and not very accurate. You really need to do your own calculations - mine are not correct. But at least I get something for shipping while the plugin in not working. I attached a screenshot, only good for example, you must do your own calculations.

Attachments:

Please Log in or Create an account to join the conversation.

  • Posts: 73
  • Thank you received: 1
11 years 1 week ago #131892

Thank you :-)
I hope that Ikashop will find a solution very soon for this excellent plugin...

Please Log in or Create an account to join the conversation.

  • Posts: 16
  • Thank you received: 3
11 years 1 week ago #131899

Sorry, inserting the above code is not giving me any more information. Only 4 lines of errors I've already noted.

Edit:::
Sorry, I should have clarified. I was using the code requested in posting:
www.hikashop.com/forum/shipping-methods/...rt=0&start=20#131863

I just get a blank screen, no additional information in server logs, php error logs or displayed on the screen.

Last edit: 11 years 1 week ago by timberlinetom. Reason: missing information

Please Log in or Create an account to join the conversation.

  • Posts: 26158
  • Thank you received: 4028
  • MODERATOR
11 years 1 week ago #131926

Hi,

Thanks for the information.
Can you just try to use the "view page source code" because it is possible that USPS return some XML which is not understandable for the browser so it does not display it. I should have use the "htmlentities" function in order to transform all the content into a readable HTML text..

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

Please Log in or Create an account to join the conversation.

  • Posts: 16
  • Thank you received: 3
11 years 1 week ago #131931

What I got is:

HTTP/1.1 500 Error
X-Backside-Transport: FAIL FAIL
Content-Type: text/xml
Connection: close

Please Log in or Create an account to join the conversation.

  • Posts: 26158
  • Thank you received: 4028
  • MODERATOR
11 years 1 week ago #131934

Hi,

Interesting !
Can you modify the plugin and change the $req value by:

			$req = "GET /ShippingAPI.dll?API=" . $apiName . "&XML=" . urlencode($XMLRequest) . " HTTP/1.1\r\n".
				'Server: '.$_SERVER['SERVER_SOFTWARE']."\r\n".
				'Host: production.shippingapis.com'."\r\n".
				'Content-Type: text/xml'."\r\n".
				'Accept: */'.'*'."\r\n".
				'Connection: close'."\r\n\r\n";
Maybe sending more data for the HTTP headers will fix it.
Just an idea like that :)

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

Please Log in or Create an account to join the conversation.

  • Posts: 16
  • Thank you received: 3
11 years 1 week ago #131938

HTTP/1.1 200 OK
X-Backside-Transport: OK OK
Connection: Keep-Alive
Transfer-Encoding: chunked
Date: Tue, 12 Nov 2013 03:32:52 GMT
Server: Microsoft-IIS/6.0
X-Powered-By: ASP.NET
X-Client-IP: 56.0.70.6
Content-Type: text/xml

27
<?xml version="1.0" encoding="UTF-8"?>

17c
<RateV4Response><Package ID="1"><ZipOrigination>80923</ZipOrigination><ZipDestination>49426</ZipDestination><Pounds>1</Pounds><Ounces>0</Ounces><Container>VARIABLE</Container><Size>REGULAR</Size><Zone>6</Zone><Postage CLASSID="1"><MailService>Priority Mail 2-Day&amp;lt;sup&amp;gt;&amp;#8482;&amp;lt;/sup&amp;gt;</MailService><Rate>6.20</Rate></Postage></Package></RateV4Response>
0

Please Log in or Create an account to join the conversation.

  • Posts: 26158
  • Thank you received: 4028
  • MODERATOR
11 years 1 week ago #131944

Hi,

So I think that if you remove the "die", it should work now.. Right ?

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

Please Log in or Create an account to join the conversation.

  • Posts: 16
  • Thank you received: 3
11 years 1 week ago #131948

You would think. But I still get an absolutely blank page. Using Chrome, if inspect elements, all I see is an empty table. I attached a screenshot.

Attachments:

Please Log in or Create an account to join the conversation.

  • Posts: 73
  • Thank you received: 1
11 years 1 week ago #132040

Any progress on this important issue?...
Any fix?
I am in the trouble about that...

Please Log in or Create an account to join the conversation.

  • Posts: 26158
  • Thank you received: 4028
  • MODERATOR
11 years 1 week ago #132076

Hi timberlinetom,

Mhmm, I guess that the truncated return is not read correctly by the plugin.
I think that USPS changed their servers which now only manage HTTP/1.1
The plugin developed by an external developer/company (who gave us the plugin for free) does not handle the connection like we did generally.
Well, I rewrite the function "doUPS" in order to use cURL and not a raw socket. It is quite better to respect standards and have a right processed result.

Please test this new function, I hope that it will return a better result.

	function doUSPS($XMLRequest, $domesticShipment) {
		$apiName = 'RateV4';

		// Change API name if this is an International shipment.
		// Determined by $domesticShipping boolean value.
		//
		if($domesticShipment == false)
			$apiName = 'IntlRateV2';

		$url = 'http://production.shippingapis.com/ShippingAPI.dll?API=' . $apiName . '&XML=' . urlencode($XMLRequest);

		$session = curl_init();
		curl_setopt($session, CURLOPT_FRESH_CONNECT,  true);
		curl_setopt($session, CURLOPT_POST,           false);
		curl_setopt($session, CURLOPT_FOLLOWLOCATION, false);
		curl_setopt($session, CURLOPT_FAILONERROR,    true);
		curl_setopt($session, CURLOPT_RETURNTRANSFER, true);
		curl_setopt($session, CURLOPT_COOKIEFILE,     '');
		curl_setopt($session, CURLOPT_SSL_VERIFYPEER, false);
		curl_setopt($session, CURLOPT_SSL_VERIFYHOST, false);
		curl_setopt($session, CURLOPT_ENCODING,       'UTF-8');
		curl_setopt($session, CURLOPT_URL,            $url);
		$result = curl_exec($session);
		$error = curl_error($session);

		if(empty($result)) {
			$app = JFactory::getApplication();
			$app->enqueueMessage( 'Cannot connect to USPS web service. You hosting company might be blocking outbound connections.<br/>'.$error);
			return false;
		}

		$responseDoc = simplexml_load_string($result);
		if($responseDoc === false) {
			$app = JFactory::getApplication();
			$app->enqueueMessage('Cannot dialog with USPS web service.<br/>'.$result);
			return false;
		}
		return $responseDoc;
	}

@Julian56 : I said you a high number of time that if you want to help you can make some tests, follow this thread and like the other people, try some things to solve the problem. But asking like you did, will not help anything.
We know that it is a big problem but.. sending us a lot of messages without any useful information does not help.
I prefer to be direct and honest. I hope that I am clear enough and that you understand that we also want to solve this problem as fast as possible.
At the moment that we will have a news, you will know because we concentrated the USPS problem on this single thread.

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.
The following user(s) said Thank You: julian56

Please Log in or Create an account to join the conversation.

  • Posts: 73
  • Thank you received: 1
11 years 1 week ago #132081

Sorry about that!!!
I am not familiar with the way to communicate with forums and I didn't find the way to delete few of my posts... I will be more attentive :-) Thank you anyway for your work!

Please Log in or Create an account to join the conversation.

  • Posts: 100
  • Thank you received: 2
11 years 1 week ago #132082

I spoke with USPS -- they are aware of the problem. It was an upgrade that went out Saturday morning and was only supposed to affect the USPS internal server but ended up affecting the production servers too.

They are working hard to come up with the coding to give us to fix out plugins but can't give me a timeframe on that. A release note will be available on the USPS.com web tools page once they have the code for us.

Please Log in or Create an account to join the conversation.

  • Posts: 16
  • Thank you received: 3
11 years 1 week ago #132084

Jerome, that did the trick. I've shown results attached. I see "Media Mail" now as an option which did not exist before so I think you are getting better results from the API call.

Might I suggest that until you can make a new release, you upload a revised 'usps.php' file. That will spare uses the concern of which chunk of code to replace.

I'm glad to see Hikashop include the plugin for USPS shipping with the core program now. I did not realize you had no access to developer resources. Since USPS is a significant and critical shipping option for United States customers like myself ( and Julian56 ;) ), you should check out the resources available at www.usps.com/business/web-tools-apis/ . I see that the USPS had a release of their API last July and I'm guessing they left legacy code for transition purposes which was removed last weekend. Perhaps if you get signed up on their website as a developer you can proactively update and support this important plugin. I'm afraid that while I claim a relatively high level of competence, I'm not good enough to be a programmer.

Thanks for your assistance with this.

Attachments:

Please Log in or Create an account to join the conversation.

  • Posts: 73
  • Thank you received: 1
11 years 1 week ago #132085

I just updated the usps.php with your code and it works very well! :-)
Thank you again for your hard work and sorry for the stress!!!

Please Log in or Create an account to join the conversation.

  • Posts: 100
  • Thank you received: 2
11 years 1 week ago #132096

I am confused about which code to replace. Can anyone clarify for me? I am not a programmer by any stretch of the imagination!

Thanks!!

Please Log in or Create an account to join the conversation.

  • Posts: 21
  • Thank you received: 7
11 years 1 week ago #132103

That worked for me too.

joanne721
upload the file attached too directory: plugins/hikashopshipping/usps/

File Attachment:

File Name: h58da9b7.txt
File Size:28 KB


rename attached file to usps.php

Attachments:
Last edit: 11 years 1 week ago by cboyd213.
The following user(s) said Thank You: Bendite, 3by400, kd5lcf, sixmaster

Please Log in or Create an account to join the conversation.

Time to create page: 0.121 seconds
Powered by Kunena Forum