Explore Courses Blog Tutorials Interview Questions
0 votes
in Salesforce by (11.9k points)

I'm trying to establish a Connection to my Apex-Webservice but it fails every time. My Website is quite Simple:

global class AtlassianService 


    webService static String hello(String Name) 


        return 'Hello '+Name+' ! :D';



To generate the Client i just the way, which is described here:

java –classpath pathToJAR/wsc-22.jar pathToWsdl/WsdlFilename​ pathToOutputJar/OutputJarFilename

Accessing the Webservice:

SoapConnection soap = Connector.newConnection("[email protected]", "XXXX");

System.out.println(soap.hello("WORLD")); // Invalid Session ( => SessionID is null)

If I use the PartnerConnection to get a valid SessionID everything works fine:

ConnectorConfig config = new ConnectorConfig();




new PartnerConnection(config);

SoapConnection soap = Connector.newConnection(null, null);



Does anybody have an idea why the first example fails?

1 Answer

0 votes
by (32.1k points)

All operations call of the wsc throws a ConnectionException or one of its particular subtypes in case of an error. So you must get an error message that would presumably help to solve the problem. In order to debug the SOAP messages sent and received by the wsc attach the following lines after the initialization of your ConnectorConfig:



This will pretty-print the entire XML exchanged between your client and the web service. The response will also probably help you to find the reason for your problem.

Browse Categories