这取决于您使用的特定客户端工具包,但您应该能够在调用 login() 之前设置目标 Url。对于 Axis 1.x,你会做
SoapBindingStub binding = (SoapBindingStub) new SforceServiceLocator().getSoap();
binding._setProperty(SoapBindingStub.ENDPOINT_ADDRESS_PROPERTY,
"https://test.salesforce.com/services/Soap/u/20.0");