You need to sign in to do that
Don't have an account?
UNKNOWN_EXCEPTION
So here's where I am at:
1. Generated and saved my the wsdl locally.
2. Invoked it local wsdl
3. Get response from server with my sessionid and getServerUrl.
When trying to invoke the new url with my SoapHeader I return "UNKNOWN_EXCEPTION: Destination URL not reset. The URL returned from login must be set in the SforceService".
When I try to post to the new server ((getServerUrl) ) object using the setHeader object I get a local error regarding the stubs.
Any ideas? What am I missing?
Brian A. Thornton
SalesForce Developer/Architect
Denver / Indianapolis/ Fort Wayne / Chicago
since 2005
Please indicate what platform and language you are using.
Code is below:
// Set local page settings
debug = 1;
salesforce_user_name = "asd";
salesforce_password = "asd";
wsdl_location ="http://localhost:8080/cfmain/com/gtt/salesforce/salesforce.wsdl";
// Create the instace
sales_force_login = CreateObject("webservice", wsdl_location);
// Set the required fields.
addSOAPRequestHeader(sales_force_login, wsdl_location, "username", salesforce_user_name, false);
addSOAPRequestHeader(sales_force_login, wsdl_location, "password", salesforce_password, false);
login=sales_force_login.login(salesforce_user_name,salesforce_password);
SalesForceLoginResponse = StructNew();
SalesForceLoginResponse.sessionID = login.sessionID;
SalesForceLoginResponse.getServerUrl = login.getServerUrl();
// Create second instace
sales_force_request = CreateObject("webservice", wsdl_location);
sales_force_request.setHeader(SalesForceLoginResponse.getServerUrl, "SessionHeader", SalesForceLoginResponse.sessionID );
// Set the required fields.
// addSOAPRequestHeader(sales_force_request, wsdl_location, "sessionID", SalesForceLoginResponse.sessionID, false);
servertime = sales_force_request.getServerTimestamp();
I've never seen anyone jump up and down and declare total victory with CF.
The basic issue is that there is a url in the wsdl that is used for login, and as you have seen, a new url is returned on successful login. If CF is going back and using the wsdl for other calls, it may still be picking up the url in the wsdl. The fundamental challenge to have CF use the url from the login as the endpoint for all subsequent api calls.
How this is done is not clear to me. I would suggest searching some CF specific resources.
For any CFers out there heres the quick start using Cold Fusion. This logins in and gets the session id. The current problem is adding it to the header...
// Set local page settings
debug = 1;
salesforce_user_name = "myuser@mydomain.com";
salesforce_password = "mypassword";
wsdl_location ="http://localhost:8080/cfmain/com/salesforce/salesforce.wsdl";
// Create the instace
sales_force_login = CreateObject("webservice", wsdl_location);
// Set the required fields.
addSOAPRequestHeader(sales_force_login, wsdl_location, "username", salesforce_user_name, false);
addSOAPRequestHeader(sales_force_login, wsdl_location, "password", salesforce_password, false);
login=sales_force_login.login(salesforce_user_name,salesforce_password);
SalesForceLoginResponse = StructNew();
SalesForceLoginResponse.sessionID = login.sessionID;
SalesForceLoginResponse.getServerUrl = login.getServerUrl();
// Create second instace
sales_force_request = CreateObject("webservice", wsdl_location);
sales_force_request.setHeader(SalesForceLoginResponse.getServerUrl, "SessionHeader", SalesForceLoginResponse.sessionID );
// Set the required fields.
// addSOAPRequestHeader(sales_force_request, wsdl_location, "sessionID", SalesForceLoginResponse.sessionID, false);
servertime = sales_force_request.getServerTimestamp();
The current error is invalid stub object.