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
Ad_InfosysAd_Infosys 

Outbound message

HI ALL
We came across an error and thought to seek help from you.
Well we are sending an outbound message to external Tomcat server. There we want to invoke another servlet class. We have supplied the URl for the server in Service endpoint. But following error comes to the monitor of OM.I am also getting this error message in the 'Outbound Messaging Delivery Status'
 
org.xml.sax.SAXParseException: Content is not allowed in prolog
Kindly help us on this. If you could detail down the steps to invoke any class on external server. This class has to pick the Id field sent in OM
werewolfwerewolf
Are you sending the necessary ACK XML response back correctly?
SuperfellSuperfell
Typically you see this when your endpoint code throws an exception, and the servlet returns a HTML error page.
Ad_InfosysAd_Infosys

I am using following servlet. I am sending the ID field thru the OM. This is the oonly code that I have on the server.

public void service(ServletRequest request,ServletResponse response)throws ServletException,IOException{


  response.setContentType("text/html");
  String Id=request.getParameter("Id");
  PrintWriter out = response.getWriter();
  out.print("<HTML><HEAD><TITLE>Testing Servlets</TITLE></HEAD><BODY><H1>Hello"+Id+"</H1></BODY></HTML>");
  out.close();

 }

I am sending URL for this servlet. Do we need to place the xml generated for the OM in the server. Do we need to set up some interface etc.

SuperfellSuperfell
You probably need to re-read the API docs on OM in more detail. you'll be sent an XML/SOAP request, and you need to reply with an XML/SOAP response.
Ad_InfosysAd_Infosys

Thanks Simon,

Kindly tell me, do we need to place the WSDL for OM on our server?

How can we read ID parameter sent in the message at the server. I am doing this in JAva code so couldnt relate to the .Net code given in the guide.

SuperfellSuperfell
There's a java example on the wiki http://wiki.apexdevnet.com/index.php/Creating_an_Outbound_Messaging_Notification_Service_in_Java
Ad_InfosysAd_Infosys
Thanks Simon,
Somehow Even I was following the same. I am complete with the defined process. Now the whole project I have exported to Apache tomcat. I created the respective folder structure and placed the content from the development machine to the target machine(Tomcat).
 
Now I have supplied the URL of the server in OM (SFDC).
I got the machine removed from the firewall. But still seeing the error
org.xml.sax.SAXParseException: White spaces are required between publicId and systemId.
 
 
Kindly help me from this onward.
 
Thanks so very much for your concern.
SuperfellSuperfell
You are not returning a soap response. Use a networking diagnostics tool to examine the request/response to your server. (e.g. ethereal, tcpTrace, SOAPScope, tcpmon)
Ad_InfosysAd_Infosys

We are sending the acknowledgment response back to SFDC as suggested in the doc. Under the Testing your service, we getting the result as

 

notificationsResponse

Ack(boolean): true

SuperfellSuperfell
If you were it would parse correctly. please check your actual HTTP response with one of the diagnostic tools i suggested earlier.
Ad_InfosysAd_Infosys

public boolean notifications(java.lang.String organizationId, java.lang.String actionId, java.lang.String sessionId, java.lang.String enterpriseUrl, java.lang.String partnerUrl, com.sforce.soap._2005._09.outbound.Client_Account_Information__cNotification[] notification) throws java.rmi.RemoteException {
       
          Client_Account_Information__cNotification[] a= notification;
        for (int i = 0; i < a.length; i++)
        {
         System.out.println("Notification " + (i + 1));
         Client_Account_Information__cNotification notifications = a[i];
            //Pull the account data out
         com.sforce.soap.enterprise.sobject.Client_Account_Information__c a1 =(com.sforce.soap.enterprise.sobject.Client_Account_Information__c)notifications.getSObject();
            //We will just echo some values to the console
         System.out.println("\tAccount number: " + a1.getId());
         
        }
     
     return true;
    }

This is the code we are deploying on the server. If you notice the last line we are returning a true. Is this not sufficient to send the acknowledgment to SFDC. If changes required kindly highlight.
 
 
Thanks in advance.
SuperfellSuperfell
Just because that's your code doesn't mean its not throwing an exception at runtime. What's the URL of your server ?
Ad_InfosysAd_Infosys
http://chdsez104297d:8080/OMTest/services/Notification
 
This is the machine name of the server.
We are not able to access this from the SFDC server.
 
Kindly help
SuperfellSuperfell
Talk to your network admin.
Ad_InfosysAd_Infosys

HI Simon,

I made adequate changes

Now I am facing the following error.

SocketTimeoutException: Read timed out.
 
Any wisdom on this 
SuperfellSuperfell
We wait 10 seconds for your server to reply, and we did not receive the reply within the 10 second window.
Ad_InfosysAd_Infosys
What is the reason for this and the resolution to this.