0

I created a service as below:

global class HelloWorldWebService{
    webService static string sayHello(){
        return 'Hello World';
    }
}

I generate a wsdl for this service: https://ap5.salesforce.com/services/wsdl/class/HelloWorldWebService

When I consume this URL in SOAPUI it throws below error:

enter image description here

2
  • 1
    is your wsdl file valid? do you have any errors with validator ? Commented Jun 13, 2017 at 10:05
  • I called that service from another apex class via visualforce page and it is working fine. Commented Jun 13, 2017 at 10:35

1 Answer 1

1

As this WSDL is not public, you can't give the WSDL URL directly in SoapUI while creating a project. You have to save it in local (as WSDL file) and provide the WSDL file path in SoapUI while creating the project.

To call this service you have to use Login method present in enterprise/partner WSDL. First, you have to call the Login method to get the session I'd, then pass it to your web service and get the output.

For more details please check this link http://www.jitendrazaa.com/blog/salesforce/using-soapui-with-salesforce-to-test-standard-and-custom-web-services-response/

11
  • Hi Saroj, thanks for your response.I saved the wsdl file in my local system and now I am able to consume the service in SOAP UI. But unable to call this service, my partial input request for wsdl file is as below: <hel:CallOptions> <hel:client>?</hel:client> </hel:CallOptions> <hel:SessionHeader> <hel:sessionId>?</hel:sessionId> </hel:SessionHeader> what should I pass in client element and sessionId element ? Commented Jun 14, 2017 at 5:13
  • I did not find any username and password element in my wsdl file. Commented Jun 14, 2017 at 5:34
  • 1
    @RaamKothiyal As I already explained, you can't consume the service directly. You have to first consume the Enterprise WSDL, where you will get the login method. Pass username, password and security token and get the session id. Pass this session Id in your Webservice URL. You have to change the endpoint also. You can follow the steps as explained in this link jitendrazaa.com/blog/salesforce/…
    – Saroj Bera
    Commented Jun 14, 2017 at 7:19
  • 1
    Don't change the ServerURL. Keep the Old URL generated in SoapUI because the WSDL already has the correct service URL in it. Try only with updating the session ID.
    – Saroj Bera
    Commented Jun 15, 2017 at 7:32
  • 1
    No, you don't have to increase the session time. In the real scenario, you have to create one Salesforce user to make callouts from the external app into Salesforce. So the external app that accesses Salesforce through the API must first log in as a Salesforce user for authentication. Assign this user with only required permissions to perform certain operations required by the app. See this Salesforce Knowledge Article for more details help.salesforce.com/articleView?id=000176281&type=1
    – Saroj Bera
    Commented Jun 15, 2017 at 9:52

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .