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
michael tangmichael tang 

Outbound message acknowledge failure

My development platform is tomcat 6 and eclipse WTP3.0 + Axis2 1.4. when I deploy a web service using outbound message wsdl downloaded from salesforce. in the salesforce website,  There is a exception like below org.xml.sax.SAXParseException: White spaces are required between publicId and systemId.
 
How to resolve it?
 
 
 
Best Regards,
Michael
SuperfellSuperfell
Do you have a capture of your response? I've seen this before when the server incorrectly returns HTML instead of SOAP.
michael tangmichael tang
it is ok now.
 
the below is my code
 
package com.ibi.salesforce.test;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.ServerSocket;
import java.net.Socket;
 
public class AcknowledgeTest {
 public AcknowledgeTest() {
  // TODO Auto-generated constructor stub
 }
 /**
  * @param args
  * @throws IOException
  */
 public static void main(String[] args) throws IOException {
  ServerSocket server = new ServerSocket(80);
  Socket socket = server.accept();
  InputStream is = socket.getInputStream();
  OutputStream os = socket.getOutputStream();
  os.write("HTTP/1.0".getBytes());
  os.write(32);
  os.write("200".getBytes());
  os.write(32);
  os.write("OK".getBytes());
  os.write(13);
  os.write(10);
  
  String payLoad = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
   + "<SOAP-ENV:Envelope xmlns:SOAP-ENV=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:SOAP-ENC=\"http://schemas.xmlsoap.org/soap/encoding/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">"
   + "<SOAP-ENV:Body>"
   + "<notificationsResponse>"
   + "<Ack>true</Ack>"
   + "</notificationsResponse>"
   + "</SOAP-ENV:Body>"
   + "</SOAP-ENV:Envelope>";
  byte[] bytes = payLoad.getBytes();
  
  os.write("Content-Type".getBytes());
  os.write(58);
  os.write(32);
  os.write("application/xml".getBytes());
  os.write(13);
  os.write(10);
       
  os.write("Content-Length".getBytes());
  os.write(58);
  os.write(32);
  os.write(String.valueOf(bytes.length).getBytes());
  os.write(13);
  os.write(10);
  
  os.write("SOAPAction".getBytes());
  os.write(58);
  os.write(32);
  os.write("".getBytes());
  os.write(13);
  os.write(10);
  os.write(bytes);
  
   
 }
}
 
the response file is below:
HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Content-Type: text/xml;charset=utf-8
Date: Mon, 10 Nov 2008 06:25:03 GMT
Connection: close
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<ns3:notificationsResponse xmlns:ns3="http://soap.sforce.com/2005/09/outbound">
<ns3:Ack>true</ns3:Ack>
</ns3:notificationsResponse>
</soapenv:Body>
</soapenv:Envelope>
michael tangmichael tang
update the correct code below
 
import java.io.FileInputStream;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.ServerSocket;
import java.net.Socket;

public class Acknowledge {
 /**
  * @param args
  * @throws Exception
  */
 public static void main(String[] args) throws Exception {
  // TODO Auto-generated method stub
  FileInputStream fis = new FileInputStream("acknowledge.txt");
  byte[] response = new byte[fis.available()];
  fis.read(response);
  fis.close();
  
  ServerSocket server = new ServerSocket(80);
  while (true) {
   Socket socket = server.accept();
   InputStream is = socket.getInputStream();
   byte[] bytes = new byte[is.available()];
   is.read(bytes);
   String request = new String(bytes);
   System.out.println(request);
   
   
   OutputStream os = socket.getOutputStream();
   os.write(response);
   os.flush();
   os.close();
   
//   fis.close();
   
   is.close();
//   socket.close();
   
   
  }
 }
}