You need to sign in to do that
Don't have an account?
Failed to send request error
Hi,
i run the ant and created source code from wsdl in weblogic. i got the directory structure
urn/enterprise/soap/sforce/com.*
urn/sobject/enterprise/soap/sforce/com.*
urn/fault/enterprise/soap/sforce/com.*
now i am trying to connect support force with this code and i am getting
java.rmi.RemoteException: SOAP Fault:javax.xml.rpc.soap.SOAPFaultException: Failed to send request
The code is:
Soap_Stub binding = null;
LoginResult lr = null; //maintain the login results
String userName = "xxxx";
String password = "xxxx";
try{
SforceService service = new SforceService_Impl();
binding = (Soap_Stub)service.getSoap(userName,password);
lr = binding.login(userName,password);
System.out.println("Login was successfull");
System.out.println("login id is " + lr.getUserId())
} catch (Exception ex) {System.out.println("error in try and catch " + ex);}
should be
binding = (Soap_Stub)service.getSoap();
see the examples for Login in the API docs.
Thank you for reply,
I got Soap_Stub, SforceService_Impl, through clientgen, so i am using this for the login purpose.
Soap_Stub sfdc = (Soap_Stub) new SforceService_Impl().getSoap();
LoginResult loginResult = sfdc.login("userName", "password");
// Reset the SOAP endpoint to the returned server URL
sfdc = (Soap_Stub) new SforceServiceLocator().getSoap(new java.net. URL(loginResult.getServerUrl()));
I am not getting getSoap(new java.net. URL(loginResult.getServerUrl())), i have only getSoap(), getSoap(String,String);
// Create a new session header object
// add the session ID returned from the login
SessionHeader sh = new SessionHeader();
sh.setSessionId(loginResult.getSessionId());
// Set the session header for subsequent call authentication
sfdc.setHeader(new SforceServiceLocator().getServiceName().getNamespaceURI(),"SessionHeader", sh);
i wont have setHeader method. so i dont know how to set the session header.
i did get SforceServicelocator, however i got SforceService_Impl. and also SforceService.wsdl
so i get confused how to login in. because what i got, is different from the API document.
param
Hi Param,
Sounds like you are trying to use "plain old java" in Workshop. This is a tough road to hoe. The better way is to use xmlBeans. The way that you do this in Workshop is to create a new project of type Schema. Drop the wsdl into that project and like magic, a bunch of xmlbeans are created. You can then create a web service control based on the wsdl (right click).
We also have a toolkit that installs into the Workshop environment that demonstrates using the API from Weblogic.
http://www.sforce.com/us/downloads/sforceWorkshop.zip