Re: Problem with SOAP and authentication? SoapFault exception: [HTTP] Unauthorized

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

I am using soapUI which is a client soap tester (that works with this
webservice) to compare what is being generated.  In the header I see
Authorization: Basic =XYS....

So the default (using SoapClient) should also work...

I've captured the tcpdump file and will try to load using wireshark.

On Tue, Jun 29, 2010 at 5:18 PM, Richard Quadling <rquadling@xxxxxxxxx>wrote:

> On 29 June 2010 20:53, robert mena <robert.mena@xxxxxxxxx> wrote:
> > Hi Richard,
> > Thanks for taking the time.
> >
> > Unfortunately I can't give you access to the actual webservice.   I am
> using
> > Zend_Soap_Client so my code is like this
> > $soapOptions = array(
> >       "login"      => 'xxx',
> >       "password"   => 'yyyyy');
> > $client = new Zend_Soap_Client('http://myproviders.com/wsdl.xml',
> > $soapOptions);
> > $rc = $client->mi_request($var);
> > I get
> > PHP Fatal error:  Uncaught SoapFault exception: [HTTP] Unauthorized in
> > /usr/local/zend/share/ZendFramework/library/Zend/Soap/Client.php:987
> > Stack trace:
> > #0 [internal function]: SoapClient->__doRequest('<?xml version="...',
> > 'http://10.200....', 'http://sap.com/...', 2)
> > #1 /usr/local/zend/share/ZendFramework/library/Zend/Soap/Client.php(987):
> > call_user_func(Array, '<?xml version="...', 'http://10.200....',
> > 'http://sap.com/...', 2)
> > #2 [internal function]:
> > Zend_Soap_Client->_doRequest(Object(Zend_Soap_Client_Common), '<?xml
> > version="...', 'http://10.200....', 'http://sap.com/...', 2, 0)
> > #3
> >
> /usr/local/zend/share/ZendFramework/library/Zend/Soap/Client/Common.php(70):
> > call_user_func(Array, Object(Zend_Soap_Client_Common), '<?xml
> version="...',
> > 'http://10.200....', 'http://sap.com/...', 2, 0)
> > #4 [internal function]: Zend_Soap_Client_Common->__doRequest('<?xml
> > version="...', 'http://10.200....', 'http://sap.com/...', 2, 0)
> > #5
> /usr/local/zend/share/ZendFramework/library/Zend/Soap/Client.php(1113):
> > SoapClient->__soapCall('mi_request_ in
> > /usr/local/zend/share/ZendFramework/library/Zend/Soap/Client.php on line
> 987
> > Calling the SoapClient directly gives me the same result.
> >
> > On Tue, Jun 29, 2010 at 9:41 AM, Richard Quadling <rquadling@xxxxxxxxx>
> > wrote:
> >>
> >> On 29 June 2010 13:58, robert mena <robert.mena@xxxxxxxxx> wrote:
> >> > I was hoping for a "userland" soap library (like nuSoap if I
> understand
> >> > correctly).   I can't change the fact that the remote webservice
> >> > requires
> >> > http auth.
> >> > Hopefully someone in this list uses either zend_soap or soapClient
> >> > directly
> >> > with auth to confirm or deny that the problem is in this part
> >> > specifically.
> >> >
> >> > On Tue, Jun 29, 2010 at 7:23 AM, Richard Quadling <
> rquadling@xxxxxxxxx>
> >> > wrote:
> >> >>
> >> >> On 28 June 2010 22:37, robert mena <robert.mena@xxxxxxxxx> wrote:
> >> >> > Hi,
> >> >> > I'll have a look.  I am using Zend Framework's Zend_Soap_Client
> which
> >> >> > in
> >> >> > turn uses SoapClient.  I'll try to use SoapClient directly.
> >> >> > I am not using https and I am not going through a proxy (using a
> non
> >> >> > standard port).  I've tested with another SOAP client (a standalone
> >> >> > application called SoapUI) without a problem.
> >> >> >
> >> >> > Is there anyone using SoapClient (or Zend_Soap_Client) with auth
> with
> >> >> > success?   What other library (that does not use SoapClient) could
> I
> >> >> > try?
> >> >> > On Mon, Jun 28, 2010 at 6:27 AM, Richard Quadling
> >> >> > <rquadling@xxxxxxxxx>
> >> >> > wrote:
> >> >> >>
> >> >> >> On 26 June 2010 23:46, robert mena <robert.mena@xxxxxxxxx> wrote:
> >> >> >> > Hi,
> >> >> >> >
> >> >> >> > I am trying to access a webservice using php's soapclient but I
> >> >> >> > keep
> >> >> >> > getting
> >> >> >> > the error SoapFault exception: [HTTP] Unauthorized
> >> >> >> >
> >> >> >> > If I try using a web browser I can authenticate using the same
> >> >> >> > credentials
> >> >> >> > used by the php code.
> >> >> >> >
> >> >> >> > I've searched but the only mention that I found led to a 'won't
> >> >> >> > fix'
> >> >> >> > bug
> >> >> >> > registered to php 5.1.6.  I am using 5.2.10.
> >> >> >> >
> >> >> >> > Any ideas of what may be causing this?  Is there a workaround?
> >> >> >> >
> >> >> >> > Regards.
> >> >> >> >
> >> >> >>
> >> >> >> Can you show the SoapClient construction you are using?
> >> >> >>
> >> >> >> The documentation says that you can supply HTTP authentication [1]
> >> >> >> ...
> >> >> >>
> >> >> >> "For HTTP authentication, the login and password options can be
> used
> >> >> >> to supply credentials. For making an HTTP connection through a
> proxy
> >> >> >> server, the options proxy_host, proxy_port, proxy_login and
> >> >> >> proxy_password are also available. For HTTPS client certificate
> >> >> >> authentication use local_cert and passphrase options. An
> >> >> >> authentication may be supplied in the authentication option. The
> >> >> >> authentication method may be either SOAP_AUTHENTICATION_BASIC
> >> >> >> (default) or SOAP_AUTHENTICATION_DIGEST."
> >> >> >>
> >> >> >> There was recent activity on a Soap Authorisation Header bug [2].
> >> >> >>
> >> >> >> If this issue is appropriate, you can try a building your code
> code
> >> >> >> from SVN (no win32 snapshots for a LONG time now).
> >> >> >>
> >> >> >> Regards,
> >> >> >>
> >> >> >> Richard.
> >> >> >>
> >> >> >> [1] http://docs.php.net/manual/en/soapclient.soapclient.php
> >> >> >> [2] http://bugs.php.net/bug.php?id=50976
> >> >> >> --
> >> >> >> -----
> >> >> >> Richard Quadling
> >> >> >> "Standing on the shoulders of some very clever giants!"
> >> >> >> EE : http://www.experts-exchange.com/M_248814.html
> >> >> >> EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp
> >> >> >> Zend Certified Engineer :
> >> >> >> http://zend.com/zce.php?c=ZEND002498&r=213474731
> >> >> >> ZOPA : http://uk.zopa.com/member/RQuadling
> >> >> >
> >> >> >
> >> >>
> >> >> You can, of course, do it all yourself with cURL or sockets, but I
> >> >> believe the overhead would be significant.
> >> >>
> >> >> I think in the first instance, can we see the code you are using to
> >> >> make the request?
> >> >>
> >> >> I use the Zend_Soap_[Client|Server|WSDL|AutoDiscovery] but not with
> >> >> external Auth (like you are wanting). Instead, one of my services is
> >> >> the auth service (username is sent plain text and password is sent
> MD5
> >> >> with a nonce - I believe the principle is sound. I chose this as I
> was
> >> >> being REALLY lazy in not learning about how to do Auth any other way.
> >> >>
> >> >> Richard.
> >> >>
> >> >>
> >> >> --
> >> >> -----
> >> >> Richard Quadling
> >> >> "Standing on the shoulders of some very clever giants!"
> >> >> EE : http://www.experts-exchange.com/M_248814.html
> >> >> EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp
> >> >> Zend Certified Engineer :
> >> >> http://zend.com/zce.php?c=ZEND002498&r=213474731
> >> >> ZOPA : http://uk.zopa.com/member/RQuadling
> >> >
> >> >
> >>
> >> Can you provide a link to the service? I'm willing to help you through
> >> this, but you have to give us something to work with.
> >>
> >> I do see that you've asked several questions here and not had the
> >> greatest of responses.
> >>
> >> Often that means no-one knows an answer.
> >>
> >> So, when someone DOES pay interest ...
> >>
> >> Regards,
> >>
> >> Richard.
> >> --
> >> -----
> >> Richard Quadling
> >> "Standing on the shoulders of some very clever giants!"
> >> EE : http://www.experts-exchange.com/M_248814.html
> >> EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp
> >> Zend Certified Engineer :
> http://zend.com/zce.php?c=ZEND002498&r=213474731
> >> ZOPA : http://uk.zopa.com/member/RQuadling
> >
> >
>
> What type of HTTP authentication is the server using? Basic or Digest?
>
> PHP's SoapClient supports the setting of an authentication option [1].
>
> "An authentication may be supplied in the authentication option. The
> authentication method may be either SOAP_AUTHENTICATION_BASIC
> (default) or SOAP_AUTHENTICATION_DIGEST."
>
> But the Zend_Soap_Client code does not support this option. You'd have
> to add it. Pretty simple to do.
>
> But that is only if PHP actually supports the digest mechanism.
>
> Can you adapt your code to test the use of PHP's SoapClient with a
> third option of ...
>
> 'authentication' => SOAP_AUTHENTICATION_DIGEST,
>
> If that works, then I can help you get the Zend_Soap_Client working
> with it and send the patches to Zend.
>
> Richard.
>
>
> [1] http://docs.php.net/manual/en/soapclient.soapclient.php
>
> --
> -----
> Richard Quadling
> "Standing on the shoulders of some very clever giants!"
> EE : http://www.experts-exchange.com/M_248814.html
> EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp
> Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
> ZOPA : http://uk.zopa.com/member/RQuadling
>

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux