Kevin:
I am quite a newbee to all this axis stuff. But I was a little bit confused
by your code. I always use code that is similar to the one in the examples.
And it works fine. This code looks a little bit like:
Service service = new Service();
Call call = (Call) service.createCall();
call.setTargetEndpointAddress( new java.net.URL( "http://......." ) );
call.setOperationName(new QName("http://soapinterop.org/",
"myEchoMethod") );
String ret = (String) call.invoke( new Object[] { "Hello!" } );
I hope this helps.
Matthias Wimmer
-----Original Message-----
From: Kevin Sebastian [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, June 26, 2002 5:16 PM
To: [EMAIL PROTECTED]
Subject: SOAP Messaging - SOAPConnection call failes
Hi,
I have a servlet running on Tomcat which returns a SOAP message from its
doPost() method.
I am trying to connect to the servlet using the point to point
request-response messaging
mechanism. I have written a java client for this.
The problem I face is, that the client connects to the servlet once and
I get the soap message returned
by the servlet. If I run the client a second time I get the following
exception :
javax.xml.soap.SOAPException: java.net.SocketException: Connection reset
by peer
at
org.apache.axis.soap.SOAPConnectionImpl.call(SOAPConnectionImpl.java:92)
at MyRequestClient.main(KiveraRequest.java:42)
If I restart TOMCAT and run the client again, it works again once.
My client code looks like this :
SOAPConnectionFactory scf =
SOAPConnectionFactory.newInstance();
SOAPConnection con = scf.createConnection();
MessageFactory mf = MessageFactory.newInstance();
SOAPMessage msg = mf.createMessage();
// Access the SOABBody object
SOAPPart part = msg.getSOAPPart();
SOAPEnvelope envelope = part.getEnvelope();
SOAPBody body = envelope.getBody();
//create SOAPBodyElement request
Name bodyName = envelope.createName("request-data");
SOAPBodyElement requestData = body.addBodyElement(bodyName);
Name requestName = envelope.createName("request");
SOAPElement request =
requestData.addChildElement(requestName);
request.addTextNode("Send data.");
msg.saveChanges();
//create the endpoint and send the message
URL endpoint = new
URL("http://localhost:8888/MyWebService/servlet/MyServlet")
;
SOAPMessage response = con.call(msg, endpoint);
con.close();
Is this because the connection.close() call is'nt working ? Does anybody
know how the connection mechanism
works ? Does'nt the client open a new connection to the servlet each
time its run ?
Any information will be greatly appreciated.
Thanks a lot,
kevin.