Return-Path: Delivered-To: apmail-ws-axis-user-archive@www.apache.org Received: (qmail 79867 invoked from network); 14 Aug 2008 13:21:14 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 14 Aug 2008 13:21:14 -0000 Received: (qmail 73444 invoked by uid 500); 14 Aug 2008 13:21:03 -0000 Delivered-To: apmail-ws-axis-user-archive@ws.apache.org Received: (qmail 73434 invoked by uid 500); 14 Aug 2008 13:21:03 -0000 Mailing-List: contact axis-user-help@ws.apache.org; run by ezmlm Precedence: bulk Reply-To: axis-user@ws.apache.org list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list axis-user@ws.apache.org Received: (qmail 73423 invoked by uid 99); 14 Aug 2008 13:21:03 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 14 Aug 2008 06:21:03 -0700 X-ASF-Spam-Status: No, hits=2.0 required=10.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of detelinyordanov@gmail.com designates 209.85.198.251 as permitted sender) Received: from [209.85.198.251] (HELO rv-out-0708.google.com) (209.85.198.251) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 14 Aug 2008 13:20:07 +0000 Received: by rv-out-0708.google.com with SMTP id c5so353771rvf.28 for ; Thu, 14 Aug 2008 06:20:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:in-reply-to:mime-version:content-type:references; bh=CL66QSEtbfhqzs4mRStmwfrvuxtr82a1UTV4mQ2p2FY=; b=kwcdFJNBm7G2B5JCa03xriDVSNbnbqOCOJZ2lj4mAvTQqluUfCQQFDawsiZSiajPeF +JPlmOrnaTI2RTskp52EuNJnIdygZ8c3E1yQHvzIzZv86IkJCJ0BajVq1RWOGz9pwTh0 ViIDWw47u2YaVJO9/JMk9QcDS0Ocm1W8cqe4w= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:in-reply-to:mime-version :content-type:references; b=XCKI9LBg7BhOXRWnCvP4sq8CXRHZpLLsthNNCxasUhubDUMfCtneTCbh8C89Z2/REr l9KPwKT9feEsBwXy/X5iws3TyQ3NPNlG9LbEJS/iKV/Sob4kKhEnR8Vhtaw14mrtDGLu JAaC2m5Cm0wlaEKka+dyFT8DLO9doFsd+DiOs= Received: by 10.140.133.9 with SMTP id g9mr639503rvd.235.1218720035507; Thu, 14 Aug 2008 06:20:35 -0700 (PDT) Received: by 10.141.1.3 with HTTP; Thu, 14 Aug 2008 06:20:35 -0700 (PDT) Message-ID: Date: Thu, 14 Aug 2008 16:20:35 +0300 From: "Detelin Yordanov" To: axis-user@ws.apache.org Subject: Re: How to add a SOAP header in an axis2 custom client-side handler? In-Reply-To: <4821D5B6CD3C1B4880E6E94C6E70913E030A27BF@sun-email.corp.avocent.com> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_39597_23771850.1218720035501" References: <4821D5B6CD3C1B4880E6E94C6E70913E030A2774@sun-email.corp.avocent.com> <4821D5B6CD3C1B4880E6E94C6E70913E030A27BF@sun-email.corp.avocent.com> X-Virus-Checked: Checked by ClamAV on apache.org ------=_Part_39597_23771850.1218720035501 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline 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 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:mgainty@hotmail.com] > *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 > ? > > services.xml > > > 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: Allen.Franklin@avocent.com > 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 > ------=_Part_39597_23771850.1218720035501 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline
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 <Allen.Franklin@avocent.com> 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:mgainty@hotmail.com]
Sent: Wednesday, August 13, 2008 8:43 PM

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: Allen.Franklin@avocent.com
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


------=_Part_39597_23771850.1218720035501--