function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
American DataAmerican Data 

UNKNOWN_EXCEPTION: Destination URL not reset. The URL returned from login...

Hello,

I'm experiencing some wierd behavior when attempting to obtain a SoapBindingStub.

I attempt to access such an object by performing the following:

try {
   binding = ( SoapBindingStub ) new SforceServiceLocator().getSoap();
   logger.info( "getSFConnection> UserInfo = " + binding.getUserInfo() );
  } catch ( Exception e ) {
   logger.error( "getSFConnection> Could not get a SoapBindingStub", e );
  }

When I run this code segment, the attempt to get the binding throws an Exception.  My stack trace looks as follows:

2005-08-12 10:16:43,433 [ERROR] com.americandatacorp.salesforce.SFBinding - getSFConnection> Could not get a SoapBindingStub

AxisFault

faultCode: {urn:fault.enterprise.soap.sforce.com}UNKNOWN_EXCEPTION

faultSubcode:

faultString: UNKNOWN_EXCEPTION: Destination URL not reset. The URL returned from login must be set in the SforceService

faultActor:

faultNode:

faultDetail:

{urn:fault.enterprise.soap.sforce.com}fault:

UNKNOWN_EXCEPTION

Destination URL not reset. The URL returned from login must be set in the SforceService

UNKNOWN_EXCEPTION: Destination URL not reset. The URL returned from login must be set in the SforceService

at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:80)

at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:44)

at java.lang.reflect.Constructor.newInstance(Constructor.java:315)

at java.lang.Class.newInstance3(Class.java:367)

at java.lang.Class.newInstance(Class.java:305)

at org.apache.axis.encoding.ser.BeanDeserializer.(BeanDeserializer.java:125)

at org.apache.axis.encoding.ser.BeanDeserializer.(BeanDeserializer.java:111)

at com.sforce.soap.enterprise.fault.UnexpectedErrorFault.getDeserializer(UnexpectedErrorFault.java:85)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:85)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:58)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:60)

at java.lang.reflect.Method.invoke(Method.java:391)

at org.apache.axis.encoding.ser.BaseDeserializerFactory.getSpecialized(BaseDeserializerFactory.java:176)

at org.apache.axis.encoding.ser.BaseDeserializerFactory.getDeserializerAs(BaseDeserializerFactory.java:117)

at org.apache.axis.encoding.DeserializationContextImpl.getDeserializer(DeserializationContextImpl.java:466)

at org.apache.axis.encoding.DeserializationContextImpl.getDeserializerForType(DeserializationContextImpl.java:481)

at org.apache.axis.message.SOAPFaultDetailsBuilder.onStartChild(SOAPFaultDetailsBuilder.java:172)

at org.apache.axis.encoding.DeserializationContextImpl.startElement(DeserializationContextImpl.java:963)

at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Source)

at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source)

at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)

at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)

at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)

at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)

at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)

at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)

at javax.xml.parsers.SAXParser.parse(Unknown Source)

at org.apache.axis.encoding.DeserializationContextImpl.parse(DeserializationContextImpl.java:242)

at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:538)

at org.apache.axis.Message.getSOAPEnvelope(Message.java:376)

at org.apache.axis.transport.http.HTTPSender.readFromSocket(HTTPSender.java:826)

at org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java:142)

at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:71)

at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:150)

at org.apache.axis.SimpleChain.invoke(SimpleChain.java:120)

at org.apache.axis.client.AxisClient.invoke(AxisClient.java:180)

at org.apache.axis.client.Call.invokeEngine(Call.java:2610)

at org.apache.axis.client.Call.invoke(Call.java:2599)

at org.apache.axis.client.Call.invoke(Call.java:2279)

at org.apache.axis.client.Call.invoke(Call.java:2200)

at org.apache.axis.client.Call.invoke(Call.java:1714)

at com.sforce.soap.enterprise.SoapBindingStub.getUserInfo(SoapBindingStub.java:1903)

at com.americandatacorp.salesforce.SFBinding.getSFConnection(SFBinding.java:80)

at com.americandatacorp.salesforce.SFBinding.(SFBinding.java:53)

at com.americandatacorp.salesforce.SFBinding.getInstance(SFBinding.java:64)

at com.lactagen.automatedmailing.configuration.ConfigurationFileReader.readFile(ConfigurationFileReader.java:69)

