Web Images Videos Maps News Groups Gmail more »
Recently Visited Groups | Help | Sign in
Google Groups Home
setting session ID in the soap header
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  5 messages - Expand all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
ami.ganguli@gmail.com  
View profile  
 More options May 9 2005, 5:07 pm
From: "ami.gang...@gmail.com" <ami.gang...@gmail.com>
Date: Mon, 09 May 2005 07:07:55 -0000
Local: Mon, May 9 2005 5:07 pm
Subject: setting session ID in the soap header
Hi All,

I'm trying to use the Salesforce.com SOAP API.  The login call returns
a session ID that should be set in the SOAP header of subsequent calls.
 After much searching, I found an example of how to do this, but it
doesn't seem to work - I assume the soap4r api has changed since the
example was written.

Can anybody provide a short description of how this is done?

I know about ClientAuthHeaderHandler, but I can't figure out how it's
supposed to be used.

Regards, and thanks in advance for any help,

Ami.


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
ami.ganguli@gmail.com  
View profile  
 More options May 9 2005, 8:28 pm
From: "ami.gang...@gmail.com" <ami.gang...@gmail.com>
Date: Mon, 09 May 2005 10:28:03 -0000
Local: Mon, May 9 2005 8:28 pm
Subject: Re: setting session ID in the soap header
Ok, I've made some progress.  I've managed to add a field to the header
by modifying an example I found elsewhere:

-----

  class ClientAuthHeaderHandler < SOAP::Header::SimpleHandler
     MyHeaderName = XSD::QName.new("urn:partner.soap.sforce.com",
"sessionId")

     attr_accessor :sessionid

     def initialize
        super(MyHeaderName)
          @sessionid = nil
     end

     def on_simple_outbound
       if @sessionid
         { "sessionid" => @sessionid }
       end
     end

     def on_simple_inbound(my_header, mustunderstand)
       @sessionid = my_header["sessionid"]
     end
   end

----

It still doesn't work (invalid session id), possibly because the
request should resemble this (from the Salesforce.com documentation):
  <ns2:sessionId

xmlns:ns2="urn:enterprise.soap.sforce.com">uejMEgecf8yidA3zCjXlNKOSU</
  ns2:sessionId>

but I'm producing this:
<sessionid>vWBLOmDK9MI6Xv9U4eTDteaH1xyGi1</sessionid>

I figure I have to use "XSD::QName.new" somewhere, but everywhere I've
tried gives incorrect results (and I obviously don't understand how
these classes are used).

Help?

... Ami.


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
NAKAMURA, Hiroshi  
View profile  
 More options May 10 2005, 2:27 am
From: "NAKAMURA, Hiroshi" <nakah...@sarion.co.jp>
Date: Tue, 10 May 2005 01:27:45 +0900
Local: Tues, May 10 2005 2:27 am
Subject: Re: setting session ID in the soap header
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

Sorry for late reply.

Hmm.  Is this a typo, 'sessionid', not 'sessionId' ?  session*I*d.

According to the above example, I think this should work.

      def on_simple_outbound
        if @sessionid
          { XSD::QName.new("urn:enterprise.soap.sforce.com",
"sessionId") => @sessionid }
        end
      end

But the only WSDL I know is partner.wsdl, which does not define
'urn:enterprise.soap.sforce.com'.  I can be wrong...

Regards,
// NaHi
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (Cygwin)

iD8DBQFCf4+Bf6b33ts2dPkRAnWFAJwPNbKTyRy1meT7VgjZvYDI59CbiwCglNAY
YYplD+kQEQ+flRlfO7UldXM=
=V//d
-----END PGP SIGNATURE-----


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
ami.ganguli@gmail.com  
View profile  
 More options May 10 2005, 5:10 pm
From: "ami.gang...@gmail.com" <ami.gang...@gmail.com>
Date: Tue, 10 May 2005 07:10:07 -0000
Local: Tues, May 10 2005 5:10 pm
Subject: Re: setting session ID in the soap header
It worked!  Thanks a million!

There were a number of problems with the code I posted earlier,
including the case of off sessionId.  I had figured those out, but I
still needed your little snippet to put the rest together.  I'm using
the partner WSDL, although the example I had cut from the documentation
uses the enterprise WSDL.  I think they're the same except the
enterprise WSDL is more strongly typed.

By the way, I had tried earlier to import the WSDL, but it I kept
getting errors (I can't remember exactly, something about nil values I
think).  If you think this should work I can try again and post the
results.

Regards,
Ami.


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
NAKAMURA, Hiroshi  
View profile  
 More options May 10 2005, 7:01 pm
From: "NAKAMURA, Hiroshi" <nakah...@sarion.co.jp>
Date: Tue, 10 May 2005 18:01:15 +0900
Local: Tues, May 10 2005 7:01 pm
Subject: Re: setting session ID in the soap header
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

ami.gang...@gmail.com wrote:
> It worked!  Thanks a million!

Good to hear.

> By the way, I had tried earlier to import the WSDL, but it I kept
> getting errors (I can't remember exactly, something about nil values I
> think).  If you think this should work I can try again and post the
> results.

Thanks in advance.  Please show me the results.  Early snapshot versions
have many problems about parsing full(?) featured XML Schema definition
(+WSDL).  I wrote many code in this half of a year but test is still not
enough.

Regards,
// NaHi
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (Cygwin)

iD8DBQFCgHhbf6b33ts2dPkRAjElAKDGqST511EoWDemEh2sNBLUSkgt+gCfd4PB
V6S2RLvgDGn9kb5HgpjPrWY=
=Eobk
-----END PGP SIGNATURE-----


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google