Jose,
 
You wont be able to get a SOAPEnvelope at the client end after the call or before the call .. because before the call there is no SOAPMessage and after the Call the response is over.
 
and Call.getMessgaeContext() will return a null value. So you cant access that Message Context.
 
How ever you can do one thing.
 
You can implement a Handler which will be invoked only in the requestFlow and can then manipulate the SOAPMessage and the Handler end.
 
To do that you must add a handler in the deploy.wsdd file and write a Handler class which extends the BasicHandler class of Axis APIs.
 
 <handler name="AttachmentHandler" type="java:com.bt.oexgateway.webservices.AttachmentHandler"/>
 
  <service name="TestOAGXMLService" provider="java:RPC" style="rpc" use="encoded">
    <requestFlow>
   <handler type="AttachmentHandler"/>
     </requestFlow>
    <responseFlow>
   <handler type="AttachmentHandler"/>
     </responseFlow>
....
</service>
 
The handler class will be something like this
 
import org.apache.axis.handlers.BasicHandler;
public class AttachmentHandler extends BasicHandler
{
 public void invoke(MessageContext msgContext) throws AxisFault
 {
  System.out.println("Hi Hi Handler Invoked !! ");
  
  //  Gets the Request SOAP Message  
   Message reqMsg = msgContext.getRequestMessage();
  //  Gets the response SOAP Message     
   Message respMsg = msgContext.getResponseMessage();
   
...
....
}
}
 
During the call from the client the method invoke() of the declared handler is called . It depends on the declaration in the WSDD file . If  you need it in both requestFlow and responseFlow then give as above wsdd. if you need only in request then only <requestFlow> is needed.. Depends upon you and ur application.
 
People, Hope I am right here.
Hope this helps you
 
Cheers
Dhanush
 
----- Original Message -----
Sent: Friday, June 04, 2004 8:00 AM
Subject: How to get the SOAP Envelope from msg Context without invocation

Hi:
    I'm writing an Axis Client that needs to send RPC style signed requests
according to XML-DSIG. My problem is that in order to sign the SOAP Envelope
I need to first have it! :-) I have looked everywhere but I haven't found
where to do this.

I'm doing

Service service = new Service();
Call call = (Call) service.createCall();
call.setTargetEndpointAddress( new java.net.URL(endPoint) );
call.setOperationName( new QName(endPoint, operationName) );
call.addParameter( "String", XMLType.XSD_STRING, ParameterMode.IN );
call.setReturnType( XMLType.XSD_STRING );
String resu = (String) call.invoke(new Object[] { "Some String Input" });

After this last statement I can get the SOAP Message from the message
context doing:

mc = call.getMessageContext();
env = request.getSOAPEnvelope();

But the service was already invoked!!!Is there any way of setting the
parameters used for a call without actually invoking the service?

Cheers,

Jose M Selman
*********************************************************
Disclaimer:         

This message (including any attachments) contains
confidential information intended for a specific
individual and purpose, and is protected by law.
If you are not the intended recipient, you should
delete this message and are hereby notified that
any disclosure, copying, or distribution of this
message, or the taking of any action based on it,
is strictly prohibited.

*********************************************************
Visit us at http://www.mahindrabt.com

Reply via email to