SoapFault Unauthorized - Connecting to Purolator Webservices - php

I am getting intermittent "Unauthorized" error messages, when attempting to call an external web service. When I get this message, if I continually reload the page, it will eventually work.
Has anyone ever encountered a similar problem? Do you think it is a server issue? I am kinda wondering if it is a bad load balanced server or something.
The web service is being called via HTTPS.

Thank you for your question.
The "401 Unauthorized" error can be caused by the following issues:
Wrong development / production key or wrong development / production password. Please double check that the credentials you are providing are the ones given by Purolator when you applied for the keys. If five consecutive requests are sent to the server with a wrong password, the key automatically gets locked. You will either have to apply for another key or contact Purolator to unlock your key. (Note there are special characters that are part of the passwords like ":", "$" etc, you might need to use single cotes or the escape character)
Pointing to the wrong server.
If you are using the example codes on the Resource Center in your development stage, these are pointing to the production server. In order to fix this, you just need to add "DEV" (development) as a prefix for the location URL:
For example in PHP: 'location' => "https://devwebservices.purolator.com/PWS/V1/ShippingDocuments/ShippingDocumentsService.asmx" (in this case for Shipping Documents Service)
To point to the Production server use: 'location' => "https://webservices.purolator.com/PWS/V1/ShippingDocuments/ShippingDocumentsService.asmx" (in this case for Shipping Documents Service)
Feel free to post any Purolator specific questions (web services) on our Technical Support Forum for a prompt response: http://purolatorwebservices.com
Thank you,
Purolator E-Ship Web Services Team
webservices#purolator.com

Related

Adding Shibboleth authentication to Symfony

I've been developing a Symfony app (learning Symfony with the goal of replacing an existing "old school" PHP script with it) and am having an issue with putting it "behind" our Shibboleth authentication.
Why do that? For this app I need $_SERVER['REMOTE_USER']. The app doesn't have local accounts, the user doesn't log into the app, but, like many resources, we protect them with some form of authentication.
I have two sites - virtual hosts running on the same physical server. (CentOS 7). The first site has the following in its .htaccess file:
authtype shibboleth
ShibRequestSetting requireSession 1
require valid-user
I have a "phpinfo.php" file in there, too, and can run that script and, after the Shibboleth authentication step, get the output which includes the correct value of REMOTE_USER.
The other virtual host is set up as a Symfony 3.1 app. I've added those three lines to the top of its ".htaccess" file - but after going through the Shibboleth authentication step, the browser gets into a loop and goes no farther. (In Chrome, the 'favicon' is replaced with a looping arrow, and it never stops turning.)
If I hit and then view the source of this still-empty page, I see the following error message:
Error Message: Error decoding authentication request message
I'm not sure how to start to resolve this issue, and was hoping that someone has seen this and knows how to help.
Thanks.
Best,
Stephen
If I understand well, you are trying to make the Service Provider part in Symfony and you already have an IDP working with Shibboleth.
In my case I had also a similar problem and it was because after the Assertion the apache SP was returning to the root URL. I learnt after reading a lot of documentation that if this is not set correctly you can add an attribute in the shibbolet2.xml configuration called homeURL:
<ApplicationDefaults entityID="https://sso/saml2/idp/metadata.php"
REMOTE_USER="mail"
homeURL="https://symfonyApp/redirect/after/login">
Try it out and restart the shib daemon: /etc/init.d/shibd restart
It may be another as well. But it sounds to me that there is some misconfiguration in your SP side.

How do I add a webhook to my local magento website in mailchimp without exposing the URL publicly (for SEO reasons)?

