I am writing both the server and the client. The server builds the XML using JAXB marshalling and piping back to the client in the HTTP socket. From the client the request is built using the message factory and sent over the connection factory instantiation. When the response is received the SAAJ API indicates the response was bad and equals null. The client is a applet.
Error Message
Jun 29, 2008 5:01:49 PM com.sun.xml.internal.messaging.saaj.client.p2p.HttpSOAPConnection post SEVERE: SAAJ0008: Bad Response; null com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl: java.security.PrivilegedActionException: com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl: Bad response: (-1null
Client Code
SOAPConnectionFactory soapConnectionFactory = SOAPConnectionFactory.newInstance(); if(connection == null) connection = soapConnectionFactory.createConnection(); MessageFactory factory = MessageFactory.newInstance(); SOAPMessage message = factory.createMessage(); SOAPHeader header = message.getSOAPHeader(); SOAPBody body = message.getSOAPBody(); header.detachNode(); QName bodymain = new QName("icb_xml"); SOAPBodyElement mainbodyElement = body.addBodyElement(bodymain); ... ... ... URL endpoint = new URL(serverurl); System.out.println("b"); SOAPMessage response = connection.call(message, endpoint);
Comm_log
[Client Request]>POST / HTTP/1.1 Accept: text/xml, text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2 Content-Type: text/xml; charset=utf-8 Content-Length: 242 Cache-Control: no-cache Pragma: no-cache User-Agent: Java(tm) 2 SDK, Standard Edition v1.6.0_05 Java/1.6.0_05 Host: sjdpprojectserver.hopto.org Connection: keep-alive <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"><SOAP-ENV:Body><icb_xml><login><username>jaco</username><password>12345</password><language>English</language></login></icb_xml></SOAP-ENV:Body></SOAP-ENV:Envelope> [Server Response]><env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"><env:Header/><env:Body><icb_xml><loginResponse><err_code>0</err_code><user_id>101</user_id></loginResponse></icb_xml></env:Body></env:Envelope>
In your opinion is this a server or client related problem or should I look for an alternative function rather than the SOAP message factory and connection factory?
Regards,
Buglish