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 "Jose M. Selman" <js...@bee.cl> on 2004/06/04 04:30:27 UTC
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
Re: Re: How to get the SOAP Envelope from msg Context without invocatio n
Posted by Davanum Srinivas <da...@gmail.com>.
I think you should try to use WSS4J's handlers. All the dirty work
regarding implementation of the OASIS specs for Web Services Security
is already taken care of in WSS4J:
- http://ws.apache.org/ws-fx/wss4j/apidocs/org/apache/ws/axis/security/package-summary.html
- http://ws.apache.org/ws-fx/wss4j/
Thanks,
dims
On Fri, 4 Jun 2004 10:21:57 -0400, Jose M. Selman <js...@bee.cl> wrote:
>
> Dims:
> I did, but that example uses a service with no parameters. In my case I
> need to include a String as a parameter. I have been trying to use XMLUtils
> to generate the SOAP Body (with one parameter) myself, just like the sample,
> but I haven't been able to get it right. I appreciate your help.
>
> Cheers,
>
> Jose M. Selman
>
>
>
>
> ----- Original Message -----
> From: "Davanum Srinivas" <da...@gmail.com>
> To: <ax...@ws.apache.org>
> Sent: Friday, June 04, 2004 9:04 AM
> Subject: Re: Re: How to get the SOAP Envelope from msg Context without
> invocatio n
>
> > please take a look at the samples/security/* for an example that does
> xml-dsig.
> >
> > thanks,
> > dims
> >
> >
> > ----- Original Message -----
> > From: Dhanush Gopinath <dh...@mahindrabt.com>
> > Date: Fri, 4 Jun 2004 09:20:21 +0530
> > Subject: Re: How to get the SOAP Envelope from msg Context without
> invocatio
> > n
> > To: axis-user@ws.apache.org
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > 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 -----
> >
> > From:
> > Jose M. Selman
> >
> > To: axis-user@ws.apache.org
> >
> > 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
>
>
Re: Re: How to get the SOAP Envelope from msg Context without invocatio n
Posted by "Jose M. Selman" <js...@bee.cl>.
Dims:
I did, but that example uses a service with no parameters. In my case I
need to include a String as a parameter. I have been trying to use XMLUtils
to generate the SOAP Body (with one parameter) myself, just like the sample,
but I haven't been able to get it right. I appreciate your help.
Cheers,
Jose M. Selman
----- Original Message -----
From: "Davanum Srinivas" <da...@gmail.com>
To: <ax...@ws.apache.org>
Sent: Friday, June 04, 2004 9:04 AM
Subject: Re: Re: How to get the SOAP Envelope from msg Context without
invocatio n
> please take a look at the samples/security/* for an example that does
xml-dsig.
>
> thanks,
> dims
>
>
> ----- Original Message -----
> From: Dhanush Gopinath <dh...@mahindrabt.com>
> Date: Fri, 4 Jun 2004 09:20:21 +0530
> Subject: Re: How to get the SOAP Envelope from msg Context without
invocatio
> n
> To: axis-user@ws.apache.org
>
>
>
>
>
>
>
>
>
> 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 -----
>
> From:
> Jose M. Selman
>
> To: axis-user@ws.apache.org
>
> 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
Re: Re: How to get the SOAP Envelope from msg Context without invocatio n
Posted by Davanum Srinivas <da...@gmail.com>.
please take a look at the samples/security/* for an example that does xml-dsig.
thanks,
dims
----- Original Message -----
From: Dhanush Gopinath <dh...@mahindrabt.com>
Date: Fri, 4 Jun 2004 09:20:21 +0530
Subject: Re: How to get the SOAP Envelope from msg Context without invocatio
n
To: axis-user@ws.apache.org
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 -----
From:
Jose M. Selman
To: axis-user@ws.apache.org
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
Re: How to get the SOAP Envelope from msg Context without invocation
Posted by Davanum Srinivas <da...@gmail.com>.
Yes, look at test\wsdl\jaxrpchandler\JAXRPCHandlerTestCase.java search
for ClientHandler
-- dims
----- Original Message -----
From: Jose M. Selman <js...@bee.cl>
Date: Fri, 4 Jun 2004 10:17:52 -0400
Subject: Re: How to get the SOAP Envelope from msg Context without invocation
To: axis-user@ws.apache.org
Is it possible to programatically set
client-side handlers? That way my problem would be solved.
Cheers,
Jose M. Selman
----- Original Message -----
From:
Dhanush
Gopinath
To: axis-user@ws.apache.org
Sent: Thursday, June 03, 2004 11:50
PM
Subject: Re: How to get the SOAP Envelope
from msg Context without invocation
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 -----
From:
Jose M. Selman
To: axis-user@ws.apache.org
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
Re: How to get the SOAP Envelope from msg Context without invocatio
n
Posted by Dhanush Gopinath <dh...@mahindrabt.com>.
Jose,
Handlers are called while request and response flows. It is an automatic process...
I dont know much more than this as I am also in the learning phase :) Hope some one can help
Dhanush
----- Original Message -----
From: Jose M. Selman
To: axis-user@ws.apache.org
Sent: Friday, June 04, 2004 7:47 PM
Subject: Re: How to get the SOAP Envelope from msg Context without invocation
Is it possible to programatically set client-side handlers? That way my problem would be solved.
Cheers,
Jose M. Selman
----- Original Message -----
From: Dhanush Gopinath
To: axis-user@ws.apache.org
Sent: Thursday, June 03, 2004 11:50 PM
Subject: Re: How to get the SOAP Envelope from msg Context without invocation
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 -----
From: Jose M. Selman
To: axis-user@ws.apache.org
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
*********************************************************
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
Re: How to get the SOAP Envelope from msg Context without invocation
Posted by "Jose M. Selman" <js...@bee.cl>.
Is it possible to programatically set client-side handlers? That way my problem would be solved.
Cheers,
Jose M. Selman
----- Original Message -----
From: Dhanush Gopinath
To: axis-user@ws.apache.org
Sent: Thursday, June 03, 2004 11:50 PM
Subject: Re: How to get the SOAP Envelope from msg Context without invocation
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 -----
From: Jose M. Selman
To: axis-user@ws.apache.org
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
Re: How to get the SOAP Envelope from msg Context without invocatio
n
Posted by Dhanush Gopinath <dh...@mahindrabt.com>.
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 -----
From: Jose M. Selman
To: axis-user@ws.apache.org
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