on 08-07-2013 11:00 PM
Hi All,
I have created a proxy to SalesForce and am able to get back results on the login.
The problem I am having is re-setting the endpoint and session id on the proxy to continue to do further work.
I created a log file and the error is Destination URL not reset. The URL returned from login must be set in the SforceService.
Can anyone give me any advice. Using Powerbuilder 12.5.2 build 5550
Regards,
Stuart
This is a copy from the nntp newsgroups, originally posted by Thomas Rundo.
(http://nntp-archive.sybase.com/nntp-archive/action/article/%3C4faa7c73@forums-1-dub%3E)
It sounds as this is also the solution for your problem.
Kudos to Thomas!
----------------------------------------------------------------------------------------------------
With some effort from our team we finally were able to get connected and get
data back from Salesforce
Here is the solution:
SoapConnection soapconn_login , soapconn_query
sf_sforceservice sf_login_proxy, sf_query_proxy
sf_loginresult loginresult
long error_code
boolean error_boolean
// Create Login SOAP object
soapconn_login = create SoapConnection
error_code = soapconn_login.CreateInstance(sf_login_proxy,
"sf_sforceservice")
try
loginresult = sf_login_proxy.login( "<user login id>", "<the
password>")
catch ( SoapException eCreateLogin )
end try
//Create the Session Header
sf_sessionheader new_sessionheader, old_sessionheader
new_sessionheader = CREATE sf_sessionheader
new_sessionheader.sessionid = loginresult.sessionid
error_boolean = sf_login_proxy.setsessionheadervalue(new_sessionheader)
old_sessionheader = sf_login_proxy.getsessionheadervalue( ) // Now
working!!!
// Create Query SOAP object
soapconn_query= create SoapConnection
error_code = soapconn_query.CreateInstance(sf_query_proxy,
"sf_sforceservice", loginresult.serverurl) // New URL location
//The new_sessionheader fields need to have something in it <<<<<<<<<< This
was the problem for the Invalid Session ID errors
try
loginresult = sf_query_proxy.login( "<user login id>", "<the
password>")
new_sessionheader.sessionid = loginresult.sessionid
new_sessionheader.didunderstand = true
new_sessionheader.mustunderstand = false
new_sessionheader.relay = true
new_sessionheader.actor = "dummy"
new_sessionheader.encodedmustunderstand = "true"
new_sessionheader.encodedmustunderstand12 = "true"
new_sessionheader.encodedrelay = "true"
new_sessionheader.role = "true"
error_boolean = sf_query_proxy.setsessionheadervalue(new_sessionheader)
catch ( SoapException eCreateQuery )
end try
error_boolean = sf_query_proxy.setsessionheadervalue(new_sessionheader)
// Query SalesForce
try
sf_getuserinforesult getuserinforesult
sf_query_proxy.getuserinfo( )
sf_queryresult queryresult
queryresult = sf_query_proxy.query("SELECT FirstName, LastName FROM
Contact")
// Invoke service
messagebox("","")
catch ( SoapException eQuerySalesForce )
messagebox ("Error", "Cannot invoke Web service")
end try
destroy soapconn_login
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for the advice. Sorry about the delay in testing this solution out.
Had some problems because I was trying to use this as EasySoap. After I clicked no the .NET option was able to get further.
Having problems with the query but that is for the next day. Found it better to work with the Enterprise WSDL rather then the Partner WSDL.
Regards,
Stuart
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.