3

I am trying to set up a outbound message trigger on three objects. The trigger is to send a soap message to an end point (running on public IP). I got this to work for one object. The issue is when I want to set it up for the second object. When I try to generate wsdl for the outbound message of the second object - I get a different wsdl from the first one, with the following text different: EDIT - showing both the wsdl here: This is my wsdl on Account object

           <element name="notifications">
            <complexType> 
                <sequence> 
                    <element name="OrganizationId" type="ent:ID" />
                    <element name="ActionId" type="ent:ID" />
                    <element name="SessionId" type="xsd:string" nillable="true" />
                    <element name="EnterpriseUrl" type="xsd:string" />
                    <element name="PartnerUrl" type="xsd:string" />
                    <element name="Notification" maxOccurs="100" type="tns:AccountNotification" />
                </sequence> 
            </complexType> 
        </element>

        <complexType name="AccountNotification">
            <sequence>
                <element name="Id" type="ent:ID" />
                <element name="sObject" type="ens:Account" />
            </sequence>
        </complexType>

and this is my wsdl for Contact:

       <element name="notifications">
            <complexType> 
                <sequence> 
                    <element name="OrganizationId" type="ent:ID" />
                    <element name="ActionId" type="ent:ID" />
                    <element name="SessionId" type="xsd:string" nillable="true" />
                    <element name="EnterpriseUrl" type="xsd:string" />
                    <element name="PartnerUrl" type="xsd:string" />
                    <element name="Notification" maxOccurs="100" type="tns:Contacts__cNotification" />
                </sequence> 
            </complexType> 
        </element>

        <complexType name="Contacts__cNotification">
            <sequence>
                <element name="Id" type="ent:ID" />
                <element name="sObject" type="ens:Contact" />
            </sequence>
        </complexType>

Seems like there can only be one endpoint for the notifications() that is called when the soap message is sent?

Sure enough, I can have the second wsdl in a different endpoint and different listener altogether (which means different war file). But this does not exactly look scalable if in the future I want to configure the outbound message for more objects.

Is there a way to merge all the different wsdl of custom objects into one? Or is there any other way I can go about this?

0

I don't have a readily available way to test this, but you should be able to modify the WSDL to use a choice. When the endpoint is called by salesforce, the appropriate type will be selected. You can modify the element as follows:

<element name="notifications">
    <complexType> 
        <sequence> 
            <element name="OrganizationId" type="ent:ID" />
            <element name="ActionId" type="ent:ID" />
            <element name="SessionId" type="xsd:string" nillable="true" />
            <element name="EnterpriseUrl" type="xsd:string" />
            <element name="PartnerUrl" type="xsd:string" />
            <choice>
                <element name="Notification" maxOccurs="100" type="tns:AccountNotification" />
                <element name="Notification" maxOccurs="100" type="tns:Contacts__cNotification" />
            </choice>
        </sequence> 
    </complexType> 
</element>
<complexType name="AccountNotification">
    <sequence>
        <element name="Id" type="ent:ID" />
        <element name="sObject" type="ens:Account" />
    </sequence>
</complexType>
<complexType name="Contacts__cNotification">
    <sequence>
        <element name="Id" type="ent:ID" />
        <element name="sObject" type="ens:Contact" />
    </sequence>
</complexType>
  • I updated my question to show both the wsdl. If I add all the 'sObject' elements, what will the notification be called? Doesn't that matter? – persistence.xml Jun 20 '17 at 23:03
  • @persistence.xml based on the update, I surmise that the choice element will actually need to be in the notifications complex type instead. Does this help? – sfdcfox Jun 21 '17 at 0:27
  • That definitely does help. However, when I generated Java code from the wsdl, I get one notifications() method, which takes in both types of notifications as parameters. So I am assuming I examine the values in both, and have an action for both types. In your expert opinion, does that make sense? – persistence.xml Jun 21 '17 at 6:54
  • @persistence.xml Yes, you'd have to check the type of the notification and make your decision based on that. You can't otherwise have the same method with different parameters that I know of. – sfdcfox Jun 21 '17 at 12:18

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.