RE: How to add a SOAP header in an axis2 custom client-side handler?

2008-08-14 Thread Franklin, Allen
I don't have a services.xml, and I don't have the manageTransportSession
parameter in my axis2.xml.

But I am just running an axis2 client and my client seems to run ok
without them.

 

I am stuck trying to figure out how to manipulate the SOAP header in my
client-side handler.

The semantics for manipulating the SOAP header has changed between axis1
and axis2.

I am having trouble finding documentation and sample code that
manipulates the

SOAP header obtained from a MessageContext.

 

From: Martin Gainty [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, August 13, 2008 8:43 PM
To: axis-user@ws.apache.org
Subject: RE: How to add a SOAP header in an axis2 custom client-side
handler?

 

didn't see your config params
axis2.xml
parameter name=manageTransportSession?/parameter

services.xml
  service name=MultiplyService scope=?

Martin 
__ 
Disclaimer and confidentiality note 
Everything in this e-mail and any attachments relates to the official
business of Sender. This transmission is of a confidential nature and
Sender does not endorse distribution to any party other than intended
recipient. Sender does not necessarily endorse content contained within
this transmission. 





Subject: How to add a SOAP header in an axis2 custom client-side
handler?
Date: Wed, 13 Aug 2008 18:26:36 -0400
From: [EMAIL PROTECTED]
To: axis-user@ws.apache.org

I am trying to figure out how to add a SOAP header in my client-side
handler.

I have the following axis1 code, but need an axis2 equivalent:

 

 
/***

* Processes the header of a request message.  This method will add
the 

* session header to the outgoing request.

* 

* @param context the message context associated with the request

 
**/

   private void invokeRequest( MessageContext context ) throws AxisFault

   { 

  Message msg = context.getRequestMessage();

  if (msg == null)

 throw new AxisFault( Message not in context. );



  SOAPEnvelope env = msg.getSOAPEnvelope();

 

  SessionHeaderType sessionHeader =
WebServiceClientHelper.getThreadSessionHeader( );

 

  SOAPHeaderElement header = new SOAPHeaderElement(HEADER_NS,

   HEADER_NAME,

   sessionHeader);

  env.addHeader(header);

   }

 

The SessionHeaderType class was generated from a wsdl and contains
session credentials.

 

Any pointers to appropriate documentation on how to manipulate headers,
or sample code, would be appreciated.

 



Your PC, mobile phone, and online services work together like never
before. See how Windows(r) fits your life
http://clk.atdmt.com/MRT/go/108587394/direct/01/ 



Re: How to add a SOAP header in an axis2 custom client-side handler?

2008-08-14 Thread Detelin Yordanov
Hi,
 Should be as simple as:

import org.apache.axiom.soap.*;

SOAPHeader header = context.getEnvelope().getHeader(); //context is Axis2
MessageContext
SOAPHeaderBlock headerBlock = header.addHeaderBlock(HEADER_NAME, HEADER_NS);

Now you can add whatever you want to the headerBlock, it is just an ordinary
Axiom OMElement, e.g.
headerBlock.setText(my value);

See javadocs:
http://ws.apache.org/commons/axiom/apidocs/org/apache/axiom/soap/SOAPHeaderBlock.html

Regards,
Detelin

On Thu, Aug 14, 2008 at 3:48 PM, Franklin, Allen [EMAIL PROTECTED]
 wrote:

  I don't have a services.xml, and I don't have the manageTransportSession 
 parameter
 in my axis2.xml.

 But I am just running an axis2 client and my client seems to run ok without
 them.



 I am stuck trying to figure out how to manipulate the SOAP header in my
 client-side handler.

 The semantics for manipulating the SOAP header has changed between axis1
 and axis2.

 I am having trouble finding documentation and sample code that manipulates
 the

 SOAP header obtained from a MessageContext.



 *From:* Martin Gainty [mailto:[EMAIL PROTECTED]
 *Sent:* Wednesday, August 13, 2008 8:43 PM
 *To:* axis-user@ws.apache.org
 *Subject:* RE: How to add a SOAP header in an axis2 custom client-side
 handler?



 didn't see your config params
 axis2.xml
 parameter name=manageTransportSession?/parameter

 services.xml
   service name=MultiplyService scope=?

 Martin
 __
 Disclaimer and confidentiality note
 Everything in this e-mail and any attachments relates to the official
 business of Sender. This transmission is of a confidential nature and Sender
 does not endorse distribution to any party other than intended recipient.
 Sender does not necessarily endorse content contained within this
 transmission.

  --

 Subject: How to add a SOAP header in an axis2 custom client-side handler?
 Date: Wed, 13 Aug 2008 18:26:36 -0400
 From: [EMAIL PROTECTED]
 To: axis-user@ws.apache.org

 I am trying to figure out how to add a SOAP header in my client-side
 handler.

 I have the following axis1 code, but need an axis2 equivalent:



/***

 * Processes the header of a request message.  This method will add the

 * session header to the outgoing request.

 *

 * @param context the message context associated with the request

 **/

private void invokeRequest( MessageContext context ) throws AxisFault

{

   Message msg = context.getRequestMessage();

   if (msg == null)

  throw new AxisFault( Message not in context. );



   SOAPEnvelope env = msg.getSOAPEnvelope();



   SessionHeaderType sessionHeader =
 WebServiceClientHelper.getThreadSessionHeader( );



   SOAPHeaderElement header = new SOAPHeaderElement(HEADER_NS,

HEADER_NAME,

sessionHeader);

   env.addHeader(header);

}



 The SessionHeaderType class was generated from a wsdl and contains session
 credentials.



 Any pointers to appropriate documentation on how to manipulate headers, or
 sample code, would be appreciated.


  --

 Your PC, mobile phone, and online services work together like never before.
 See how Windows(R) fits your 
 lifehttp://clk.atdmt.com/MRT/go/108587394/direct/01/



RE: How to add a SOAP header in an axis2 custom client-side handler?

2008-08-14 Thread Martin Gainty

Good Morning Allen-

you'll need to use the org.apache.axis2.context.ConfigurationContext to get at 
the SOAPSessionTable 
as in 
ConfigurationContext ctx = 
endpointDesc.getServiceDescription().getAxisConfigContext();
and to get at the session
getServiceGroupContextFromSoapSessionTable
More information available at
http://ws.apache.org/axis2/1_3/api/org/apache/axis2/context/ConfigurationContext.html

HTH
Martin 
__ 
Disclaimer and confidentiality note 
Everything in this e-mail and any attachments relates to the official business 
of Sender. This transmission is of a confidential nature and Sender does not 
endorse distribution to any party other than intended recipient. Sender does 
not necessarily endorse content contained within this transmission. 


Date: Thu, 14 Aug 2008 16:20:35 +0300
From: [EMAIL PROTECTED]
To: axis-user@ws.apache.org
Subject: Re: How to add a SOAP header in an axis2 custom client-side handler?

Hi,
 Should be as simple as:

import org.apache.axiom.soap.*;

SOAPHeader header = context.getEnvelope().getHeader(); //context is Axis2 
MessageContext
SOAPHeaderBlock headerBlock = header.addHeaderBlock(HEADER_NAME, HEADER_NS);


Now you can add whatever you want to the headerBlock, it is just an ordinary 
Axiom OMElement, e.g.
headerBlock.setText(my value);

See javadocs: 
http://ws.apache.org/commons/axiom/apidocs/org/apache/axiom/soap/SOAPHeaderBlock.html


Regards,
Detelin

On Thu, Aug 14, 2008 at 3:48 PM, Franklin, Allen [EMAIL PROTECTED] wrote:















I don't have a services.xml, and I don't have the manageTransportSession
parameter in my axis2.xml.

But I am just running an axis2 client and my client seems to run
ok without them.

 

I am stuck trying to figure out how to manipulate the SOAP
header in my client-side handler.

The semantics for manipulating the SOAP header has changed
between axis1 and axis2.

I am having trouble finding documentation and sample code that
manipulates the

SOAP header obtained from a MessageContext.

 





From: Martin Gainty
[mailto:[EMAIL PROTECTED] 

Sent: Wednesday, August 13, 2008 8:43 PM

To: axis-user@ws.apache.org

Subject: RE: How to add a SOAP header in an axis2 custom client-side
handler?





 

didn't see your config params

axis2.xml

parameter
name=manageTransportSession?/parameter



services.xml

  service name=MultiplyService scope=?



Martin 

__ 

Disclaimer and confidentiality note 

Everything in this e-mail and any attachments relates to the official business
of Sender. This transmission is of a confidential nature and Sender does not
endorse distribution to any party other than intended recipient. Sender does
not necessarily endorse content contained within this transmission. 











Subject: How to add a SOAP header in an
axis2 custom client-side handler?

Date: Wed, 13 Aug 2008 18:26:36 -0400

From: [EMAIL PROTECTED]

To: axis-user@ws.apache.org



I am trying to figure out how to add a SOAP header in my
client-side handler.

I have the following axis1 code, but need an axis2 equivalent:

 

  
/***

* Processes the header of a request
message.  This method will add the 

* session header to the outgoing request.

* 

* @param context the message context
associated with the request

   
**/

   private void invokeRequest( MessageContext context
) throws AxisFault

   { 

  Message msg =
context.getRequestMessage();

  if (msg == null)

 throw new
AxisFault( Message not in context. );

   


  SOAPEnvelope env =
msg.getSOAPEnvelope();

 

  SessionHeaderType sessionHeader =
WebServiceClientHelper.getThreadSessionHeader( );

 

  SOAPHeaderElement header = new
SOAPHeaderElement(HEADER_NS,


  HEADER_NAME,

  
sessionHeader);

  env.addHeader(header);

   }

 

The SessionHeaderType class was generated from a wsdl and
contains session credentials.

 

Any pointers to appropriate documentation on how to manipulate headers,
or sample code, would be appreciated.



 







Your
PC, mobile phone, and online services work together like never before. See how
Windows® fits your life









_
Got Game? Win Prizes in the Windows Live Hotmail Mobile Summer Games Trivia 
Contest
http://www.gowindowslive.com/summergames?ocid=TXT_TAGHM

RE: How to add a SOAP header in an axis2 custom client-side handler?

2008-08-13 Thread Martin Gainty

didn't see your config params
axis2.xml
parameter name=manageTransportSession?/parameter

services.xml
  service name=MultiplyService scope=?

Martin 
__ 
Disclaimer and confidentiality note 
Everything in this e-mail and any attachments relates to the official business 
of Sender. This transmission is of a confidential nature and Sender does not 
endorse distribution to any party other than intended recipient. Sender does 
not necessarily endorse content contained within this transmission. 


Subject: How to add a SOAP header in an axis2 custom client-side handler?
Date: Wed, 13 Aug 2008 18:26:36 -0400
From: [EMAIL PROTECTED]
To: axis-user@ws.apache.org
















I am trying to figure out how to add a SOAP header in my
client-side handler.

I have the following axis1 code, but need an axis2 equivalent:

 

   /***

* Processes the header of a request message.  This method
will add the 

* session header to the outgoing request.

* 

* @param context the message context associated with the
request

**/

   private void invokeRequest( MessageContext context ) throws
AxisFault

   { 

  Message msg = context.getRequestMessage();

  if (msg == null)

 throw new AxisFault( Message not in
context. );



  SOAPEnvelope env = msg.getSOAPEnvelope();

 

  SessionHeaderType sessionHeader =
WebServiceClientHelper.getThreadSessionHeader( );

 

  SOAPHeaderElement header = new
SOAPHeaderElement(HEADER_NS,

   HEADER_NAME,

  
sessionHeader);

  env.addHeader(header);

   }

 

The SessionHeaderType class was generated from a wsdl and
contains session credentials.

 

Any pointers to appropriate documentation on how to manipulate
headers, or sample code, would be appreciated.







_
Your PC, mobile phone, and online services work together like never before.
http://clk.atdmt.com/MRT/go/108587394/direct/01/