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
SFNewSFNew 

Login issue using API.

Hello All,

              I am implementing a client using API, to sync our orgs  data with SF. I got the WSDL from prod since they have the updated objects and created those objects in my sandbox. Now I generated the client stubs from the prod WSDL and trying to do some update etc. I am getting the following exception,, I understand theoretically it should be po

// My login stub

SoapBindingStub binding = (SoapBindingStub) new SforceServiceLocator().getSoap(new java.net.URL("http://www.test.salesforce.com/Services/Soap/c/15.0"));
salesforceLoginResult = binding.login(user,passwd); // Erroring out here when I did a trace
binding._setProperty(SoapBindingStub.ENDPOINT_ADDRESS_PROPERTY,salesforceLoginResult.getServerUrl());



SessionHeader sessionHeader = new SessionHeader();
sessionHeader.setSessionId(salesforceLoginResult.getSessionId());
sfBinding.setHeader(new SforceServiceLocator().getServiceName().getNamespaceURI(),"SessionHeader",sessionHeader);

 

Error Message:

Exception in thread "main" AxisFault
faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
faultSubcode:
faultString: java.net.UnknownHostException: www.test.salesforce.com
faultActor:
faultNode:
faultDetail:
{http://xml.apache.org/axis/}stackTrace:java.net.UnknownHostException: www.test.salesforce.com
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:177)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
at java.net.Socket.connect(Socket.java:519)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.axis.components.net.DefaultSocketFactory.create(DefaultSocketFactory.java:153)
at org.apache.axis.components.net.DefaultSocketFactory.create(DefaultSocketFactory.java:120)
at org.apache.axis.transport.http.HTTPSender.getSocket(HTTPSender.java:191)
at org.apache.axis.transport.http.HTTPSender.writeToSocket(HTTPSender.java:404)
at org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java:138)
at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)
at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
at org.apache.axis.client.AxisClient.invoke(AxisClient.java:165)
at org.apache.axis.client.Call.invokeEngine(Call.java:2784)
at org.apache.axis.client.Call.invoke(Call.java:2767)
at org.apache.axis.client.Call.invoke(Call.java:2443)
at org.apache.axis.client.Call.invoke(Call.java:2366)
at org.apache.axis.client.Call.invoke(Call.java:1812)
at com.sforce.soap.enterprise.SoapBindingStub.login(SoapBindingStub.java:3047)
at Updater.main(Updater.java:61)

{http://xml.apache.org/axis/}hostname:my_host_name

java.net.UnknownHostException: www.test.salesforce.com
at org.apache.axis.AxisFault.makeFault(AxisFault.java:101)
at org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java:154)
at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)
at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
at org.apache.axis.client.AxisClient.invoke(AxisClient.java:165)
at org.apache.axis.client.Call.invokeEngine(Call.java:2784)
at org.apache.axis.client.Call.invoke(Call.java:2767)
at org.apache.axis.client.Call.invoke(Call.java:2443)
at org.apache.axis.client.Call.invoke(Call.java:2366)
at org.apache.axis.client.Call.invoke(Call.java:1812)
at com.sforce.soap.enterprise.SoapBindingStub.login(SoapBindingStub.java:3047)
at Updater.main(Updater.java:61)
Caused by: java.net.UnknownHostException: www.test.salesforce.com
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:177)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
at java.net.Socket.connect(Socket.java:519)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.axis.components.net.DefaultSocketFactory.create(DefaultSocketFactory.java:153)
at org.apache.axis.components.net.DefaultSocketFactory.create(DefaultSocketFactory.java:120)
at org.apache.axis.transport.http.HTTPSender.getSocket(HTTPSender.java:191)
at org.apache.axis.transport.http.HTTPSender.writeToSocket(HTTPSender.java:404)
at org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java:138)

 

ssible to do what I am doing. I'd greatly appreciate if someone could point out if I am doing anything wrong here. 

 

Message Edited by SFNew on 05-03-2009 01:47 PM
SFNewSFNew
Thanks all. I solved the issue.
pawanns78pawanns78

I am getting the same issue test.salesforce.com host  exception can some tell me how to resolve it and show me sample snippet in java.

Archana SarukArchana Saruk

Can you tell us ,how you solved problem ?