You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Michal Zaremba <mi...@deri.ie> on 2004/05/31 20:30:51 UTC

Message services - public void method(SOAPEnvelope req, SOAPEnvelope resp);

Hi, 

I am trying to use the fourth type of the message service without any
success (did anybody managed to run it before, as I am not finding any
examples on the internet). 

I tried to run my code with Tomcat 4.1.x and 5.x. I tried it with Sun One,
but I am still getting the same error:
HTTP/1.1 500 Internal Server Error
Content-Type: text/xml;charset=utf-8
Date: Mon, 31 May 2004 17:53:27 GMT
Server: Apache-Coyote/1.1
Connection: close
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
 <soapenv:Body>
  <soapenv:Fault>
   <faultcode>soapenv:Server.userException</faultcode>
   <faultstring>java.lang.Exception: Body not found.</faultstring>
   <detail/>
  </soapenv:Fault>
 </soapenv:Body>
</soapenv:Envelope>
 

I have the following code for the service:
public void myMethod(SOAPEnvelope req, SOAPEnvelope resp) {
	try {
		resp.setBody((SOAPBody)req.getBody());
	} catch (javax.xml.soap.SOAPException soap) {
		soap.printStackTrace();			
	}
}

My descriptor looks following:
<service name="MessageService" style="java:MSG">
	<parameter name="className" value="ie.deri.test.MessageService" />
	<parameter name="allowedMethods" value="myMethod" /> </service>

My client invokes Web Service in a given way:
opts.setDefaultURL("http://localhost:8085/axis/services/MessageService");
Service  service = new Service();
Call     call    = (Call) service.createCall();
call.setTargetEndpointAddress( new URL(opts.getURL()) );
call.setOperationName("myMethod") ;
org.apache.axis.message.SOAPEnvelope envelope = new
org.apache.axis.message.SOAPEnvelope();
SOAPBody body = (org.apache.axis.message.SOAPBody)envelope.getBody();
org.apache.axis.message.SOAPEnvelope env = call.invoke(envelope);

There are no other errors in standard out or err. I would be very greatful
if somebody could help me to move forward with this code. 

Michal