I am using the magemonkey extension from Ebizmart and when i save my config in the admin i get the following error:
Could not add Webhook "http://example.com/monkey/webhook/index/wkey//" for list "Test Mailing List", error code 508, We couldn't connect to the specified the URL. Please double check and try again.
I did some digging and arrived at the conclusion (duh) that mailchimp cannot see my local environment so it's unable to add the webhook. Is it possible for me to configure this locally for testing purposes or do I have to wait until the site is live (sounds pretty strange to me)?
UPDATE: I reached out to Mailchimp and got the following response. Seems like they won't add a host entry to recognize my test environment. The only way to accomplish this would be to use a handshake key.
Thanks for reaching out to MailChimp support. I can certainly understand the concern here and will be happy to help.
Unfortunately, any webhooks being used must be publically available and there would not be a way to add a host entry in MailChimp so that the URL can be used.
If your testing environement allows for HandShake keys, one options might be to add that on to the url: (can't add more than 2 links)
At MailChimp we definitely appreciate testing and encourage it with our users and I will be sure to pass this feedback along to our developers so that testing in closed environments might be a bit easier. I also wanted to provide a link to our feedback form in case you wanted to leave some feedback for our developers directly: (can't add more than 2 links)
If you have any additional questions or concerns, feel free to reach back out and we will be happy to help.
Thank you,
Mikey
Use https://ngrok.com/, available for all platforms.
It allows you to tunnel requests to your local dev machine. It's very easy to use, just download and run:
ngrok http 80
Then it'll show you the forwarding URL (where xxx is randomly generated):
Forwarding https://xxxxxxxx.ngrok.io -> localhost:80
Use https://xxxxxxxx.ngrok.io as the begining of your webhook callback URL.
Once it's running, a web interface is available at http://127.0.0.1:4040 that shows metrics and let's you replay requests.

Bad Signed JSON signature for a single app

I'm working on an application that serves multiple Facebook apps from a single source. It's structured so that multiple apps can be served from multiple machines all running the same code - only the config changes per app.
Running one of these apps on my local machine works fine & running all but this one problematic app on the live server also works.
The scenario causing problems is one app running on the live server that triggers the infinite redirect loop and "Bad Signed JSON signature" spammed in the error log.
Since this is a shared codebase and the other apps all work - the logical place to look is in the config - I've checked 3 times now - the App ID, secret and redirect params are correct.
So - Question: Has anyone had this issue and managed to resolve it? Got any tips for me as to where I can look?
Clearly 3 times was not enough - there was a trailing space in the app secret config file.

Is there a way to implement an XMPP client or message reciever that can recieve all the messages from an XMPP server?

Basically im trying to build a bot that can send a message using one of many accounts out to a user and be able to receive messages to that account it originally used process and do whatever I need it to do. So far I found the JAXL library (http://code.google.com/p/jaxl/) but based on examples it is only able to handle one user at a time. Any suggestions or ideas?
thank you in advanced.
btw if there is anyway to make the server automatically forward those messages to another program or whatever that works just as well.
I think you are looking for a external component.... Jaxl v 2.0 does allow you having component bots written in PHP http://github.com/abhinavsingh/JAXL
I think what you're asking is: "Can I send a copy of all the 'outgoing' messages on a server to an XMPP client?" The answer to that question is "sort of."
You're looking at two pieces, server configuration and client/component configuration. You probably don't want a client. because it needs to log in as a particular user. You're describing a component, which is a trusted application running on the XMPP server or nearby, and acts as part of the server.
The server configuration part depends on which server you're using. I know XCP can do this kind of thing, such as with a message archive component. With ma you'd make a component to write the messages to a log or database. You'd be making a similar component that grepped strings for street addresses and sent out flowers, or something -- whatever action you needed to happen.
The big assumption I'm making is that you are in complete control of the server here. If you don't then the answer is "no."
I recently used the smack library to host dozens of 'Xmpp bots'. There was no such limitation that you could only connect as a single user. Just spawned a thread for each bot, made him connect as an individual xmpp user on a server (and even on different servers) and do its job. In my case the bots simply sent test messages to test chat rooms, but a proxy service (as I understood it from your question) is possible as well.
The threads were even designed to create the user and delete it after stopping.

Zend_Uri_Http generates "inet_pton(): Unrecognized address" error

In our application, the backend is accessed via Zend_XmlRpc. In the backend, I'm using Zend_Http_Client together with Zend_Http_Client_Adapter_Curl to connect to another web service over HTTPS.
During unit tests, everything works as expected and the remote service is accessible. But when the frontend connects via Zend_XmlRpc to the backend and causes the backend to do the exact same thing like the unit tests do, I get the following error:
inet_pton(): Unrecognized address test.example.com#0 (url changed)
This is caused by Zend_Validate_Ip->isValid('test.example.com').
The only difference I can spot is the additional frontend-backend-connection which is also using Zend components for communicating. Everything else is the same.
Anybody any idea?
Looks like it might be a resolver issue in the server and zf isn't catching it beforehand. It's getting a hostname where it should be getting an IP address (obviously), and it can't convert a string to a binary IP address
It was an error in Zend_Validate that was fixed with release 1.9.

Categories