at com.lactagen.automatedmailing.configuration.ConfigurationFactory.configure(ConfigurationFactory.java:120)

at Test.main(Test.java:57)

I believe I'm following the use of the API correctly to obtain such a binding object.  Could anyone provide me with some direction on what might be going wrong?

For the record, I'm using java version 1.4.2, and have several other java libraries in my classpath that are required for this integration (J2EE, JDOM, Log4j, Commons-net, + the ones required for Sforce).

Thanks for any assistance in advance.

 

Best Answer chosen by Admin (Salesforce Developers) 
DevAngelDevAngel

Hi American Data,

The problem is that you are asking the binding to do a getUserInfo call in your log statement prior to your login call.

Check the line directly following bingin = (SoapBindingStub) new SforceServiceLocator().getSoap();

Cheers

All Answers

SuperfellSuperfell
The docs and samples around the login call, once you've called login you need to change the endpoint to the one returned by the login call.
American DataAmerican Data

Thanks SimonF,

I am using the LoginResult object in the next line of code.  See the complete method below:

 private SoapBindingStub getSFConnection() {
  try {
   binding = ( SoapBindingStub ) new SforceServiceLocator().getSoap();
   logger.info( "getSFConnection> UserInfo = " + binding.getUserInfo() );
  } catch ( Exception e ) {
   logger.error( "getSFConnection> Could not get a SoapBindingStub", e );
  }
  try {
   loginResult = binding.login( userName, password );
  } catch ( LoginFault ex ) {
   //The LoginFault derives from AxisFault
         ExceptionCode exCode = ex.getExceptionCode();
         if (exCode == ExceptionCode.FUNCTIONALITY_NOT_ENABLED ||
           exCode==ExceptionCode.INVALID_CLIENT || 
           exCode==ExceptionCode.INVALID_LOGIN || 
           exCode==ExceptionCode.LOGIN_DURING_RESTRICTED_DOMAIN || 
           exCode==ExceptionCode.LOGIN_DURING_RESTRICTED_TIME || 
           exCode==ExceptionCode.ORG_LOCKED || 
           exCode==ExceptionCode.PASSWORD_LOCKOUT || 
           exCode==ExceptionCode.SERVER_UNAVAILABLE || 
           exCode==ExceptionCode.TRIAL_EXPIRED || 
           exCode==ExceptionCode.UNSUPPORTED_CLIENT){
           logger.error( "getSFConnection> Login to SalesForce failed.  Please make sure that you have a valid user id and password.");
         } else {
           System.out.println("getSFConnection> An unexpected error has occurred during login." +  ex.getMessage());
         }
  } catch ( RemoteException ex ) {
   System.out.println("getSFConnection> An unexpected error has occurred during login." +  ex.getMessage());
  }
  
  binding._setProperty(SoapBindingStub.ENDPOINT_ADDRESS_PROPERTY, loginResult.getServerUrl());
  //Create a new session header object and add the session id
     //from the login reutrn object
     _SessionHeader sh = new _SessionHeader();
     sh.setSessionId( loginResult.getSessionId() );
 
     //set the session header for subsequent call authentication
     binding.setHeader( new SforceServiceLocator().getServiceName().getNamespaceURI(), "SessionHeader", sh );

     return binding;

 }

 

But the exception is thrown before I get to that point.  As a result the binding object throws an exception at loginResult = binding.login( userName, password); because binding is null. 

If I can't retrieve a valid binding object, everything thereafter fails.  Any other ideas?  Am I doing something problematic in the code above?

Thanks again.

 

DevAngelDevAngel

Hi American Data,

The problem is that you are asking the binding to do a getUserInfo call in your log statement prior to your login call.

Check the line directly following bingin = (SoapBindingStub) new SforceServiceLocator().getSoap();

Cheers

This was selected as the best answer
American DataAmerican Data

DevAngel,

That makes perfect sense.

Thank you.  I've corrected the problem.

Regards,

Josh

Chirag MehtaChirag Mehta

@DevAngel /@ SimonF - Can you please help me with a weird issue wrt destination url not set. Check my post @ http://boards.developerforce.com/t5/Chatter-and-Chatter-API/Destination-URL-not-reset-Chatter-REST-API-Upload-Photo/m-p/418073