SoapClient and Cookies

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • fulatoro

    SoapClient and Cookies

    I am trying to use a webservice method on an ASP .NET server. I am
    running a simple php script on my ubuntu machine. Basically, the ASP
    servers first requires you to login via a login method by supplying
    username and password. It returns a string to indicate whether you
    logged in successfully and also returns a cookie.

    Afther this authentication, you can connect to another service that is
    only accessible if you have received the cookie above. I am able to
    make this work via my browser, where I can login, check for the cookie
    and I am able to access the WSDL file for the protected methods.

    However, I am unable to get it work via a client site php script that
    I run from the command line. I am able to see that I was logged in
    successfully, I can also print_r($client->_cookies['name'][0]) so I
    know I am receiving the cookie. However, it seems like when I try to
    instantiate another client it fails complaining that I cannot access
    the URL provided.

    $clientreq = new SoapClient(.... );

    How do I ensure that the cookie is used on subsequent requests? I
    have seen that Zend classes offer cookie stickiness via
    setCookieJar(). how can achieve this in php.

    Moussa
  • petersprc

    #2
    Re: SoapClient and Cookies

    Hi,

    Try SoapClient->__setCookie( )

    Regards,

    John Peters

    On May 3, 12:24 pm, fulatoro <mus...@gmail.c omwrote:
    I am trying to use a webservice method on an ASP .NET server. I am
    running a simple php script on my ubuntu machine. Basically, the ASP
    servers first requires you to login via a login method by supplying
    username and password. It returns a string to indicate whether you
    logged in successfully and also returns a cookie.
    >
    Afther this authentication, you can connect to another service that is
    only accessible if you have received the cookie above. I am able to
    make this work via my browser, where I can login, check for the cookie
    and I am able to access the WSDL file for the protected methods.
    >
    However, I am unable to get it work via a client site php script that
    I run from the command line. I am able to see that I was logged in
    successfully, I can also print_r($client->_cookies['name'][0]) so I
    know I am receiving the cookie. However, it seems like when I try to
    instantiate another client it fails complaining that I cannot access
    the URL provided.
    >
    $clientreq = new SoapClient(.... );
    >
    How do I ensure that the cookie is used on subsequent requests? I
    have seen that Zend classes offer cookie stickiness via
    setCookieJar(). how can achieve this in php.
    >
    Moussa

    Comment

    • fulatoro

      #3
      Re: SoapClient and Cookies

      Tried it already does not work. The issue is that the Server is
      authenticating as I am doing my second

      $clientreq = new SoapClient("htt p://....$WSDL");

      It is assuming that the cookie is already available as part of the
      session I guess.

      Moussa

      On May 4, 2:08 am, petersprc <peters...@gmai l.comwrote:
      Hi,
      >
      Try SoapClient->__setCookie( )
      >
      Regards,
      >
      John Peters
      >
      On May 3, 12:24 pm, fulatoro <mus...@gmail.c omwrote:
      >
      I am trying to use a webservice method on an ASP .NET server. I am
      running a simple php script on my ubuntu machine. Basically, the ASP
      servers first requires you to login via a login method by supplying
      username and password. It returns a string to indicate whether you
      logged in successfully and also returns a cookie.
      >
      Afther this authentication, you can connect to another service that is
      only accessible if you have received the cookie above. I am able to
      make this work via my browser, where I can login, check for the cookie
      and I am able to access the WSDL file for the protected methods.
      >
      However, I am unable to get it work via a client site php script that
      I run from the command line. I am able to see that I was logged in
      successfully, I can also print_r($client->_cookies['name'][0]) so I
      know I am receiving the cookie. However, it seems like when I try to
      instantiate another client it fails complaining that I cannot access
      the URL provided.
      >
      $clientreq = new SoapClient(.... );
      >
      How do I ensure that the cookie is used on subsequent requests? I
      have seen that Zend classes offer cookie stickiness via
      setCookieJar(). how can achieve this in php.
      >
      Moussa

      Comment

      • petersprc

        #4
        Re: SoapClient and Cookies

        You can use a local WSDL file instead of fetching the second URL.

        Regards,

        John Peters

        On May 5, 2:15 pm, fulatoro <mus...@gmail.c omwrote:
        Tried it already does not work. The issue is that the Server is
        authenticating as I am doing my second
        >
        $clientreq = new SoapClient("htt p://....$WSDL");
        >
        It is assuming that the cookie is already available as part of the
        session I guess.
        >
        Moussa
        >
        On May 4, 2:08 am, petersprc <peters...@gmai l.comwrote:
        >
        Hi,
        >
        Try SoapClient->__setCookie( )
        >
        Regards,
        >
        John Peters
        >
        On May 3, 12:24 pm, fulatoro <mus...@gmail.c omwrote:
        >
        I am trying to use a webservice method on an ASP .NET server. I am
        running a simple php script on my ubuntu machine. Basically, the ASP
        servers first requires you to login via a login method by supplying
        username and password. It returns a string to indicate whether you
        logged in successfully and also returns a cookie.
        >
        Afther this authentication, you can connect to another service that is
        only accessible if you have received the cookie above. I am able to
        make this work via my browser, where I can login, check for the cookie
        and I am able to access the WSDL file for the protected methods.
        >
        However, I am unable to get it work via a client site php script that
        I run from the command line. I am able to see that I was logged in
        successfully, I can also print_r($client->_cookies['name'][0]) so I
        know I am receiving the cookie. However, it seems like when I try to
        instantiate another client it fails complaining that I cannot access
        the URL provided.
        >
        $clientreq = new SoapClient(.... );
        >
        How do I ensure that the cookie is used on subsequent requests? I
        have seen that Zend classes offer cookie stickiness via
        setCookieJar(). how can achieve this in php.
        >
        Moussa

        Comment

        Working...