1

I am trying to set up salesforce outbound messaging listener in java. This is the link I followed to set up, and it works fine - https://developer.salesforce.com/page/Creating_an_Outbound_Messaging_Notification_Service_with_Eclipse_3.2

The article was unfortunately never updated after 2012, and I want to set this up as a maven project for obvious reasons -this is where I run into difficulties.

I am looking for the right maven plugin to basically reproduce whatever was in the link.The idea is that, I need to have an endpoint listener, such that it can receive a soap message from salesforce. With me right now, I have a wsdl file (that I get from salesforce), and this is my starting point. The endpoint is also included in the wsdl. From a lot of research, I decided to use the apache cxf maven plugin to generate the classes from wsdl. I also have a public endpoint available to receive the message.

However I am stuck and unsure as to how to to proceed from here. Once I get the classes, how do I configure the endpoint listener? From the generated classes, there is one interface NotificationPort , which has the method that is called when a message hits the endpoint. I know that I need to have a class that implements the interface. How do I run and test the service from now?

This is my pom.xml

      <properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<cxf.version>3.1.11</cxf.version>
    <wsdl.generated.sources>${basedir}/src/main/java</wsdl.generated.sources>
<wsdl.location>${project.basedir}/src/main/resources/META-INF/supplyorder.wsdl</wsdl.location>
</properties>

  <dependency>
    <groupId>org.apache.cxf</groupId>
    <artifactId>cxf-codegen-plugin</artifactId>
    <version>${cxf.version}</version>
</dependency>

      </dependencies>  
    <build>
<plugins>
    <plugin>
        <groupId>org.apache.cxf</groupId>
        <artifactId>cxf-codegen-plugin</artifactId>
        <version>${cxf.version}</version>
        <executions>
            <execution>
                <id>generate-sources</id>
                <phase>generate-sources</phase>
                <configuration>
                    <sourceRoot>${wsdl.generated.sources}</sourceRoot>
                    <wsdlOptions>
                        <wsdlOption>
                            <wsdl>${wsdl.location}</wsdl>
                        </wsdlOption>
                    </wsdlOptions>
                </configuration>
                <goals>
                    <goal>wsdl2java</goal>
                </goals>
            </execution>
        </executions>
    </plugin>
</plugins>

wsdl relevant parts

    <!-- Binding 
 You need to write a service that implements this binding to receive the notifications -->
    <binding name="NotificationBinding" type="tns:NotificationPort">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="notifications">
    <soap:operation soapAction=""/>
    <input>
        <soap:body use="literal"/>
    </input>
    <output> 
        <soap:body use="literal"/>
    </output>
</operation>
 </binding>
   <!-- Service Endpoint -->
  <service name="NotificationService">
  <documentation>Notification Service Implementation</documentation>
  <port binding="tns:NotificationBinding" name="Notification">
      <soap:address 
     location="http://localhost:8080/SupplyOrder/Notification"/>
   </port>
   </service>

Questions: 1. I wrote a custom class that implements the interface NotificationsPort. How do I run and test this web service? What can I use as run time environment to run it? Would tomcat work?

Is there anyway I can use Spring to get this set up? -as I would highly prefer to use that.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.