2

I need to know how to generate a stub listener in Salesforce. My exact requirement is to call a web service, written in APEX in one org, through an outbound message in another org.

I found below link about building a listener, but it doesn't explain how to do it in Salesforce.

http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_om_outboundmessaging_listener.htm

Thanks in advance! Inshar

4
  • I think you can create the WSDL from apex class in salesforce and then parse that WSDL back in another org to generate apex class back and then you can call out.Even you may try using REST API also Commented Nov 7, 2012 at 6:37
  • Hi Mohith, I want to know how to create a webservice listener(using apex) for an outbound message in salesforce. (for 2 different orgs). I hope my question is clear for you.
    – Inshar
    Commented Nov 7, 2012 at 9:07
  • Answer revised, sorry about the rehash ! Commented Nov 7, 2012 at 12:01
  • Plz let me knw if u were able yo generate the listener in apex. If yes plz shed some light as I am also stuck
    – user27582
    Commented Jan 6, 2016 at 19:13

1 Answer 1

1

I think I just had a bit of a brain freeze there (apologies), I don't reckon there is a way to generate a Web Service from a WSDL in Salesforce. (The import wsdl generates classes to call out to a service)

What you might be able to do is use WSDL2Java and since Java is pretty close to Apex, you can then paste the generated service into your IDE as a new Class and then you will need to trim away some bits and change for Syntax differences. (eg add @Webservice annotation, etc But this will be quite a bit of work !)

java org.apache.axis.wsdl.WSDL2Java -s -o ./ <WSDLName>

Although to be honest, it would probably be easier just to write your own web service to respond to that notification. (You can use the Import WSDL to generate the Request and Response Classes : Setup > Develop > Class > Generate from WSDL, and then use them to write your own webservice)

5
  • Hi techtrekker, Thanks for the reply. I got your point. I want to know how to generate the listener service (by using the outbound message wsdl) in salesforce. Thanks!
    – Inshar
    Commented Nov 7, 2012 at 9:01
  • Added above. Hope this is what you're looking for. Commented Nov 7, 2012 at 9:17
  • Hi techtrekker, Thanks again! I created webservice classes. (There are 3 classes). Still, I don't see any method to get the field values and do my business logic. Please help me on this. Thanks!
    – Inshar
    Commented Nov 7, 2012 at 10:21
  • Also, that method needs to be marked as a webservice, right?
    – Inshar
    Commented Nov 7, 2012 at 10:23
  • Inshar, for creating an outbound webservice, you would need to generate the WSDL for the Apex class you wrote. Then use the salesforce provided mock classes to test.
    – user10727
    Commented Aug 12, 2014 at 12:31

You must log in to answer this question.

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