5

We are trying to integrate SFDC with External system, were external system will invoke our webservice class(consumers od of WSDL) and salesforce will accept the request(Providers of WSDL).

Here external system will send us something called as tickets which is in the below format, and SFDC has to capture that request and parse it, to create case in the SFDC and send back the response to external system.

If anyone has worked on similar kind of requirement please let us know how to proceed.

<Account>
    <AccountId></AccountId>
    <Case>
           <CaseNumber></CaseNumber>
           <Owner></Owner>
           <FalloutJob>
                   <JobId></JobId>
                   <!--One or more repetitions:-->
                   <Attribute>
                          <Name></Name>
                          <Value></Value>
                          <ValueType></ValueType>
                   </Attribute>
           </FalloutJob>
    </Case>
</Account>
2
  • here is the request which we are getting from external system:<Account> <AccountId></AccountId> <Case> <CaseNumber></CaseNumber> <Owner></Owner> <FalloutJob> <JobId></JobId> <!--One or more repetitions:--> <Attribute> <Name></Name> <Value></Value> <ValueType></ValueType> </Attribute> </FalloutJob> </Case> </Account>
    – kishore
    Commented Jul 3, 2013 at 10:55
  • Have you already created the wiring from Salesforce to your External Application?
    – Vignex
    Commented Jul 3, 2013 at 11:05

2 Answers 2

2

If you have defined your Apex class as global and your method as a webservice, then in Salesforce, you should be able to generate the WSDL.

global with sharing class WSClass {
    webservice static boolean wsMethod() {        
        return true;
    }
}

Find the class and click on the WSDL link to the left in the list of Apex classes. https://login.salesforce.com/01p

2
  • I have created a webservice Apex class as mentioned above. but I have a Java application from where I am trying to access this apex class methods. for this I have created jar files for enterprise.wsdl and mywebservice.wsdl and included in my classpath. from then I have create a SoapConnection using the login success session Id. but After that, I am not sure How can make a call for these custom apex class methods from my java app.
    – nvr
    Commented Oct 28, 2013 at 15:56
  • @nvr to get the custom wsdl, open the apex class in salesforce setup and click the generate WSDL button Commented Nov 27, 2013 at 18:59
0

Steps you are supposed to follow

  1. Import Partner WSDL
  2. Import WSDL for the class
  3. Generate stub classes for both the WSDL files. Include them in your source code package.
  4. Invoke Login service from the partner port stub class. You've to pass Username and password if you've listed your client IP in Salesforce, else you need to pass Username and "password+Security token" in password field.
  5. From the Response received get the Session ID.
  6. Invoke your Case class web service port from the stub, supply values you need to pass to create case along with the Session Id.
  7. Get the response . eg: Case Id/Case Number.
  8. Log out using Logout service in the partner port stub class, supplying the session ID.
4
  • Can you please expalin the step 6: Invoke your Case class web service port from the stub, supply values you need to pass to create case along with the Session Id. I have the login success with SessionId available, How can I make a call to the the custom class in my custom Webservice by passing the Seesion, Can you provide the piece of code. Thanks!
    – nvr
    Commented Oct 28, 2013 at 15:13
  • @Vignex : I did not understand one logic in the steps listed. I do understand that for the Apex class we created, we need to generate a WSDL and share with the other system for import,so that they can make a call. But I dint get the reason of providing Partner WSDL along with our Class WSDL?? Can you elaborate..Thanks!!
    – user10727
    Commented Aug 21, 2014 at 12:08
  • @user10727 - The partner WSDL will provide the standard operations like login, logout etc., You need sessionId or oAuth token to be passed in the request header (authentication step) for invoking your custom web service.
    – Vignex
    Commented Aug 22, 2014 at 13:12
  • @nvr Please refer the following link: salesforce.com/us/developer/docs/apexcode/Content/…
    – Vignex
    Commented Aug 22, 2014 at 13:17

You must log in to answer this question.

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