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
raghav.Mraghav.M 

Unable to test Web Service using SOAPUI

Hi,

 

I am using SOAPUI to test my webservices in Dev environment. I have received the following error:

 

faultcode>sf:INVALID_SESSION_ID</faultcode>         

<faultstring>INVALID_SESSION_ID: Invalid Session ID found in SessionHeader: Illegal Session</faultstring>      </soapenv:Fault>   </soapenv:Body>

 

Questions:

1. How can I login to Salesforce from SOAPUI?

2. The Enterprise WSDL created by SFDC doesn't contain login method?

3. How to construct a SOAP request to login to Salesforce from SOAPUI.

 

 

Thanks,

Rag

 

Best Answer chosen by Admin (Salesforce Developers) 
SuperfellSuperfell

Don't send the loginScopeHeader or the orgId, that's only used for self service users.

All Answers

SuperfellSuperfell

There's a login operation in the enterprise WSDL you should be able to use that from SOapUI to get a sessionId and new server Url.

raghav.Mraghav.M

Hi SimonF,

 

I am not able to find login method in the enterprise WSDL I have generated. Here is the portion of the WSDL from port type. Am I missing something while generating the WSDL ? 

 

 <portType name="MyWebServicePortType">  <operation name="makeContact">   <input message="tns:makeContactRequest"/>   <output message="tns:makeContactResponse"/>  </operation> </portType> <binding name="MyWebServiceBinding" type="tns:MyWebServicePortType">  <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>  <operation name="makeContact">   <soap:operation soapAction=""/>   <input>    <soap:header use="literal" part="SessionHeader" message="tns:Header"/>    <soap:header use="literal" part="CallOptions" message="tns:Header"/>    <soap:header use="literal" part="DebuggingHeader" message="tns:Header"/>    <soap:header use="literal" part="AllowFieldTruncationHeader" message="tns:Header"/>    <soap:body use="literal" parts="parameters"/>   </input>   <output>    <soap:header use="literal" part="DebuggingInfo" message="tns:Header"/>    <soap:body use="literal"/>   </output>  </operation> </binding> <service name="MyWebServiceService">  <documentation></documentation>  <port binding="tns:MyWebServiceBinding" name="MyWebService">   <soap:address location="https://na8-api.salesforce.com/services/Soap/class/DemoManagePack1/MyWebService"/>  </port> </service>

SuperfellSuperfell

That's not the enterprise WSDL, that's a WSDL for a custom webservice written in Apex. That WSDL doesn't have a login method, you use one of the existing authentication methods to get a sessionId to use with it (e.g. oAuth, login from enterprise or partner WSDL, merge fields etc)

raghav.Mraghav.M

Hi SimonF,

 

I have tried the following options:

 

1. I have used the enterprise WSDL and tried login using my userId and Password with security token

Input:

         OrganizationId: Provided my salesforce OrganizationId

         User Id: My salesforce admin user Id

         Password: salesforce password with security token

 

Output: 

        <sf:exceptionCode>INVALID_LOGIN</sf:exceptionCode>

       <sf:exceptionMessage>Invalid username or password, locked out or Self-Service portal is not enabled</sf:exceptionMessage>

 

Option-2

I have enables a selfservice portal user and I am able to login to salesforce using his Id.

But when I tried to use the above sessionId to invoke my custom webservice I have received the following error message: 

         <faultcode>sf:INVALID_SESSION_ID</faultcode>         

        <faultstring>INVALID_SESSION_ID: Self Service User Sessions are not valid for use with the API</faultstring>

 

It will be great if you provide some documentation links to call Custom webservices from SOAPUI

 

Thanks,

Rag

 

 

SuperfellSuperfell

Don't send the loginScopeHeader or the orgId, that's only used for self service users.

This was selected as the best answer
raghav.Mraghav.M

Hi SimonF,

 

Great help. 

 

Thank you. Your suggestion has helped. 

 

 

--Raghavendra