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 craig wickesser <co...@gmail.com> on 2007/04/19 05:08:49 UTC

Apache Axis 2: how to get header? Options

Hi...I have a client which I am using to access a web service  The
code I have is...

                MyStub stub = new MyStub();
                HelloWorldDocument reqDoc =
HellWorldDocument.Factory.newInstance();
                reqDoc.setName("bob");

                HelloWorldResponseDocumnet resp = stub.SayHello(reqDoc);

The SOAP XML response is in the following form...

                <soap12:Envelope ....>
                  <soap12:Header>
                    <ErrorResponse ....>
                    </ErrorResponse>
                    <UserInfo ...>
                      <Id>string</Id>
                      <DOB>string</DOB>
                    </UserInfo>
                  </soap12:Header>
                  <soap12:Body>
                    <HelloWorldResponse ....>
                      .....
                    </HelloWorldResponse>
                  </soap12:Body>
                </soap12:Envelope>

My issue is I need to get stuff from the UserInfo header....how can I
get that?  Currently all I can get is the HelloWorldResponse from the
"body".
Thanks!

Re: Apache Axis 2: how to get header? Options

Posted by Deepal Jayasinghe <de...@opensource.lk>.
Hi craig ;

> Shaoguang,
>     MessageContext does not have a "getSoapEnvelope" method, in fact
> the only getter method it has is getCurrentMessageContext (at least
> for Axis2).  

Are you talking about org.apache.axis2.context.MessageContext , if that
is the case it has more than 40 getter methods :),
Any way If you want to access SOAP Envelop pls try "getEnvelope" .
Remember that is not a static method, so you can not call
MessageContext.getEnvelope();

> Any other ideas?  I think I might switch to XFire to do what I need.

Please go ahead and do so.

> I posted over there and it sounds like in the next day or so there
> will be support for getting the headers that I need.
>
> Thanks
> Craig
>
> On 4/22/07, *Thilina Gunarathne* <csethil@gmail.com
> <ma...@gmail.com>> wrote:
>
>     > Do we have a default  envelope  set in out message context in Axis2?
>     > In Step #1 what he does is set an envelope in out message
>     context (with the
>     > out headers) first and then retrieve it.
>     > outMessageContext.setEnvelope (createSOAPEnvelope());
>     see https://issues.apache.org/jira/browse/AXIS2-2531
>
>     Thanka,
>     Thilina
>     >
>     > So the Step# 2 suggestion is a performace improvement only if
>     Axis2 set a
>     > default out Envelope. I am not sure whether Axis2 does this or
>     not. if so I
>     > think we have to stop that since there is no reason to do that.
>     >
>     > Amila.
>     >
>     > > thanks,
>     > > dims
>     > >
>     > > On 4/19/07, Kang, Kamaljeet K. < Kamal.K.Kang@tellabs.com
>     <ma...@tellabs.com>> wrote:
>     > > > These are the changes I did to get Response SOAP header.
>     > > >
>     > > > 1) Save header in the message context in the skeleton
>     implementation.
>     > > >        MessageContext inMsgContext =
>     > MessageContext.getCurrentMessageContext();
>     > > >         OperationContext operationContext =
>     > inMsgContext.getOperationContext();
>     > > >         MessageContext outMessageContext = operationContext
>     > .getMessageContext( WSDLConstants.MESSAGE_LABEL_OUT_VALUE);
>     > > >         outMessageContext.setEnvelope (createSOAPEnvelope());
>     > > >         OMNode outHeaderNode = toOM(outHeader);
>     > > >
>     > > >
>     > outMessageContext.getEnvelope().getHeader().addChild(outHeaderNode);
>     > > >
>     > > > 2)  Modified autogenerated *InOutReceiver classes to not
>     create new
>     > Envelope if Envelope is already there in the context (modified
>     whereever
>     > factory.getDefaultEnvelope() is called)
>     > > >
>     > > > 3) Modified Stub to save the return message context
>     > > >                org.apache.axis2.context.MessageContext
>     > _returnMessageContext = _operationClient.getMessageContext(
>     > > >
>     > org.apache.axis2.wsdl.WSDLConstants.MESSAGE_LABEL_IN_VALUE
>     > );
>     > > >                 org.apache.axiom.soap.SOAPEnvelope
>     > _returnEnv = _returnMessageContext.getEnvelope();
>     > > >
>     > > > // Added this line
>     > > >
>     >
>     _serviceClient.getServiceContext().setLastOperationContext(_operationClient.getOperationContext());
>     > > >
>     > > >
>     > > > 4) Finally you can get the Response Header from stub
>     > > >
>     > > >         OperationContext oprCtxt =
>     > stub._getServiceClient().getLastOperationContext();
>     > > >         MessageContext inMsgContext =
>     > oprCtxt.getMessageContext (WSDLConstants.MESSAGE_LABEL_IN_VALUE);
>     > > >         SOAPHeader header =
>     inMsgContext.getEnvelope().getHeader();
>     > > >
>     > > >         return
>     > Header_T.Factory.parse(header.getFirstElement
>     ().getXMLStreamReaderWithoutCaching());
>     > > >
>     > > > Not sure if there is any easier way but finally this worked
>     for me.
>     > > >
>     > > > Let me know if you need more help with this.
>     > > >
>     > > >
>     > > > Kamal Kang
>     > > >
>     > > >
>     > > > -----Original Message-----
>     > > > From: José Antonio Sánchez [mailto: getaceres@gmail.com
>     <ma...@gmail.com>]
>     > > > Sent: Thursday, April 19, 2007 3:56 PM
>     > > > To: axis-user@ws.apache.org <ma...@ws.apache.org>
>     > > > Subject: Re: Apache Axis 2: how to get header? Options
>     > > >
>     > > > AFAIK you have to modify the stub code and get headers from
>     there. In
>     > > > Axis2 1.2 there is an operation in the generated stub to get
>     the last
>     > > > operation context (and so the envelope object) but it didn't
>     work for
>     > > > me.
>     > > >
>     > > > On 4/19/07, craig wickesser <codecraig@gmail.com
>     <ma...@gmail.com>> wrote:
>     > > > > anyone???
>     > > > >
>     > > > >
>     > > > > On 4/18/07, craig wickesser <codecraig@gmail.com
>     <ma...@gmail.com>> wrote:
>     > > > > > Hi...I have a client which I am using to access a web
>     service  The
>     > > > > > code I have is...
>     > > > > >
>     > > > > >
>     > > > > >                 MyStub stub = new MyStub();
>     > > > > >                 HelloWorldDocument reqDoc =
>     > > > > HellWorldDocument.Factory.newInstance ();
>     > > > > >                 reqDoc.setName("bob");
>     > > > > >
>     > > > > >
>     > > > > >                 HelloWorldResponseDocumnet resp =
>     > stub.SayHello(reqDoc);
>     > > > > >
>     > > > > >
>     > > > > > The SOAP XML response is in the following form...
>     > > > > >
>     > > > > >
>     > > > > >                 <soap12:Envelope ....>
>     > > > > >                   <soap12:Header>
>     > > > > >                     <ErrorResponse ....>
>     > > > > >                     </ErrorResponse>
>     > > > > >                     <UserInfo ...>
>     > > > > >                       <Id>string</Id>
>     > > > > >                       <DOB>string</DOB>
>     > > > > >                     </UserInfo>
>     > > > > >                   </soap12:Header>
>     > > > > >                   <soap12:Body>
>     > > > > >                     <HelloWorldResponse ....>
>     > > > > >                       .....
>     > > > > >                     </HelloWorldResponse>
>     > > > > >                   </soap12:Body>
>     > > > > >                 </soap12:Envelope>
>     > > > > >
>     > > > > >
>     > > > > > My issue is I need to get stuff from the UserInfo
>     header....how can
>     > I
>     > > > > > get that?  Currently all I can get is the
>     HelloWorldResponse from
>     > the
>     > > > > > "body".
>     > > > > >
>     > > > > > Thanks!
>     > > > > >
>     > > > > >
>     > > > > >
>     > > > > >
>     > > > > >
>     > > > > >
>     > > > > >
>     > > > > >
>     > > > > >
>     > > > > >
>     > > > > >
>     > > > > >
>     > > > >
>     > > > >
>     > > >
>     > > >
>     > > > --
>     > > > Saludos.
>     > > > José Antonio Sánchez
>     > > >
>     > > >
>     >
>     ---------------------------------------------------------------------
>     > > > To unsubscribe, e-mail:
>     > axis-user-unsubscribe@ws.apache.org
>     <ma...@ws.apache.org>
>     > > > For additional commands, e-mail:
>     axis-user-help@ws.apache.org <ma...@ws.apache.org>
>     > > >
>     > ============================================================
>     > > > The information contained in this message may be privileged
>     > > > and confidential and protected from disclosure. If the reader
>     > > > of this message is not the intended recipient, or an employee
>     > > > or agent responsible for delivering this message to the
>     > > > intended recipient, you are hereby notified that any
>     reproduction,
>     > > > dissemination or distribution of this communication is strictly
>     > > > prohibited. If you have received this communication in error,
>     > > > please notify us immediately by replying to the message and
>     > > > deleting it from your computer. Thank you. Tellabs
>     > > >
>     > ============================================================
>     > > >
>     > > >
>     >
>     ---------------------------------------------------------------------
>     > > > To unsubscribe, e-mail:
>     > axis-user-unsubscribe@ws.apache.org
>     <ma...@ws.apache.org>
>     > > > For additional commands, e-mail:
>     axis-user-help@ws.apache.org <ma...@ws.apache.org>
>     > > >
>     > > >
>     > >
>     > >
>     > > --
>     > > Davanum Srinivas :: http://wso2.org/ :: Oxygen for Web
>     Services Developers
>     > >
>     > >
>     >
>     ---------------------------------------------------------------------
>     > > To unsubscribe, e-mail:
>     > axis-user-unsubscribe@ws.apache.org
>     <ma...@ws.apache.org>
>     > > For additional commands, e-mail: axis-user-help@ws.apache.org
>     <ma...@ws.apache.org>
>     > >
>     > >
>     >
>     >
>     >
>     > --
>     > Amila Suriarachchi,
>     > WSO2 Inc.
>
>
>     --
>     Thilina Gunarathne  -  http://www.wso2.com -
>     http://thilinag.blogspot.com
>
>     ---------------------------------------------------------------------
>     To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
>     <ma...@ws.apache.org>
>     For additional commands, e-mail: axis-user-help@ws.apache.org
>     <ma...@ws.apache.org>
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


RE: Apache Axis 2: how to get header? Options

Posted by "Krishnamoorthy J (HCL Financial Services)" <Kr...@hcl.in>.
It will be available in both stub and skeleton classes. 

 

In my case inside the stub, the internal class "Factory" has "parse"
method.

 

                        /**

                         * Factory class that keeps the parse method

                         */

                        public static class Factory {

 

                                    /**

                                     * static method to create the
object Precondition: If this object

                                     * is an element, the current or
next start element starts this

                                     * object and any intervening reader
events are ignorable If this

                                     * object is not an element, it is a
complex type and the reader is

                                     * at the event just after the outer
start element Postcondition: If

                                     * this object is an element, the
reader is positioned at its end

                                     * element If this object is a
complex type, the reader is

                                     * positioned at the end element of
its outer element

                                     */

                                    public static IsDataValidResponse
parse(javax.xml.stream.XMLStreamReader reader)

                                                            throws
java.lang.Exception 

{

}

 

 

________________________________

From: Shaoguang Cong [mailto:scong1111@yahoo.com] 
Sent: Tuesday, April 24, 2007 9:40 PM
To: axis-user@ws.apache.org
Subject: Re: Apache Axis 2: how to get header? Options

 

In the generated Stub class, do a search for the method "fromOM" -
you'll get the idea on how to get your UserInfo object from the
OMElement (getHeader().getFirstChildWithName(QName of "UserInfo") ). 


craig wickesser <co...@gmail.com> wrote:

	so far I haven't found the "parse" method.

	On 4/23/07, craig wickesser <co...@gmail.com> wrote: 

	which class should have parse method? 

	 

	On 4/23/07, Davanum Srinivas <davanum@gmail.com > wrote: 

	look for parse method in those classes. The parse method takes
in a
	XMLStreamReader. If you see it it means you are using ADB based
code. 
	Next step is to use the AXIOM API to get the OMElement
corresponding
	to your UserInfo element in the soap header. basically call
	getChildren on the header and iterate till you find UserInfo.
When you
	get that OMElement, call getXMLStreamReader() and pass that to
the 
	parse method of your class
	
	-- dims
	
	On 4/23/07, craig wickesser <co...@gmail.com> wrote: 
	> there is UserInfoImpl and UserInfoDocumentImpl.
	>
	>
	>
	> On 4/23/07, craig wickesser <co...@gmail.com> wrote:
	> > yes
	> > 
	> >
	> >
	> > On 4/23/07, Davanum Srinivas < davanum@gmail.com > wrote:
	> > > Was this UserInfo class generated by WSDL2Java/ADB?
	> > > 
	> > > -- dims
	> > >
	> > > On 4/23/07, craig wickesser < codecraig@gmail.com> wrote:
	> > > > Ok, I put code into my Stub class so I could get the
	> _returnMessageContext.
	> > > > Now that I have access to the 
	> > > > org.apache.axiom.soap.SOAPHeader it gives me the XML,
	> is
	> > > > there a way to get the actual JavaBean objects based on
the header(s)?
	>  For
	> > > > example if my header looks like... 
	> > > >
	> > > >                   <soap12:Header>
	> > > >                     <ErrorResponse ....>
	> > > >                     </ErrorResponse> 
	> > > >                     <UserInfo ...>
	> > > >                       <Id>string</Id>
	> > > >                       <DOB>string</DOB>
	> > > >                     </UserInfo> 
	> > > >                   </soap12:Header>
	> > > >
	> > > > I have a UserInfo class which I would like to have
populated with the
	> > > > information from the XML....is there a way for this to
happen 
	> automatically
	> > > > or do I have to write my own XML Parser to parse the
header XML?
	> > > >
	> > > >  Thanks!
	> > > >
	> > >
	> > > 
	> > > --
	> > > Davanum Srinivas :: http://wso2.org/ :: Oxygen for Web
Services
	> Developers 
	> > >
	> > >
	>
--------------------------------------------------------------------- 
	> > > To unsubscribe, e-mail:
	> axis-user-unsubscribe@ws.apache.org
	> > > For additional commands, e-mail:
axis-user-help@ws.apache.org
	> > >
	> > >
	> >
	> >
	>
	>
	
	
	--
	Davanum Srinivas :: http://wso2.org/ :: Oxygen for Web Services
Developers 
	
	
---------------------------------------------------------------------
	To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
	For additional commands, e-mail: axis-user-help@ws.apache.org

	
	
	

	 

 

  

________________________________

Ahhh...imagining that irresistible "new car" smell?
Check out new cars at Yahoo! Autos.
<http://us.rd.yahoo.com/evt=48245/*http:/autos.yahoo.com/new_cars.html;_
ylc=X3oDMTE1YW1jcXJ2BF9TAzk3MTA3MDc2BHNlYwNtYWlsdGFncwRzbGsDbmV3LWNhcnM-
>  



DISCLAIMER:
-----------------------------------------------------------------------------------------------------------------------

The contents of this e-mail and any attachment(s) are confidential and intended for the named recipient(s) only. 
It shall not attach any liability on the originator or HCL or its affiliates. Any views or opinions presented in 
this email are solely those of the author and may not necessarily reflect the opinions of HCL or its affiliates. 
Any form of reproduction, dissemination, copying, disclosure, modification, distribution and / or publication of 
this message without the prior written consent of the author of this e-mail is strictly prohibited. If you have 
received this email in error please delete it and notify the sender immediately. Before opening any mail and 
attachments please check them for viruses and defect.

-----------------------------------------------------------------------------------------------------------------------

Re: Apache Axis 2: how to get header? Options

Posted by Shaoguang Cong <sc...@yahoo.com>.
In the generated Stub class, do a search for the method "fromOM" - you'll get the idea on how to get your UserInfo object from the OMElement (getHeader().getFirstChildWithName(QName of "UserInfo") ). 
  
craig wickesser <co...@gmail.com> wrote:
  so far I haven't found the "parse" method.

  On 4/23/07, craig wickesser <co...@gmail.com> wrote:   which class should have parse method?   

  On 4/23/07, Davanum Srinivas <davanum@gmail.com > wrote:   look for parse method in those classes. The parse method takes in a
XMLStreamReader. If you see it it means you are using ADB based code. 
Next step is to use the AXIOM API to get the OMElement corresponding
to your UserInfo element in the soap header. basically call
getChildren on the header and iterate till you find UserInfo. When you
get that OMElement, call getXMLStreamReader() and pass that to the 
parse method of your class

-- dims

On 4/23/07, craig wickesser <co...@gmail.com> wrote: 
> there is UserInfoImpl and UserInfoDocumentImpl.
>
>
>
> On 4/23/07, craig wickesser <co...@gmail.com> wrote:
> > yes
> > 
> >
> >
> > On 4/23/07, Davanum Srinivas < davanum@gmail.com > wrote:
> > > Was this UserInfo class generated by WSDL2Java/ADB?
> > > 
> > > -- dims
> > >
> > > On 4/23/07, craig wickesser < codecraig@gmail.com> wrote:
> > > > Ok, I put code into my Stub class so I could get the
> _returnMessageContext.
> > > > Now that I have access to the 
> > > > org.apache.axiom.soap.SOAPHeader it gives me the XML,
> is
> > > > there a way to get the actual JavaBean objects based on the header(s)?
>  For
> > > > example if my header looks like... 
> > > >
> > > >                   <soap12:Header>
> > > >                     <ErrorResponse ....>
> > > >                     </ErrorResponse> 
> > > >                     <UserInfo ...>
> > > >                       <Id>string</Id>
> > > >                       <DOB>string</DOB>
> > > >                     </UserInfo> 
> > > >                   </soap12:Header>
> > > >
> > > > I have a UserInfo class which I would like to have populated with the
> > > > information from the XML....is there a way for this to happen 
> automatically
> > > > or do I have to write my own XML Parser to parse the header XML?
> > > >
> > > >  Thanks!
> > > >
> > >
> > > 
> > > --
> > > Davanum Srinivas :: http://wso2.org/ :: Oxygen for Web Services
> Developers 
> > >
> > >
> --------------------------------------------------------------------- 
> > > To unsubscribe, e-mail:
> axis-user-unsubscribe@ws.apache.org
> > > For additional commands, e-mail: axis-user-help@ws.apache.org
> > >
> > >
> >
> >
>
>


--
Davanum Srinivas :: http://wso2.org/ :: Oxygen for Web Services Developers 

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org








       
---------------------------------
Ahhh...imagining that irresistible "new car" smell?
 Check outnew cars at Yahoo! Autos.

Re: Apache Axis 2: how to get header? Options

Posted by craig wickesser <co...@gmail.com>.
so far I haven't found the "parse" method.

On 4/23/07, craig wickesser <co...@gmail.com> wrote:
>
> which class should have parse method?
>
> On 4/23/07, Davanum Srinivas <da...@gmail.com> wrote:
> >
> > look for parse method in those classes. The parse method takes in a
> > XMLStreamReader. If you see it it means you are using ADB based code.
> > Next step is to use the AXIOM API to get the OMElement corresponding
> > to your UserInfo element in the soap header. basically call
> > getChildren on the header and iterate till you find UserInfo. When you
> > get that OMElement, call getXMLStreamReader() and pass that to the
> > parse method of your class
> >
> > -- dims
> >
> > On 4/23/07, craig wickesser <co...@gmail.com> wrote:
> > > there is UserInfoImpl and UserInfoDocumentImpl.
> > >
> > >
> > >
> > > On 4/23/07, craig wickesser <co...@gmail.com> wrote:
> > > > yes
> > > >
> > > >
> > > >
> > > > On 4/23/07, Davanum Srinivas < davanum@gmail.com > wrote:
> > > > > Was this UserInfo class generated by WSDL2Java/ADB?
> > > > >
> > > > > -- dims
> > > > >
> > > > > On 4/23/07, craig wickesser < codecraig@gmail.com> wrote:
> > > > > > Ok, I put code into my Stub class so I could get the
> > > _returnMessageContext.
> > > > > > Now that I have access to the
> > > > > > org.apache.axiom.soap.SOAPHeader it gives me the XML,
> > > is
> > > > > > there a way to get the actual JavaBean objects based on the
> > header(s)?
> > >  For
> > > > > > example if my header looks like...
> > > > > >
> > > > > >                   <soap12:Header>
> > > > > >                     <ErrorResponse ....>
> > > > > >                     </ErrorResponse>
> > > > > >                     <UserInfo ...>
> > > > > >                       <Id>string</Id>
> > > > > >                       <DOB>string</DOB>
> > > > > >                     </UserInfo>
> > > > > >                   </soap12:Header>
> > > > > >
> > > > > > I have a UserInfo class which I would like to have populated
> > with the
> > > > > > information from the XML....is there a way for this to happen
> > > automatically
> > > > > > or do I have to write my own XML Parser to parse the header XML?
> > > > > >
> > > > > >  Thanks!
> > > > > >
> > > > >
> > > > >
> > > > > --
> > > > > Davanum Srinivas :: http://wso2.org/ :: Oxygen for Web Services
> > > Developers
> > > > >
> > > > >
> > > ---------------------------------------------------------------------
> > > > > To unsubscribe, e-mail:
> > > axis-user-unsubscribe@ws.apache.org
> > > > > For additional commands, e-mail: axis-user-help@ws.apache.org
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >
> > --
> > Davanum Srinivas :: http://wso2.org/ :: Oxygen for Web Services
> > Developers
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> > For additional commands, e-mail: axis-user-help@ws.apache.org
> >
> >
>

Re: Apache Axis 2: how to get header? Options

Posted by craig wickesser <co...@gmail.com>.
which class should have parse method?

On 4/23/07, Davanum Srinivas <da...@gmail.com> wrote:
>
> look for parse method in those classes. The parse method takes in a
> XMLStreamReader. If you see it it means you are using ADB based code.
> Next step is to use the AXIOM API to get the OMElement corresponding
> to your UserInfo element in the soap header. basically call
> getChildren on the header and iterate till you find UserInfo. When you
> get that OMElement, call getXMLStreamReader() and pass that to the
> parse method of your class
>
> -- dims
>
> On 4/23/07, craig wickesser <co...@gmail.com> wrote:
> > there is UserInfoImpl and UserInfoDocumentImpl.
> >
> >
> >
> > On 4/23/07, craig wickesser <co...@gmail.com> wrote:
> > > yes
> > >
> > >
> > >
> > > On 4/23/07, Davanum Srinivas <davanum@gmail.com > wrote:
> > > > Was this UserInfo class generated by WSDL2Java/ADB?
> > > >
> > > > -- dims
> > > >
> > > > On 4/23/07, craig wickesser < codecraig@gmail.com> wrote:
> > > > > Ok, I put code into my Stub class so I could get the
> > _returnMessageContext.
> > > > > Now that I have access to the
> > > > > org.apache.axiom.soap.SOAPHeader it gives me the XML,
> > is
> > > > > there a way to get the actual JavaBean objects based on the
> header(s)?
> >  For
> > > > > example if my header looks like...
> > > > >
> > > > >                   <soap12:Header>
> > > > >                     <ErrorResponse ....>
> > > > >                     </ErrorResponse>
> > > > >                     <UserInfo ...>
> > > > >                       <Id>string</Id>
> > > > >                       <DOB>string</DOB>
> > > > >                     </UserInfo>
> > > > >                   </soap12:Header>
> > > > >
> > > > > I have a UserInfo class which I would like to have populated with
> the
> > > > > information from the XML....is there a way for this to happen
> > automatically
> > > > > or do I have to write my own XML Parser to parse the header XML?
> > > > >
> > > > >  Thanks!
> > > > >
> > > >
> > > >
> > > > --
> > > > Davanum Srinivas :: http://wso2.org/ :: Oxygen for Web Services
> > Developers
> > > >
> > > >
> > ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail:
> > axis-user-unsubscribe@ws.apache.org
> > > > For additional commands, e-mail: axis-user-help@ws.apache.org
> > > >
> > > >
> > >
> > >
> >
> >
>
>
> --
> Davanum Srinivas :: http://wso2.org/ :: Oxygen for Web Services Developers
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>
>

Re: Apache Axis 2: how to get header? Options

Posted by Davanum Srinivas <da...@gmail.com>.
look for parse method in those classes. The parse method takes in a
XMLStreamReader. If you see it it means you are using ADB based code.
Next step is to use the AXIOM API to get the OMElement corresponding
to your UserInfo element in the soap header. basically call
getChildren on the header and iterate till you find UserInfo. When you
get that OMElement, call getXMLStreamReader() and pass that to the
parse method of your class

-- dims

On 4/23/07, craig wickesser <co...@gmail.com> wrote:
> there is UserInfoImpl and UserInfoDocumentImpl.
>
>
>
> On 4/23/07, craig wickesser <co...@gmail.com> wrote:
> > yes
> >
> >
> >
> > On 4/23/07, Davanum Srinivas <davanum@gmail.com > wrote:
> > > Was this UserInfo class generated by WSDL2Java/ADB?
> > >
> > > -- dims
> > >
> > > On 4/23/07, craig wickesser < codecraig@gmail.com> wrote:
> > > > Ok, I put code into my Stub class so I could get the
> _returnMessageContext.
> > > > Now that I have access to the
> > > > org.apache.axiom.soap.SOAPHeader it gives me the XML,
> is
> > > > there a way to get the actual JavaBean objects based on the header(s)?
>  For
> > > > example if my header looks like...
> > > >
> > > >                   <soap12:Header>
> > > >                     <ErrorResponse ....>
> > > >                     </ErrorResponse>
> > > >                     <UserInfo ...>
> > > >                       <Id>string</Id>
> > > >                       <DOB>string</DOB>
> > > >                     </UserInfo>
> > > >                   </soap12:Header>
> > > >
> > > > I have a UserInfo class which I would like to have populated with the
> > > > information from the XML....is there a way for this to happen
> automatically
> > > > or do I have to write my own XML Parser to parse the header XML?
> > > >
> > > >  Thanks!
> > > >
> > >
> > >
> > > --
> > > Davanum Srinivas :: http://wso2.org/ :: Oxygen for Web Services
> Developers
> > >
> > >
> ---------------------------------------------------------------------
> > > To unsubscribe, e-mail:
> axis-user-unsubscribe@ws.apache.org
> > > For additional commands, e-mail: axis-user-help@ws.apache.org
> > >
> > >
> >
> >
>
>


-- 
Davanum Srinivas :: http://wso2.org/ :: Oxygen for Web Services Developers

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


Re: Apache Axis 2: how to get header? Options

Posted by craig wickesser <co...@gmail.com>.
there is UserInfoImpl and UserInfoDocumentImpl.

On 4/23/07, craig wickesser <co...@gmail.com> wrote:
>
> yes
>
> On 4/23/07, Davanum Srinivas <da...@gmail.com> wrote:
> >
> > Was this UserInfo class generated by WSDL2Java/ADB?
> >
> > -- dims
> >
> > On 4/23/07, craig wickesser < codecraig@gmail.com> wrote:
> > > Ok, I put code into my Stub class so I could get the
> > _returnMessageContext.
> > > Now that I have access to the
> > > org.apache.axiom.soap.SOAPHeader it gives me the XML, is
> > > there a way to get the actual JavaBean objects based on the
> > header(s)?  For
> > > example if my header looks like...
> > >
> > >                   <soap12:Header>
> > >                     <ErrorResponse ....>
> > >                     </ErrorResponse>
> > >                     <UserInfo ...>
> > >                       <Id>string</Id>
> > >                       <DOB>string</DOB>
> > >                     </UserInfo>
> > >                   </soap12:Header>
> > >
> > > I have a UserInfo class which I would like to have populated with the
> > > information from the XML....is there a way for this to happen
> > automatically
> > > or do I have to write my own XML Parser to parse the header XML?
> > >
> > >  Thanks!
> > >
> >
> >
> > --
> > Davanum Srinivas :: http://wso2.org/ :: Oxygen for Web Services
> > Developers
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> > For additional commands, e-mail: axis-user-help@ws.apache.org
> >
> >
>

Re: Apache Axis 2: how to get header? Options

Posted by craig wickesser <co...@gmail.com>.
yes

On 4/23/07, Davanum Srinivas <da...@gmail.com> wrote:
>
> Was this UserInfo class generated by WSDL2Java/ADB?
>
> -- dims
>
> On 4/23/07, craig wickesser <co...@gmail.com> wrote:
> > Ok, I put code into my Stub class so I could get the
> _returnMessageContext.
> > Now that I have access to the
> > org.apache.axiom.soap.SOAPHeader it gives me the XML, is
> > there a way to get the actual JavaBean objects based on the
> header(s)?  For
> > example if my header looks like...
> >
> >                   <soap12:Header>
> >                     <ErrorResponse ....>
> >                     </ErrorResponse>
> >                     <UserInfo ...>
> >                       <Id>string</Id>
> >                       <DOB>string</DOB>
> >                     </UserInfo>
> >                   </soap12:Header>
> >
> > I have a UserInfo class which I would like to have populated with the
> > information from the XML....is there a way for this to happen
> automatically
> > or do I have to write my own XML Parser to parse the header XML?
> >
> >  Thanks!
> >
>
>
> --
> Davanum Srinivas :: http://wso2.org/ :: Oxygen for Web Services Developers
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>
>

Re: Apache Axis 2: how to get header? Options

Posted by Davanum Srinivas <da...@gmail.com>.
Was this UserInfo class generated by WSDL2Java/ADB?

-- dims

On 4/23/07, craig wickesser <co...@gmail.com> wrote:
> Ok, I put code into my Stub class so I could get the _returnMessageContext.
> Now that I have access to the
> org.apache.axiom.soap.SOAPHeader it gives me the XML, is
> there a way to get the actual JavaBean objects based on the header(s)?  For
> example if my header looks like...
>
>                   <soap12:Header>
>                     <ErrorResponse ....>
>                     </ErrorResponse>
>                     <UserInfo ...>
>                       <Id>string</Id>
>                       <DOB>string</DOB>
>                     </UserInfo>
>                   </soap12:Header>
>
> I have a UserInfo class which I would like to have populated with the
> information from the XML....is there a way for this to happen automatically
> or do I have to write my own XML Parser to parse the header XML?
>
>  Thanks!
>


-- 
Davanum Srinivas :: http://wso2.org/ :: Oxygen for Web Services Developers

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


Re: Apache Axis 2: how to get header? Options

Posted by craig wickesser <co...@gmail.com>.
Ok, I put code into my Stub class so I could get the _returnMessageContext.
Now that I have access to the org.apache.axiom.soap.SOAPHeader it gives me
the XML, is there a way to get the actual JavaBean objects based on the
header(s)?  For example if my header looks like...

                  <soap12:Header>
                    <ErrorResponse ....>
                    </ErrorResponse>
                    <UserInfo ...>
                      <Id>string</Id>
                      <DOB>string</DOB>
                    </UserInfo>
                  </soap12:Header>

I have a UserInfo class which I would like to have populated with the
information from the XML....is there a way for this to happen automatically
or do I have to write my own XML Parser to parse the header XML?

Thanks!

Re: Apache Axis 2: how to get header? Options

Posted by José Antonio Sánchez <ge...@gmail.com>.
It's on the 1.2 code. Also, that operation always returns null for me
when I was testing the Axis2 1.2RC2.

On 4/23/07, Shaoguang Cong <sc...@yahoo.com> wrote:
> Hi Thilina ,
>
> I cannot find the method getLastOperationContext() in ServiceClient in
> Axis2.1.1.1.  Should it be already in the released version since I was told
> it is in nightly build back in December last year?
>
> Craig,
>
> Sorry for the confusion - I wasn't with the code in hand when I wrote the
> reply.  The line of code should be the one as given by Thilina
> (getEnvelope(), not getSoapEnvelope()). It's called from a messageContext
> instance, not the class.
>
> It's simple but it seems you cannot get to it because the
> MessageContext/OperationClient involved in the client call wasn't exposed by
> the generated Stub. I actually saw the response message by debugging into
> the generated Stub, from the line immediately after execute the call
> _returnMessageContext =
> _operationClient.getMessageContext(org.apache.axis2.wsdl.WSDLConstants.MESSAGE_LABEL_IN_VALUE);
>
> Shaoguang
>
> Thilina Gunarathne <cs...@gmail.com> wrote:
> Refer to the earlier mail from Kamal Kang...
>
> OperationContext oprCtxt =
> stub._getServiceClient().getLastOperationContext();
> MessageContext inMsgContext =
> oprCtxt.getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
> SOAPHeader header = inMsgContext.getEnvelope().getHeader();
>
> Do the above after your service invocation...
> This works in the client side...
>
> ~Thilina
>
> On 4/23/07, José Antonio Sánchez wrote:
> > You get this with:
> >
> > MessageContext.getCurrentMessageContext().getEnvelope()
> >
> > But remember, you cannot make this in your client code. You have to
> > make it in the Stub code and then give the headers to your client code
> > by other means (for example, returning a custom class instead of the
> > generated class).
> >
> > On 4/23/07, craig wickesser wrote:
> > > Shaoguang,
> > > MessageContext does not have a "getSoapEnvelope" method, in fact the
> > > only getter method it has is getCurrentMessageContext (at least for
> Axis2).
> > > Any other ideas? I think I might switch to XFire to do what I need. I
> > > posted over there and it sounds like in the next day or so there will be
> > > support for getting the headers that I need.
> > >
> > > Thanks
> > > Craig
> > >
> > >
> > > On 4/22/07, Thilina Gunarathne wrote:
> > > > > Do we have a default envelope set in out message context in Axis2?
> > > > > In Step #1 what he does is set an envelope in out message context
> (with
> > > the
> > > > > out headers) first and then retrieve it.
> > > > > outMessageContext.setEnvelope (createSOAPEnvelope());
> > > > see https://issues.apache.org/jira/browse/AXIS2-2531
> > > >
> > > > Thanka,
> > > > Thilina
> > > > >
> > > > > So the Step# 2 suggestion is a performace improvement only if Axis2
> set
> > > a
> > > > > default out Envelope. I am not sure whether Axis2 does this or not.
> if
> > > so I
> > > > > think we have to stop that since there is no reason to do that.
> > > > >
> > > > > Amila.
> > > > >
> > > > > > thanks,
> > > > > > dims
> > > > > >
> > > > > > On 4/19/07, Kang, Kamaljeet K. < Kamal.K.Kang@tellabs.com> wrote:
> > > > > > > These are the changes I did to get Response SOAP header.
> > > > > > >
> > > > > > > 1) Save header in the message context in the skeleton
> > > implementation.
> > > > > > > MessageContext inMsgContext =
> > > > > MessageContext.getCurrentMessageContext();
> > > > > > > OperationContext operationContext =
> > > > > inMsgContext.getOperationContext();
> > > > > > > MessageContext outMessageContext = operationContext
> > > > > .getMessageContext(
> > > WSDLConstants.MESSAGE_LABEL_OUT_VALUE);
> > > > > > > outMessageContext.setEnvelope (createSOAPEnvelope());
> > > > > > > OMNode outHeaderNode = toOM(outHeader);
> > > > > > >
> > > > > > >
> > > > >
> > >
> outMessageContext.getEnvelope().getHeader().addChild(outHeaderNode);
> > > > > > >
> > > > > > > 2) Modified autogenerated *InOutReceiver classes to not create
> new
> > > > > Envelope if Envelope is already there in the context (modified
> whereever
> > > > > factory.getDefaultEnvelope() is called)
> > > > > > >
> > > > > > > 3) Modified Stub to save the return message context
> > > > > > >
> > > org.apache.axis2.context.MessageContext
> > > > > _returnMessageContext =
> > > _operationClient.getMessageContext(
> > > > > > >
> > > > >
> > >
> org.apache.axis2.wsdl.WSDLConstants.MESSAGE_LABEL_IN_VALUE
> > > > > );
> > > > > > > org.apache.axiom.soap.SOAPEnvelope
> > > > > _returnEnv = _returnMessageContext.getEnvelope();
> > > > > > >
> > > > > > > // Added this line
> > > > > > >
> > > > >
> > >
> _serviceClient.getServiceContext().setLastOperationContext(_operationClient.getOperationContext());
> > > > > > >
> > > > > > >
> > > > > > > 4) Finally you can get the Response Header from stub
> > > > > > >
> > > > > > > OperationContext oprCtxt =
> > > > > stub._getServiceClient().getLastOperationContext();
> > > > > > > MessageContext inMsgContext =
> > > > > oprCtxt.getMessageContext
> > > (WSDLConstants.MESSAGE_LABEL_IN_VALUE);
> > > > > > > SOAPHeader header = inMsgContext.getEnvelope().getHeader();
> > > > > > >
> > > > > > > return
> > > > > Header_T.Factory.parse(header.getFirstElement
> > > ().getXMLStreamReaderWithoutCaching());
> > > > > > >
> > > > > > > Not sure if there is any easier way but finally this worked for
> me.
> > > > > > >
> > > > > > > Let me know if you need more help with this.
> > > > > > >
> > > > > > >
> > > > > > > Kamal Kang
> > > > > > >
> > > > > > >
> > > > > > > -----Original Message-----
> > > > > > > From: José Antonio Sánchez [mailto: getaceres@gmail.com]
> > > > > > > Sent: Thursday, April 19, 2007 3:56 PM
> > > > > > > To: axis-user@ws.apache.org
> > > > > > > Subject: Re: Apache Axis 2: how to get header? Options
> > > > > > >
> > > > > > > AFAIK you have to modify the stub code and get headers from
> there.
> > > In
> > > > > > > Axis2 1.2 there is an operation in the generated stub to get the
> > > last
> > > > > > > operation context (and so the envelope object) but it didn't
> work
> > > for
> > > > > > > me.
> > > > > > >
> > > > > > > On 4/19/07, craig wickesser wrote:
> > > > > > > > anyone???
> > > > > > > >
> > > > > > > >
> > > > > > > > On 4/18/07, craig wickesser wrote:
> > > > > > > > > Hi...I have a client which I am using to access a web
> service
> > > The
> > > > > > > > > code I have is...
> > > > > > > > >
> > > > > > > > >
> > > > > > > > > MyStub stub = new MyStub();
> > > > > > > > > HelloWorldDocument reqDoc =
> > > > > > > > HellWorldDocument.Factory.newInstance ();
> > > > > > > > > reqDoc.setName("bob");
> > > > > > > > >
> > > > > > > > >
> > > > > > > > > HelloWorldResponseDocumnet resp =
> > > > > stub.SayHello(reqDoc);
> > > > > > > > >
> > > > > > > > >
> > > > > > > > > The SOAP XML response is in the following form...
> > > > > > > > >
> > > > > > > > >
> > > > > > > > >
> > > > > > > > >
> > > > > > > > >
> > > > > > > > >
> > > > > > > > >
> > > > > > > > > string
> > > > > > > > > string
> > > > > > > > >
> > > > > > > > >
> > > > > > > > >
> > > > > > > > >
> > > > > > > > > .....
>
> > > > > > > > >
> > > > > > > > >
> > > > > > > > >
> > > > > > > > >
> > > > > > > > >
> > > > > > > > > My issue is I need to get stuff from the UserInfo
> header....how
> > > can
> > > > > I
> > > > > > > > > get that? Currently all I can get is the HelloWorldResponse
> > > from
> > > > > the
> > > > > > > > > "body".
> > > > > > > > >
> > > > > > > > > Thanks!
> > > > > > > > >
> > > > > > > > >
> > > > > > > > >
> > > > > > > > >
> > > > > > > > >
> > > > > > > > >
> > > > > > > > >
> > > > > > > > >
> > > > > > > > >
> > > > > > > > >
> > > > > > > > >
> > > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > > >
> > > > > > > --
> > > > > > > Saludos.
> > > > > > > José Antonio Sánchez
> > > > > > >
> > > > > > >
> > > > >
> > >
> ---------------------------------------------------------------------
> > > > > > > To unsubscribe, e-mail:
> > > > > axis-user-unsubscribe@ws.apache.org
> > > > > > > For additional commands, e-mail: axis-user-help@ws.apache.org
> > > > > > >
> > > > >
> > >
> ============================================================
> > > > > > > The information contained in this message may be privileged
> > > > > > > and confidential and protected from disclosure. If the reader
> > > > > > > of this message is not the intended recipient, or an employee
> > > > > > > or agent responsible for delivering this message to the
> > > > > > > intended recipient, you are hereby notified that any
> reproduction,
> > > > > > > dissemination or distribution of this communication is strictly
> > > > > > > prohibited. If you have received this communication in error,
> > > > > > > please notify us immediately by replying to the message and
> > > > > > > deleting it from your computer. Thank you. Tellabs
> > > > > > >
> > > > >
> > >
> ============================================================
> > > > > > >
> > > > > > >
> > > > >
> > >
> ---------------------------------------------------------------------
> > > > > > > To unsubscribe, e-mail:
> > > > > axis-user-unsubscribe@ws.apache.org
> > > > > > > For additional commands, e-mail: axis-user-help@ws.apache.org
> > > > > > >
> > > > > > >
> > > > > >
> > > > > >
> > > > > > --
> > > > > > Davanum Srinivas :: http://wso2.org/ :: Oxygen for Web Services
> > > Developers
> > > > > >
> > > > > >
> > > > >
> > >
> ---------------------------------------------------------------------
> > > > > > To unsubscribe, e-mail:
> > > > > axis-user-unsubscribe@ws.apache.org
> > > > > > For additional commands, e-mail: axis-user-help@ws.apache.org
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > > >
> > > > > --
> > > > > Amila Suriarachchi,
> > > > > WSO2 Inc.
> > > >
> > > >
> > > > --
> > > > Thilina Gunarathne - http://www.wso2.com -
> http://thilinag.blogspot.com
> > > >
> > > >
> > >
> ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail:
> > > axis-user-unsubscribe@ws.apache.org
> > > > For additional commands, e-mail: axis-user-help@ws.apache.org
> > > >
> > > >
> > >
> > >
> >
> >
> > --
> > Saludos.
> > José Antonio Sánchez
> >
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> axis-user-unsubscribe@ws.apache.org
> > For additional commands, e-mail: axis-user-help@ws.apache.org
> >
> >
>
>
> --
> Thilina Gunarathne - http://www.wso2.com - http://thilinag.blogspot.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>
>
>
>
>  ________________________________
> Ahhh...imagining that irresistible "new car" smell?
>  Check out new cars at Yahoo! Autos.
>
>


-- 
Saludos.
José Antonio Sánchez

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


Re: Apache Axis 2: how to get header? Options

Posted by Shaoguang Cong <sc...@yahoo.com>.
Hi Thilina ,
   
  I cannot find the method getLastOperationContext() in ServiceClient in Axis2.1.1.1.  Should it be already in the released version since I was told it is in nightly build back in December last year?  

  Craig, 
   
  Sorry for the confusion - I wasn't with the code in hand when I wrote the reply.  The line of code should be the one as given by Thilina (getEnvelope(), not getSoapEnvelope()). It's called from a messageContext instance, not the class.
   
  It's simple but it seems you cannot get to it because the MessageContext/OperationClient involved in the client call wasn't exposed by the generated Stub. I actually saw the response message by debugging into the generated Stub, from the line immediately after execute the call  _returnMessageContext = _operationClient.getMessageContext(org.apache.axis2.wsdl.WSDLConstants.MESSAGE_LABEL_IN_VALUE);
   
  Shaoguang

Thilina Gunarathne <cs...@gmail.com> wrote:
  Refer to the earlier mail from Kamal Kang...

OperationContext oprCtxt = stub._getServiceClient().getLastOperationContext();
MessageContext inMsgContext =
oprCtxt.getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
SOAPHeader header = inMsgContext.getEnvelope().getHeader();

Do the above after your service invocation...
This works in the client side...

~Thilina

On 4/23/07, José Antonio Sánchez wrote:
> You get this with:
>
> MessageContext.getCurrentMessageContext().getEnvelope()
>
> But remember, you cannot make this in your client code. You have to
> make it in the Stub code and then give the headers to your client code
> by other means (for example, returning a custom class instead of the
> generated class).
>
> On 4/23/07, craig wickesser wrote:
> > Shaoguang,
> > MessageContext does not have a "getSoapEnvelope" method, in fact the
> > only getter method it has is getCurrentMessageContext (at least for Axis2).
> > Any other ideas? I think I might switch to XFire to do what I need. I
> > posted over there and it sounds like in the next day or so there will be
> > support for getting the headers that I need.
> >
> > Thanks
> > Craig
> >
> >
> > On 4/22/07, Thilina Gunarathne wrote:
> > > > Do we have a default envelope set in out message context in Axis2?
> > > > In Step #1 what he does is set an envelope in out message context (with
> > the
> > > > out headers) first and then retrieve it.
> > > > outMessageContext.setEnvelope (createSOAPEnvelope());
> > > see https://issues.apache.org/jira/browse/AXIS2-2531
> > >
> > > Thanka,
> > > Thilina
> > > >
> > > > So the Step# 2 suggestion is a performace improvement only if Axis2 set
> > a
> > > > default out Envelope. I am not sure whether Axis2 does this or not. if
> > so I
> > > > think we have to stop that since there is no reason to do that.
> > > >
> > > > Amila.
> > > >
> > > > > thanks,
> > > > > dims
> > > > >
> > > > > On 4/19/07, Kang, Kamaljeet K. < Kamal.K.Kang@tellabs.com> wrote:
> > > > > > These are the changes I did to get Response SOAP header.
> > > > > >
> > > > > > 1) Save header in the message context in the skeleton
> > implementation.
> > > > > > MessageContext inMsgContext =
> > > > MessageContext.getCurrentMessageContext();
> > > > > > OperationContext operationContext =
> > > > inMsgContext.getOperationContext();
> > > > > > MessageContext outMessageContext = operationContext
> > > > .getMessageContext(
> > WSDLConstants.MESSAGE_LABEL_OUT_VALUE);
> > > > > > outMessageContext.setEnvelope (createSOAPEnvelope());
> > > > > > OMNode outHeaderNode = toOM(outHeader);
> > > > > >
> > > > > >
> > > >
> > outMessageContext.getEnvelope().getHeader().addChild(outHeaderNode);
> > > > > >
> > > > > > 2) Modified autogenerated *InOutReceiver classes to not create new
> > > > Envelope if Envelope is already there in the context (modified whereever
> > > > factory.getDefaultEnvelope() is called)
> > > > > >
> > > > > > 3) Modified Stub to save the return message context
> > > > > >
> > org.apache.axis2.context.MessageContext
> > > > _returnMessageContext =
> > _operationClient.getMessageContext(
> > > > > >
> > > >
> > org.apache.axis2.wsdl.WSDLConstants.MESSAGE_LABEL_IN_VALUE
> > > > );
> > > > > > org.apache.axiom.soap.SOAPEnvelope
> > > > _returnEnv = _returnMessageContext.getEnvelope();
> > > > > >
> > > > > > // Added this line
> > > > > >
> > > >
> > _serviceClient.getServiceContext().setLastOperationContext(_operationClient.getOperationContext());
> > > > > >
> > > > > >
> > > > > > 4) Finally you can get the Response Header from stub
> > > > > >
> > > > > > OperationContext oprCtxt =
> > > > stub._getServiceClient().getLastOperationContext();
> > > > > > MessageContext inMsgContext =
> > > > oprCtxt.getMessageContext
> > (WSDLConstants.MESSAGE_LABEL_IN_VALUE);
> > > > > > SOAPHeader header = inMsgContext.getEnvelope().getHeader();
> > > > > >
> > > > > > return
> > > > Header_T.Factory.parse(header.getFirstElement
> > ().getXMLStreamReaderWithoutCaching());
> > > > > >
> > > > > > Not sure if there is any easier way but finally this worked for me.
> > > > > >
> > > > > > Let me know if you need more help with this.
> > > > > >
> > > > > >
> > > > > > Kamal Kang
> > > > > >
> > > > > >
> > > > > > -----Original Message-----
> > > > > > From: José Antonio Sánchez [mailto: getaceres@gmail.com]
> > > > > > Sent: Thursday, April 19, 2007 3:56 PM
> > > > > > To: axis-user@ws.apache.org
> > > > > > Subject: Re: Apache Axis 2: how to get header? Options
> > > > > >
> > > > > > AFAIK you have to modify the stub code and get headers from there.
> > In
> > > > > > Axis2 1.2 there is an operation in the generated stub to get the
> > last
> > > > > > operation context (and so the envelope object) but it didn't work
> > for
> > > > > > me.
> > > > > >
> > > > > > On 4/19/07, craig wickesser wrote:
> > > > > > > anyone???
> > > > > > >
> > > > > > >
> > > > > > > On 4/18/07, craig wickesser wrote:
> > > > > > > > Hi...I have a client which I am using to access a web service
> > The
> > > > > > > > code I have is...
> > > > > > > >
> > > > > > > >
> > > > > > > > MyStub stub = new MyStub();
> > > > > > > > HelloWorldDocument reqDoc =
> > > > > > > HellWorldDocument.Factory.newInstance ();
> > > > > > > > reqDoc.setName("bob");
> > > > > > > >
> > > > > > > >
> > > > > > > > HelloWorldResponseDocumnet resp =
> > > > stub.SayHello(reqDoc);
> > > > > > > >
> > > > > > > >
> > > > > > > > The SOAP XML response is in the following form...
> > > > > > > >
> > > > > > > >
> > > > > > > > 
> > > > > > > > 
> > > > > > > > 
> > > > > > > > 
> > > > > > > > 
> > > > > > > > string
> > > > > > > > string
> > > > > > > > 
> > > > > > > > 
> > > > > > > > 
> > > > > > > > 
> > > > > > > > .....
> > > > > > > > 
> > > > > > > > 
> > > > > > > > 
> > > > > > > >
> > > > > > > >
> > > > > > > > My issue is I need to get stuff from the UserInfo header....how
> > can
> > > > I
> > > > > > > > get that? Currently all I can get is the HelloWorldResponse
> > from
> > > > the
> > > > > > > > "body".
> > > > > > > >
> > > > > > > > Thanks!
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > > >
> > > > > >
> > > > > >
> > > > > > --
> > > > > > Saludos.
> > > > > > José Antonio Sánchez
> > > > > >
> > > > > >
> > > >
> > ---------------------------------------------------------------------
> > > > > > To unsubscribe, e-mail:
> > > > axis-user-unsubscribe@ws.apache.org
> > > > > > For additional commands, e-mail: axis-user-help@ws.apache.org
> > > > > >
> > > >
> > ============================================================
> > > > > > The information contained in this message may be privileged
> > > > > > and confidential and protected from disclosure. If the reader
> > > > > > of this message is not the intended recipient, or an employee
> > > > > > or agent responsible for delivering this message to the
> > > > > > intended recipient, you are hereby notified that any reproduction,
> > > > > > dissemination or distribution of this communication is strictly
> > > > > > prohibited. If you have received this communication in error,
> > > > > > please notify us immediately by replying to the message and
> > > > > > deleting it from your computer. Thank you. Tellabs
> > > > > >
> > > >
> > ============================================================
> > > > > >
> > > > > >
> > > >
> > ---------------------------------------------------------------------
> > > > > > To unsubscribe, e-mail:
> > > > axis-user-unsubscribe@ws.apache.org
> > > > > > For additional commands, e-mail: axis-user-help@ws.apache.org
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > > > --
> > > > > Davanum Srinivas :: http://wso2.org/ :: Oxygen for Web Services
> > Developers
> > > > >
> > > > >
> > > >
> > ---------------------------------------------------------------------
> > > > > To unsubscribe, e-mail:
> > > > axis-user-unsubscribe@ws.apache.org
> > > > > For additional commands, e-mail: axis-user-help@ws.apache.org
> > > > >
> > > > >
> > > >
> > > >
> > > >
> > > > --
> > > > Amila Suriarachchi,
> > > > WSO2 Inc.
> > >
> > >
> > > --
> > > Thilina Gunarathne - http://www.wso2.com - http://thilinag.blogspot.com
> > >
> > >
> > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail:
> > axis-user-unsubscribe@ws.apache.org
> > > For additional commands, e-mail: axis-user-help@ws.apache.org
> > >
> > >
> >
> >
>
>
> --
> Saludos.
> José Antonio Sánchez
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>
>


-- 
Thilina Gunarathne - http://www.wso2.com - http://thilinag.blogspot.com

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org



       
---------------------------------
Ahhh...imagining that irresistible "new car" smell?
 Check outnew cars at Yahoo! Autos.

Re: Apache Axis 2: how to get header? Options

Posted by craig wickesser <co...@gmail.com>.
I will try that out later,  thanks for all the help!

On 4/23/07, Thilina Gunarathne <cs...@gmail.com> wrote:
>
> Refer to the earlier mail from Kamal Kang...
>
> OperationContext oprCtxt =
> stub._getServiceClient().getLastOperationContext();
> MessageContext inMsgContext =
> oprCtxt.getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
> SOAPHeader header = inMsgContext.getEnvelope().getHeader();
>
> Do the above after your service invocation...
> This works in the client side...
>
> ~Thilina
>
> On 4/23/07, José Antonio Sánchez <ge...@gmail.com> wrote:
> > You get this with:
> >
> > MessageContext.getCurrentMessageContext().getEnvelope()
> >
> > But remember, you cannot make this in your client code. You have to
> > make it in the Stub code and then give the headers to your client code
> > by other means (for example, returning a custom class instead of the
> > generated class).
> >
> > On 4/23/07, craig wickesser <co...@gmail.com> wrote:
> > > Shaoguang,
> > >     MessageContext does not have a "getSoapEnvelope" method, in fact
> the
> > > only getter method it has is getCurrentMessageContext (at least for
> Axis2).
> > > Any other ideas?  I think I might switch to XFire to do what I
> need.  I
> > > posted over there and it sounds like in the next day or so there will
> be
> > > support for getting the headers that I need.
> > >
> > > Thanks
> > > Craig
> > >
> > >
> > > On 4/22/07, Thilina Gunarathne <cs...@gmail.com> wrote:
> > > > > Do we have a default  envelope  set in out message context in
> Axis2?
> > > > > In Step #1 what he does is set an envelope in out message context
> (with
> > > the
> > > > > out headers) first and then retrieve it.
> > > > > outMessageContext.setEnvelope (createSOAPEnvelope());
> > > > see https://issues.apache.org/jira/browse/AXIS2-2531
> > > >
> > > > Thanka,
> > > > Thilina
> > > > >
> > > > > So the Step# 2 suggestion is a performace improvement only if
> Axis2 set
> > > a
> > > > > default out Envelope. I am not sure whether Axis2 does this or
> not. if
> > > so I
> > > > > think we have to stop that since there is no reason to do that.
> > > > >
> > > > > Amila.
> > > > >
> > > > > > thanks,
> > > > > > dims
> > > > > >
> > > > > > On 4/19/07, Kang, Kamaljeet K. < Kamal.K.Kang@tellabs.com>
> wrote:
> > > > > > > These are the changes I did to get Response SOAP header.
> > > > > > >
> > > > > > > 1) Save header in the message context in the skeleton
> > > implementation.
> > > > > > >        MessageContext inMsgContext =
> > > > > MessageContext.getCurrentMessageContext();
> > > > > > >         OperationContext operationContext =
> > > > > inMsgContext.getOperationContext();
> > > > > > >         MessageContext outMessageContext = operationContext
> > > > > .getMessageContext(
> > > WSDLConstants.MESSAGE_LABEL_OUT_VALUE);
> > > > > > >         outMessageContext.setEnvelope (createSOAPEnvelope());
> > > > > > >         OMNode outHeaderNode = toOM(outHeader);
> > > > > > >
> > > > > > >
> > > > >
> > > outMessageContext.getEnvelope().getHeader().addChild(outHeaderNode);
> > > > > > >
> > > > > > > 2)  Modified autogenerated *InOutReceiver classes to not
> create new
> > > > > Envelope if Envelope is already there in the context (modified
> whereever
> > > > > factory.getDefaultEnvelope() is called)
> > > > > > >
> > > > > > > 3) Modified Stub to save the return message context
> > > > > > >
> > > org.apache.axis2.context.MessageContext
> > > > > _returnMessageContext =
> > > _operationClient.getMessageContext(
> > > > > > >
> > > > >
> > > org.apache.axis2.wsdl.WSDLConstants.MESSAGE_LABEL_IN_VALUE
> > > > > );
> > > > > > >                 org.apache.axiom.soap.SOAPEnvelope
> > > > > _returnEnv = _returnMessageContext.getEnvelope();
> > > > > > >
> > > > > > > // Added this line
> > > > > > >
> > > > >
> > >
> _serviceClient.getServiceContext().setLastOperationContext(_operationClient.getOperationContext());
> > > > > > >
> > > > > > >
> > > > > > > 4) Finally you can get the Response Header from stub
> > > > > > >
> > > > > > >         OperationContext oprCtxt =
> > > > > stub._getServiceClient().getLastOperationContext();
> > > > > > >         MessageContext inMsgContext =
> > > > > oprCtxt.getMessageContext
> > > (WSDLConstants.MESSAGE_LABEL_IN_VALUE);
> > > > > > >         SOAPHeader header = inMsgContext.getEnvelope
> ().getHeader();
> > > > > > >
> > > > > > >         return
> > > > > Header_T.Factory.parse(header.getFirstElement
> > > ().getXMLStreamReaderWithoutCaching());
> > > > > > >
> > > > > > > Not sure if there is any easier way but finally this worked
> for me.
> > > > > > >
> > > > > > > Let me know if you need more help with this.
> > > > > > >
> > > > > > >
> > > > > > > Kamal Kang
> > > > > > >
> > > > > > >
> > > > > > > -----Original Message-----
> > > > > > > From: José Antonio Sánchez [mailto: getaceres@gmail.com]
> > > > > > > Sent: Thursday, April 19, 2007 3:56 PM
> > > > > > > To: axis-user@ws.apache.org
> > > > > > > Subject: Re: Apache Axis 2: how to get header? Options
> > > > > > >
> > > > > > > AFAIK you have to modify the stub code and get headers from
> there.
> > > In
> > > > > > > Axis2 1.2 there is an operation in the generated stub to get
> the
> > > last
> > > > > > > operation context (and so the envelope object) but it didn't
> work
> > > for
> > > > > > > me.
> > > > > > >
> > > > > > > On 4/19/07, craig wickesser <co...@gmail.com> wrote:
> > > > > > > > anyone???
> > > > > > > >
> > > > > > > >
> > > > > > > > On 4/18/07, craig wickesser <co...@gmail.com> wrote:
> > > > > > > > > Hi...I have a client which I am using to access a web
> service
> > > The
> > > > > > > > > code I have is...
> > > > > > > > >
> > > > > > > > >
> > > > > > > > >                 MyStub stub = new MyStub();
> > > > > > > > >                 HelloWorldDocument reqDoc =
> > > > > > > > HellWorldDocument.Factory.newInstance ();
> > > > > > > > >                 reqDoc.setName("bob");
> > > > > > > > >
> > > > > > > > >
> > > > > > > > >                 HelloWorldResponseDocumnet resp =
> > > > > stub.SayHello(reqDoc);
> > > > > > > > >
> > > > > > > > >
> > > > > > > > > The SOAP XML response is in the following form...
> > > > > > > > >
> > > > > > > > >
> > > > > > > > >                 <soap12:Envelope ....>
> > > > > > > > >                   <soap12:Header>
> > > > > > > > >                     <ErrorResponse ....>
> > > > > > > > >                     </ErrorResponse>
> > > > > > > > >                     <UserInfo ...>
> > > > > > > > >                       <Id>string</Id>
> > > > > > > > >                       <DOB>string</DOB>
> > > > > > > > >                     </UserInfo>
> > > > > > > > >                   </soap12:Header>
> > > > > > > > >                   <soap12:Body>
> > > > > > > > >                     <HelloWorldResponse ....>
> > > > > > > > >                       .....
> > > > > > > > >                     </HelloWorldResponse>
> > > > > > > > >                   </soap12:Body>
> > > > > > > > >                 </soap12:Envelope>
> > > > > > > > >
> > > > > > > > >
> > > > > > > > > My issue is I need to get stuff from the UserInfo
> header....how
> > > can
> > > > > I
> > > > > > > > > get that?  Currently all I can get is the
> HelloWorldResponse
> > > from
> > > > > the
> > > > > > > > > "body".
> > > > > > > > >
> > > > > > > > > Thanks!
> > > > > > > > >
> > > > > > > > >
> > > > > > > > >
> > > > > > > > >
> > > > > > > > >
> > > > > > > > >
> > > > > > > > >
> > > > > > > > >
> > > > > > > > >
> > > > > > > > >
> > > > > > > > >
> > > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > > >
> > > > > > > --
> > > > > > > Saludos.
> > > > > > > José Antonio Sánchez
> > > > > > >
> > > > > > >
> > > > >
> > > ---------------------------------------------------------------------
> > > > > > > To unsubscribe, e-mail:
> > > > > axis-user-unsubscribe@ws.apache.org
> > > > > > > For additional commands, e-mail: axis-user-help@ws.apache.org
> > > > > > >
> > > > >
> > > ============================================================
> > > > > > > The information contained in this message may be privileged
> > > > > > > and confidential and protected from disclosure. If the reader
> > > > > > > of this message is not the intended recipient, or an employee
> > > > > > > or agent responsible for delivering this message to the
> > > > > > > intended recipient, you are hereby notified that any
> reproduction,
> > > > > > > dissemination or distribution of this communication is
> strictly
> > > > > > > prohibited. If you have received this communication in error,
> > > > > > > please notify us immediately by replying to the message and
> > > > > > > deleting it from your computer. Thank you. Tellabs
> > > > > > >
> > > > >
> > > ============================================================
> > > > > > >
> > > > > > >
> > > > >
> > > ---------------------------------------------------------------------
> > > > > > > To unsubscribe, e-mail:
> > > > > axis-user-unsubscribe@ws.apache.org
> > > > > > > For additional commands, e-mail: axis-user-help@ws.apache.org
> > > > > > >
> > > > > > >
> > > > > >
> > > > > >
> > > > > > --
> > > > > > Davanum Srinivas :: http://wso2.org/ :: Oxygen for Web Services
> > > Developers
> > > > > >
> > > > > >
> > > > >
> > > ---------------------------------------------------------------------
> > > > > > To unsubscribe, e-mail:
> > > > > axis-user-unsubscribe@ws.apache.org
> > > > > > For additional commands, e-mail: axis-user-help@ws.apache.org
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > > >
> > > > > --
> > > > > Amila Suriarachchi,
> > > > > WSO2 Inc.
> > > >
> > > >
> > > > --
> > > > Thilina Gunarathne  -  http://www.wso2.com -
> http://thilinag.blogspot.com
> > > >
> > > >
> > > ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail:
> > > axis-user-unsubscribe@ws.apache.org
> > > > For additional commands, e-mail: axis-user-help@ws.apache.org
> > > >
> > > >
> > >
> > >
> >
> >
> > --
> > Saludos.
> > José Antonio Sánchez
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> > For additional commands, e-mail: axis-user-help@ws.apache.org
> >
> >
>
>
> --
> Thilina Gunarathne  -  http://www.wso2.com - http://thilinag.blogspot.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>
>

Re: Apache Axis 2: how to get header? Options

Posted by Thilina Gunarathne <cs...@gmail.com>.
Refer to the earlier mail from Kamal Kang...

OperationContext oprCtxt = stub._getServiceClient().getLastOperationContext();
MessageContext inMsgContext =
oprCtxt.getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
SOAPHeader header = inMsgContext.getEnvelope().getHeader();

Do the above after your service invocation...
This works in the client side...

~Thilina

On 4/23/07, José Antonio Sánchez <ge...@gmail.com> wrote:
> You get this with:
>
> MessageContext.getCurrentMessageContext().getEnvelope()
>
> But remember, you cannot make this in your client code. You have to
> make it in the Stub code and then give the headers to your client code
> by other means (for example, returning a custom class instead of the
> generated class).
>
> On 4/23/07, craig wickesser <co...@gmail.com> wrote:
> > Shaoguang,
> >     MessageContext does not have a "getSoapEnvelope" method, in fact the
> > only getter method it has is getCurrentMessageContext (at least for Axis2).
> > Any other ideas?  I think I might switch to XFire to do what I need.  I
> > posted over there and it sounds like in the next day or so there will be
> > support for getting the headers that I need.
> >
> > Thanks
> > Craig
> >
> >
> > On 4/22/07, Thilina Gunarathne <cs...@gmail.com> wrote:
> > > > Do we have a default  envelope  set in out message context in Axis2?
> > > > In Step #1 what he does is set an envelope in out message context (with
> > the
> > > > out headers) first and then retrieve it.
> > > > outMessageContext.setEnvelope (createSOAPEnvelope());
> > > see https://issues.apache.org/jira/browse/AXIS2-2531
> > >
> > > Thanka,
> > > Thilina
> > > >
> > > > So the Step# 2 suggestion is a performace improvement only if Axis2 set
> > a
> > > > default out Envelope. I am not sure whether Axis2 does this or not. if
> > so I
> > > > think we have to stop that since there is no reason to do that.
> > > >
> > > > Amila.
> > > >
> > > > > thanks,
> > > > > dims
> > > > >
> > > > > On 4/19/07, Kang, Kamaljeet K. < Kamal.K.Kang@tellabs.com> wrote:
> > > > > > These are the changes I did to get Response SOAP header.
> > > > > >
> > > > > > 1) Save header in the message context in the skeleton
> > implementation.
> > > > > >        MessageContext inMsgContext =
> > > > MessageContext.getCurrentMessageContext();
> > > > > >         OperationContext operationContext =
> > > > inMsgContext.getOperationContext();
> > > > > >         MessageContext outMessageContext = operationContext
> > > > .getMessageContext(
> > WSDLConstants.MESSAGE_LABEL_OUT_VALUE);
> > > > > >         outMessageContext.setEnvelope (createSOAPEnvelope());
> > > > > >         OMNode outHeaderNode = toOM(outHeader);
> > > > > >
> > > > > >
> > > >
> > outMessageContext.getEnvelope().getHeader().addChild(outHeaderNode);
> > > > > >
> > > > > > 2)  Modified autogenerated *InOutReceiver classes to not create new
> > > > Envelope if Envelope is already there in the context (modified whereever
> > > > factory.getDefaultEnvelope() is called)
> > > > > >
> > > > > > 3) Modified Stub to save the return message context
> > > > > >
> > org.apache.axis2.context.MessageContext
> > > > _returnMessageContext =
> > _operationClient.getMessageContext(
> > > > > >
> > > >
> > org.apache.axis2.wsdl.WSDLConstants.MESSAGE_LABEL_IN_VALUE
> > > > );
> > > > > >                 org.apache.axiom.soap.SOAPEnvelope
> > > > _returnEnv = _returnMessageContext.getEnvelope();
> > > > > >
> > > > > > // Added this line
> > > > > >
> > > >
> > _serviceClient.getServiceContext().setLastOperationContext(_operationClient.getOperationContext());
> > > > > >
> > > > > >
> > > > > > 4) Finally you can get the Response Header from stub
> > > > > >
> > > > > >         OperationContext oprCtxt =
> > > > stub._getServiceClient().getLastOperationContext();
> > > > > >         MessageContext inMsgContext =
> > > > oprCtxt.getMessageContext
> > (WSDLConstants.MESSAGE_LABEL_IN_VALUE);
> > > > > >         SOAPHeader header = inMsgContext.getEnvelope().getHeader();
> > > > > >
> > > > > >         return
> > > > Header_T.Factory.parse(header.getFirstElement
> > ().getXMLStreamReaderWithoutCaching());
> > > > > >
> > > > > > Not sure if there is any easier way but finally this worked for me.
> > > > > >
> > > > > > Let me know if you need more help with this.
> > > > > >
> > > > > >
> > > > > > Kamal Kang
> > > > > >
> > > > > >
> > > > > > -----Original Message-----
> > > > > > From: José Antonio Sánchez [mailto: getaceres@gmail.com]
> > > > > > Sent: Thursday, April 19, 2007 3:56 PM
> > > > > > To: axis-user@ws.apache.org
> > > > > > Subject: Re: Apache Axis 2: how to get header? Options
> > > > > >
> > > > > > AFAIK you have to modify the stub code and get headers from there.
> > In
> > > > > > Axis2 1.2 there is an operation in the generated stub to get the
> > last
> > > > > > operation context (and so the envelope object) but it didn't work
> > for
> > > > > > me.
> > > > > >
> > > > > > On 4/19/07, craig wickesser <co...@gmail.com> wrote:
> > > > > > > anyone???
> > > > > > >
> > > > > > >
> > > > > > > On 4/18/07, craig wickesser <co...@gmail.com> wrote:
> > > > > > > > Hi...I have a client which I am using to access a web service
> > The
> > > > > > > > code I have is...
> > > > > > > >
> > > > > > > >
> > > > > > > >                 MyStub stub = new MyStub();
> > > > > > > >                 HelloWorldDocument reqDoc =
> > > > > > > HellWorldDocument.Factory.newInstance ();
> > > > > > > >                 reqDoc.setName("bob");
> > > > > > > >
> > > > > > > >
> > > > > > > >                 HelloWorldResponseDocumnet resp =
> > > > stub.SayHello(reqDoc);
> > > > > > > >
> > > > > > > >
> > > > > > > > The SOAP XML response is in the following form...
> > > > > > > >
> > > > > > > >
> > > > > > > >                 <soap12:Envelope ....>
> > > > > > > >                   <soap12:Header>
> > > > > > > >                     <ErrorResponse ....>
> > > > > > > >                     </ErrorResponse>
> > > > > > > >                     <UserInfo ...>
> > > > > > > >                       <Id>string</Id>
> > > > > > > >                       <DOB>string</DOB>
> > > > > > > >                     </UserInfo>
> > > > > > > >                   </soap12:Header>
> > > > > > > >                   <soap12:Body>
> > > > > > > >                     <HelloWorldResponse ....>
> > > > > > > >                       .....
> > > > > > > >                     </HelloWorldResponse>
> > > > > > > >                   </soap12:Body>
> > > > > > > >                 </soap12:Envelope>
> > > > > > > >
> > > > > > > >
> > > > > > > > My issue is I need to get stuff from the UserInfo header....how
> > can
> > > > I
> > > > > > > > get that?  Currently all I can get is the HelloWorldResponse
> > from
> > > > the
> > > > > > > > "body".
> > > > > > > >
> > > > > > > > Thanks!
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > > >
> > > > > >
> > > > > >
> > > > > > --
> > > > > > Saludos.
> > > > > > José Antonio Sánchez
> > > > > >
> > > > > >
> > > >
> > ---------------------------------------------------------------------
> > > > > > To unsubscribe, e-mail:
> > > > axis-user-unsubscribe@ws.apache.org
> > > > > > For additional commands, e-mail: axis-user-help@ws.apache.org
> > > > > >
> > > >
> > ============================================================
> > > > > > The information contained in this message may be privileged
> > > > > > and confidential and protected from disclosure. If the reader
> > > > > > of this message is not the intended recipient, or an employee
> > > > > > or agent responsible for delivering this message to the
> > > > > > intended recipient, you are hereby notified that any reproduction,
> > > > > > dissemination or distribution of this communication is strictly
> > > > > > prohibited. If you have received this communication in error,
> > > > > > please notify us immediately by replying to the message and
> > > > > > deleting it from your computer. Thank you. Tellabs
> > > > > >
> > > >
> > ============================================================
> > > > > >
> > > > > >
> > > >
> > ---------------------------------------------------------------------
> > > > > > To unsubscribe, e-mail:
> > > > axis-user-unsubscribe@ws.apache.org
> > > > > > For additional commands, e-mail: axis-user-help@ws.apache.org
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > > > --
> > > > > Davanum Srinivas :: http://wso2.org/ :: Oxygen for Web Services
> > Developers
> > > > >
> > > > >
> > > >
> > ---------------------------------------------------------------------
> > > > > To unsubscribe, e-mail:
> > > > axis-user-unsubscribe@ws.apache.org
> > > > > For additional commands, e-mail: axis-user-help@ws.apache.org
> > > > >
> > > > >
> > > >
> > > >
> > > >
> > > > --
> > > > Amila Suriarachchi,
> > > > WSO2 Inc.
> > >
> > >
> > > --
> > > Thilina Gunarathne  -  http://www.wso2.com - http://thilinag.blogspot.com
> > >
> > >
> > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail:
> > axis-user-unsubscribe@ws.apache.org
> > > For additional commands, e-mail: axis-user-help@ws.apache.org
> > >
> > >
> >
> >
>
>
> --
> Saludos.
> José Antonio Sánchez
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>
>


-- 
Thilina Gunarathne  -  http://www.wso2.com - http://thilinag.blogspot.com

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


Re: Apache Axis 2: how to get header? Options

Posted by José Antonio Sánchez <ge...@gmail.com>.
You get this with:

MessageContext.getCurrentMessageContext().getEnvelope()

But remember, you cannot make this in your client code. You have to
make it in the Stub code and then give the headers to your client code
by other means (for example, returning a custom class instead of the
generated class).

On 4/23/07, craig wickesser <co...@gmail.com> wrote:
> Shaoguang,
>     MessageContext does not have a "getSoapEnvelope" method, in fact the
> only getter method it has is getCurrentMessageContext (at least for Axis2).
> Any other ideas?  I think I might switch to XFire to do what I need.  I
> posted over there and it sounds like in the next day or so there will be
> support for getting the headers that I need.
>
> Thanks
> Craig
>
>
> On 4/22/07, Thilina Gunarathne <cs...@gmail.com> wrote:
> > > Do we have a default  envelope  set in out message context in Axis2?
> > > In Step #1 what he does is set an envelope in out message context (with
> the
> > > out headers) first and then retrieve it.
> > > outMessageContext.setEnvelope (createSOAPEnvelope());
> > see https://issues.apache.org/jira/browse/AXIS2-2531
> >
> > Thanka,
> > Thilina
> > >
> > > So the Step# 2 suggestion is a performace improvement only if Axis2 set
> a
> > > default out Envelope. I am not sure whether Axis2 does this or not. if
> so I
> > > think we have to stop that since there is no reason to do that.
> > >
> > > Amila.
> > >
> > > > thanks,
> > > > dims
> > > >
> > > > On 4/19/07, Kang, Kamaljeet K. < Kamal.K.Kang@tellabs.com> wrote:
> > > > > These are the changes I did to get Response SOAP header.
> > > > >
> > > > > 1) Save header in the message context in the skeleton
> implementation.
> > > > >        MessageContext inMsgContext =
> > > MessageContext.getCurrentMessageContext();
> > > > >         OperationContext operationContext =
> > > inMsgContext.getOperationContext();
> > > > >         MessageContext outMessageContext = operationContext
> > > .getMessageContext(
> WSDLConstants.MESSAGE_LABEL_OUT_VALUE);
> > > > >         outMessageContext.setEnvelope (createSOAPEnvelope());
> > > > >         OMNode outHeaderNode = toOM(outHeader);
> > > > >
> > > > >
> > >
> outMessageContext.getEnvelope().getHeader().addChild(outHeaderNode);
> > > > >
> > > > > 2)  Modified autogenerated *InOutReceiver classes to not create new
> > > Envelope if Envelope is already there in the context (modified whereever
> > > factory.getDefaultEnvelope() is called)
> > > > >
> > > > > 3) Modified Stub to save the return message context
> > > > >
> org.apache.axis2.context.MessageContext
> > > _returnMessageContext =
> _operationClient.getMessageContext(
> > > > >
> > >
> org.apache.axis2.wsdl.WSDLConstants.MESSAGE_LABEL_IN_VALUE
> > > );
> > > > >                 org.apache.axiom.soap.SOAPEnvelope
> > > _returnEnv = _returnMessageContext.getEnvelope();
> > > > >
> > > > > // Added this line
> > > > >
> > >
> _serviceClient.getServiceContext().setLastOperationContext(_operationClient.getOperationContext());
> > > > >
> > > > >
> > > > > 4) Finally you can get the Response Header from stub
> > > > >
> > > > >         OperationContext oprCtxt =
> > > stub._getServiceClient().getLastOperationContext();
> > > > >         MessageContext inMsgContext =
> > > oprCtxt.getMessageContext
> (WSDLConstants.MESSAGE_LABEL_IN_VALUE);
> > > > >         SOAPHeader header = inMsgContext.getEnvelope().getHeader();
> > > > >
> > > > >         return
> > > Header_T.Factory.parse(header.getFirstElement
> ().getXMLStreamReaderWithoutCaching());
> > > > >
> > > > > Not sure if there is any easier way but finally this worked for me.
> > > > >
> > > > > Let me know if you need more help with this.
> > > > >
> > > > >
> > > > > Kamal Kang
> > > > >
> > > > >
> > > > > -----Original Message-----
> > > > > From: José Antonio Sánchez [mailto: getaceres@gmail.com]
> > > > > Sent: Thursday, April 19, 2007 3:56 PM
> > > > > To: axis-user@ws.apache.org
> > > > > Subject: Re: Apache Axis 2: how to get header? Options
> > > > >
> > > > > AFAIK you have to modify the stub code and get headers from there.
> In
> > > > > Axis2 1.2 there is an operation in the generated stub to get the
> last
> > > > > operation context (and so the envelope object) but it didn't work
> for
> > > > > me.
> > > > >
> > > > > On 4/19/07, craig wickesser <co...@gmail.com> wrote:
> > > > > > anyone???
> > > > > >
> > > > > >
> > > > > > On 4/18/07, craig wickesser <co...@gmail.com> wrote:
> > > > > > > Hi...I have a client which I am using to access a web service
> The
> > > > > > > code I have is...
> > > > > > >
> > > > > > >
> > > > > > >                 MyStub stub = new MyStub();
> > > > > > >                 HelloWorldDocument reqDoc =
> > > > > > HellWorldDocument.Factory.newInstance ();
> > > > > > >                 reqDoc.setName("bob");
> > > > > > >
> > > > > > >
> > > > > > >                 HelloWorldResponseDocumnet resp =
> > > stub.SayHello(reqDoc);
> > > > > > >
> > > > > > >
> > > > > > > The SOAP XML response is in the following form...
> > > > > > >
> > > > > > >
> > > > > > >                 <soap12:Envelope ....>
> > > > > > >                   <soap12:Header>
> > > > > > >                     <ErrorResponse ....>
> > > > > > >                     </ErrorResponse>
> > > > > > >                     <UserInfo ...>
> > > > > > >                       <Id>string</Id>
> > > > > > >                       <DOB>string</DOB>
> > > > > > >                     </UserInfo>
> > > > > > >                   </soap12:Header>
> > > > > > >                   <soap12:Body>
> > > > > > >                     <HelloWorldResponse ....>
> > > > > > >                       .....
> > > > > > >                     </HelloWorldResponse>
> > > > > > >                   </soap12:Body>
> > > > > > >                 </soap12:Envelope>
> > > > > > >
> > > > > > >
> > > > > > > My issue is I need to get stuff from the UserInfo header....how
> can
> > > I
> > > > > > > get that?  Currently all I can get is the HelloWorldResponse
> from
> > > the
> > > > > > > "body".
> > > > > > >
> > > > > > > Thanks!
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > > > --
> > > > > Saludos.
> > > > > José Antonio Sánchez
> > > > >
> > > > >
> > >
> ---------------------------------------------------------------------
> > > > > To unsubscribe, e-mail:
> > > axis-user-unsubscribe@ws.apache.org
> > > > > For additional commands, e-mail: axis-user-help@ws.apache.org
> > > > >
> > >
> ============================================================
> > > > > The information contained in this message may be privileged
> > > > > and confidential and protected from disclosure. If the reader
> > > > > of this message is not the intended recipient, or an employee
> > > > > or agent responsible for delivering this message to the
> > > > > intended recipient, you are hereby notified that any reproduction,
> > > > > dissemination or distribution of this communication is strictly
> > > > > prohibited. If you have received this communication in error,
> > > > > please notify us immediately by replying to the message and
> > > > > deleting it from your computer. Thank you. Tellabs
> > > > >
> > >
> ============================================================
> > > > >
> > > > >
> > >
> ---------------------------------------------------------------------
> > > > > To unsubscribe, e-mail:
> > > axis-user-unsubscribe@ws.apache.org
> > > > > For additional commands, e-mail: axis-user-help@ws.apache.org
> > > > >
> > > > >
> > > >
> > > >
> > > > --
> > > > Davanum Srinivas :: http://wso2.org/ :: Oxygen for Web Services
> Developers
> > > >
> > > >
> > >
> ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail:
> > > axis-user-unsubscribe@ws.apache.org
> > > > For additional commands, e-mail: axis-user-help@ws.apache.org
> > > >
> > > >
> > >
> > >
> > >
> > > --
> > > Amila Suriarachchi,
> > > WSO2 Inc.
> >
> >
> > --
> > Thilina Gunarathne  -  http://www.wso2.com - http://thilinag.blogspot.com
> >
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> axis-user-unsubscribe@ws.apache.org
> > For additional commands, e-mail: axis-user-help@ws.apache.org
> >
> >
>
>


-- 
Saludos.
José Antonio Sánchez

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


Re: Apache Axis 2: how to get header? Options

Posted by craig wickesser <co...@gmail.com>.
Shaoguang,
    MessageContext does not have a "getSoapEnvelope" method, in fact the
only getter method it has is getCurrentMessageContext (at least for Axis2).
Any other ideas?  I think I might switch to XFire to do what I need.  I
posted over there and it sounds like in the next day or so there will be
support for getting the headers that I need.

Thanks
Craig

On 4/22/07, Thilina Gunarathne <cs...@gmail.com> wrote:
>
> > Do we have a default  envelope  set in out message context in Axis2?
> > In Step #1 what he does is set an envelope in out message context (with
> the
> > out headers) first and then retrieve it.
> > outMessageContext.setEnvelope(createSOAPEnvelope());
> see https://issues.apache.org/jira/browse/AXIS2-2531
>
> Thanka,
> Thilina
> >
> > So the Step# 2 suggestion is a performace improvement only if Axis2 set
> a
> > default out Envelope. I am not sure whether Axis2 does this or not. if
> so I
> > think we have to stop that since there is no reason to do that.
> >
> > Amila.
> >
> > > thanks,
> > > dims
> > >
> > > On 4/19/07, Kang, Kamaljeet K. < Kamal.K.Kang@tellabs.com> wrote:
> > > > These are the changes I did to get Response SOAP header.
> > > >
> > > > 1) Save header in the message context in the skeleton
> implementation.
> > > >        MessageContext inMsgContext =
> > MessageContext.getCurrentMessageContext();
> > > >         OperationContext operationContext =
> > inMsgContext.getOperationContext();
> > > >         MessageContext outMessageContext = operationContext
> > .getMessageContext( WSDLConstants.MESSAGE_LABEL_OUT_VALUE);
> > > >         outMessageContext.setEnvelope(createSOAPEnvelope());
> > > >         OMNode outHeaderNode = toOM(outHeader);
> > > >
> > > >
> > outMessageContext.getEnvelope().getHeader().addChild(outHeaderNode);
> > > >
> > > > 2)  Modified autogenerated *InOutReceiver classes to not create new
> > Envelope if Envelope is already there in the context (modified whereever
> > factory.getDefaultEnvelope() is called)
> > > >
> > > > 3) Modified Stub to save the return message context
> > > >                org.apache.axis2.context.MessageContext
> > _returnMessageContext = _operationClient.getMessageContext(
> > > >
> > org.apache.axis2.wsdl.WSDLConstants.MESSAGE_LABEL_IN_VALUE
> > );
> > > >                 org.apache.axiom.soap.SOAPEnvelope
> > _returnEnv = _returnMessageContext.getEnvelope();
> > > >
> > > > // Added this line
> > > >
> >
> _serviceClient.getServiceContext().setLastOperationContext(_operationClient.getOperationContext());
> > > >
> > > >
> > > > 4) Finally you can get the Response Header from stub
> > > >
> > > >         OperationContext oprCtxt =
> > stub._getServiceClient().getLastOperationContext();
> > > >         MessageContext inMsgContext =
> > oprCtxt.getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
> > > >         SOAPHeader header = inMsgContext.getEnvelope().getHeader();
> > > >
> > > >         return
> > Header_T.Factory.parse(header.getFirstElement
> ().getXMLStreamReaderWithoutCaching());
> > > >
> > > > Not sure if there is any easier way but finally this worked for me.
> > > >
> > > > Let me know if you need more help with this.
> > > >
> > > >
> > > > Kamal Kang
> > > >
> > > >
> > > > -----Original Message-----
> > > > From: José Antonio Sánchez [mailto:getaceres@gmail.com]
> > > > Sent: Thursday, April 19, 2007 3:56 PM
> > > > To: axis-user@ws.apache.org
> > > > Subject: Re: Apache Axis 2: how to get header? Options
> > > >
> > > > AFAIK you have to modify the stub code and get headers from there.
> In
> > > > Axis2 1.2 there is an operation in the generated stub to get the
> last
> > > > operation context (and so the envelope object) but it didn't work
> for
> > > > me.
> > > >
> > > > On 4/19/07, craig wickesser <co...@gmail.com> wrote:
> > > > > anyone???
> > > > >
> > > > >
> > > > > On 4/18/07, craig wickesser <co...@gmail.com> wrote:
> > > > > > Hi...I have a client which I am using to access a web
> service  The
> > > > > > code I have is...
> > > > > >
> > > > > >
> > > > > >                 MyStub stub = new MyStub();
> > > > > >                 HelloWorldDocument reqDoc =
> > > > > HellWorldDocument.Factory.newInstance ();
> > > > > >                 reqDoc.setName("bob");
> > > > > >
> > > > > >
> > > > > >                 HelloWorldResponseDocumnet resp =
> > stub.SayHello(reqDoc);
> > > > > >
> > > > > >
> > > > > > The SOAP XML response is in the following form...
> > > > > >
> > > > > >
> > > > > >                 <soap12:Envelope ....>
> > > > > >                   <soap12:Header>
> > > > > >                     <ErrorResponse ....>
> > > > > >                     </ErrorResponse>
> > > > > >                     <UserInfo ...>
> > > > > >                       <Id>string</Id>
> > > > > >                       <DOB>string</DOB>
> > > > > >                     </UserInfo>
> > > > > >                   </soap12:Header>
> > > > > >                   <soap12:Body>
> > > > > >                     <HelloWorldResponse ....>
> > > > > >                       .....
> > > > > >                     </HelloWorldResponse>
> > > > > >                   </soap12:Body>
> > > > > >                 </soap12:Envelope>
> > > > > >
> > > > > >
> > > > > > My issue is I need to get stuff from the UserInfo header....how
> can
> > I
> > > > > > get that?  Currently all I can get is the HelloWorldResponse
> from
> > the
> > > > > > "body".
> > > > > >
> > > > > > Thanks!
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > >
> > > >
> > > > --
> > > > Saludos.
> > > > José Antonio Sánchez
> > > >
> > > >
> > ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail:
> > axis-user-unsubscribe@ws.apache.org
> > > > For additional commands, e-mail: axis-user-help@ws.apache.org
> > > >
> > ============================================================
> > > > The information contained in this message may be privileged
> > > > and confidential and protected from disclosure. If the reader
> > > > of this message is not the intended recipient, or an employee
> > > > or agent responsible for delivering this message to the
> > > > intended recipient, you are hereby notified that any reproduction,
> > > > dissemination or distribution of this communication is strictly
> > > > prohibited. If you have received this communication in error,
> > > > please notify us immediately by replying to the message and
> > > > deleting it from your computer. Thank you. Tellabs
> > > >
> > ============================================================
> > > >
> > > >
> > ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail:
> > axis-user-unsubscribe@ws.apache.org
> > > > For additional commands, e-mail: axis-user-help@ws.apache.org
> > > >
> > > >
> > >
> > >
> > > --
> > > Davanum Srinivas :: http://wso2.org/ :: Oxygen for Web Services
> Developers
> > >
> > >
> > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail:
> > axis-user-unsubscribe@ws.apache.org
> > > For additional commands, e-mail: axis-user-help@ws.apache.org
> > >
> > >
> >
> >
> >
> > --
> > Amila Suriarachchi,
> > WSO2 Inc.
>
>
> --
> Thilina Gunarathne  -  http://www.wso2.com - http://thilinag.blogspot.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>
>

Re: Apache Axis 2: how to get header? Options

Posted by Thilina Gunarathne <cs...@gmail.com>.
> Do we have a default  envelope  set in out message context in Axis2?
> In Step #1 what he does is set an envelope in out message context (with the
> out headers) first and then retrieve it.
> outMessageContext.setEnvelope(createSOAPEnvelope());
see https://issues.apache.org/jira/browse/AXIS2-2531

Thanka,
Thilina
>
> So the Step# 2 suggestion is a performace improvement only if Axis2 set a
> default out Envelope. I am not sure whether Axis2 does this or not. if so I
> think we have to stop that since there is no reason to do that.
>
> Amila.
>
> > thanks,
> > dims
> >
> > On 4/19/07, Kang, Kamaljeet K. < Kamal.K.Kang@tellabs.com> wrote:
> > > These are the changes I did to get Response SOAP header.
> > >
> > > 1) Save header in the message context in the skeleton implementation.
> > >        MessageContext inMsgContext =
> MessageContext.getCurrentMessageContext();
> > >         OperationContext operationContext =
> inMsgContext.getOperationContext();
> > >         MessageContext outMessageContext = operationContext
> .getMessageContext( WSDLConstants.MESSAGE_LABEL_OUT_VALUE);
> > >         outMessageContext.setEnvelope(createSOAPEnvelope());
> > >         OMNode outHeaderNode = toOM(outHeader);
> > >
> > >
> outMessageContext.getEnvelope().getHeader().addChild(outHeaderNode);
> > >
> > > 2)  Modified autogenerated *InOutReceiver classes to not create new
> Envelope if Envelope is already there in the context (modified whereever
> factory.getDefaultEnvelope() is called)
> > >
> > > 3) Modified Stub to save the return message context
> > >                org.apache.axis2.context.MessageContext
> _returnMessageContext = _operationClient.getMessageContext(
> > >
> org.apache.axis2.wsdl.WSDLConstants.MESSAGE_LABEL_IN_VALUE
> );
> > >                 org.apache.axiom.soap.SOAPEnvelope
> _returnEnv = _returnMessageContext.getEnvelope();
> > >
> > > // Added this line
> > >
> _serviceClient.getServiceContext().setLastOperationContext(_operationClient.getOperationContext());
> > >
> > >
> > > 4) Finally you can get the Response Header from stub
> > >
> > >         OperationContext oprCtxt =
> stub._getServiceClient().getLastOperationContext();
> > >         MessageContext inMsgContext =
> oprCtxt.getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
> > >         SOAPHeader header = inMsgContext.getEnvelope().getHeader();
> > >
> > >         return
> Header_T.Factory.parse(header.getFirstElement().getXMLStreamReaderWithoutCaching());
> > >
> > > Not sure if there is any easier way but finally this worked for me.
> > >
> > > Let me know if you need more help with this.
> > >
> > >
> > > Kamal Kang
> > >
> > >
> > > -----Original Message-----
> > > From: José Antonio Sánchez [mailto:getaceres@gmail.com]
> > > Sent: Thursday, April 19, 2007 3:56 PM
> > > To: axis-user@ws.apache.org
> > > Subject: Re: Apache Axis 2: how to get header? Options
> > >
> > > AFAIK you have to modify the stub code and get headers from there. In
> > > Axis2 1.2 there is an operation in the generated stub to get the last
> > > operation context (and so the envelope object) but it didn't work for
> > > me.
> > >
> > > On 4/19/07, craig wickesser <co...@gmail.com> wrote:
> > > > anyone???
> > > >
> > > >
> > > > On 4/18/07, craig wickesser <co...@gmail.com> wrote:
> > > > > Hi...I have a client which I am using to access a web service  The
> > > > > code I have is...
> > > > >
> > > > >
> > > > >                 MyStub stub = new MyStub();
> > > > >                 HelloWorldDocument reqDoc =
> > > > HellWorldDocument.Factory.newInstance ();
> > > > >                 reqDoc.setName("bob");
> > > > >
> > > > >
> > > > >                 HelloWorldResponseDocumnet resp =
> stub.SayHello(reqDoc);
> > > > >
> > > > >
> > > > > The SOAP XML response is in the following form...
> > > > >
> > > > >
> > > > >                 <soap12:Envelope ....>
> > > > >                   <soap12:Header>
> > > > >                     <ErrorResponse ....>
> > > > >                     </ErrorResponse>
> > > > >                     <UserInfo ...>
> > > > >                       <Id>string</Id>
> > > > >                       <DOB>string</DOB>
> > > > >                     </UserInfo>
> > > > >                   </soap12:Header>
> > > > >                   <soap12:Body>
> > > > >                     <HelloWorldResponse ....>
> > > > >                       .....
> > > > >                     </HelloWorldResponse>
> > > > >                   </soap12:Body>
> > > > >                 </soap12:Envelope>
> > > > >
> > > > >
> > > > > My issue is I need to get stuff from the UserInfo header....how can
> I
> > > > > get that?  Currently all I can get is the HelloWorldResponse from
> the
> > > > > "body".
> > > > >
> > > > > Thanks!
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> > > --
> > > Saludos.
> > > José Antonio Sánchez
> > >
> > >
> ---------------------------------------------------------------------
> > > To unsubscribe, e-mail:
> axis-user-unsubscribe@ws.apache.org
> > > For additional commands, e-mail: axis-user-help@ws.apache.org
> > >
> ============================================================
> > > The information contained in this message may be privileged
> > > and confidential and protected from disclosure. If the reader
> > > of this message is not the intended recipient, or an employee
> > > or agent responsible for delivering this message to the
> > > intended recipient, you are hereby notified that any reproduction,
> > > dissemination or distribution of this communication is strictly
> > > prohibited. If you have received this communication in error,
> > > please notify us immediately by replying to the message and
> > > deleting it from your computer. Thank you. Tellabs
> > >
> ============================================================
> > >
> > >
> ---------------------------------------------------------------------
> > > To unsubscribe, e-mail:
> axis-user-unsubscribe@ws.apache.org
> > > For additional commands, e-mail: axis-user-help@ws.apache.org
> > >
> > >
> >
> >
> > --
> > Davanum Srinivas :: http://wso2.org/ :: Oxygen for Web Services Developers
> >
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> axis-user-unsubscribe@ws.apache.org
> > For additional commands, e-mail: axis-user-help@ws.apache.org
> >
> >
>
>
>
> --
> Amila Suriarachchi,
> WSO2 Inc.


-- 
Thilina Gunarathne  -  http://www.wso2.com - http://thilinag.blogspot.com

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


Re: Apache Axis 2: how to get header? Options

Posted by Amila Suriarachchi <am...@gmail.com>.
On 4/20/07, Davanum Srinivas <da...@gmail.com> wrote:
>
> Kamaljeet,
> Step #2 is a good enchancement request. we should be generating code
> with that snippet. Can you please log a jira request?
>
> Amila,
> Can you please review this?


Do we have a default  envelope  set in out message context in Axis2?
In Step #1 what he does is set an envelope in out message context (with the
out headers) first and then retrieve it.
outMessageContext.setEnvelope(createSOAPEnvelope());

So the Step# 2 suggestion is a performace improvement only if Axis2 set a
default out Envelope. I am not sure whether Axis2 does this or not. if so I
think we have to stop that since there is no reason to do that.

Amila.

thanks,
> dims
>
> On 4/19/07, Kang, Kamaljeet K. <Ka...@tellabs.com> wrote:
> > These are the changes I did to get Response SOAP header.
> >
> > 1) Save header in the message context in the skeleton implementation.
> >        MessageContext inMsgContext =
> MessageContext.getCurrentMessageContext();
> >         OperationContext operationContext =
> inMsgContext.getOperationContext();
> >         MessageContext outMessageContext = operationContext
> .getMessageContext(WSDLConstants.MESSAGE_LABEL_OUT_VALUE);
> >         outMessageContext.setEnvelope(createSOAPEnvelope());
> >         OMNode outHeaderNode = toOM(outHeader);
> >
> >         outMessageContext.getEnvelope
> ().getHeader().addChild(outHeaderNode);
> >
> > 2)  Modified autogenerated *InOutReceiver classes to not create new
> Envelope if Envelope is already there in the context (modified whereever
> factory.getDefaultEnvelope() is called)
> >
> > 3) Modified Stub to save the return message context
> >                org.apache.axis2.context.MessageContext_returnMessageContext = _operationClient.getMessageContext(
> >
> org.apache.axis2.wsdl.WSDLConstants.MESSAGE_LABEL_IN_VALUE);
> >                 org.apache.axiom.soap.SOAPEnvelope _returnEnv =
> _returnMessageContext.getEnvelope();
> >
> > // Added this line
> >
> _serviceClient.getServiceContext().setLastOperationContext(_operationClient.getOperationContext());
> >
> >
> > 4) Finally you can get the Response Header from stub
> >
> >         OperationContext oprCtxt =
> stub._getServiceClient().getLastOperationContext();
> >         MessageContext inMsgContext = oprCtxt.getMessageContext(
> WSDLConstants.MESSAGE_LABEL_IN_VALUE);
> >         SOAPHeader header = inMsgContext.getEnvelope().getHeader();
> >
> >         return Header_T.Factory.parse(header.getFirstElement
> ().getXMLStreamReaderWithoutCaching());
> >
> > Not sure if there is any easier way but finally this worked for me.
> >
> > Let me know if you need more help with this.
> >
> >
> > Kamal Kang
> >
> >
> > -----Original Message-----
> > From: José Antonio Sánchez [mailto:getaceres@gmail.com]
> > Sent: Thursday, April 19, 2007 3:56 PM
> > To: axis-user@ws.apache.org
> > Subject: Re: Apache Axis 2: how to get header? Options
> >
> > AFAIK you have to modify the stub code and get headers from there. In
> > Axis2 1.2 there is an operation in the generated stub to get the last
> > operation context (and so the envelope object) but it didn't work for
> > me.
> >
> > On 4/19/07, craig wickesser <co...@gmail.com> wrote:
> > > anyone???
> > >
> > >
> > > On 4/18/07, craig wickesser <co...@gmail.com> wrote:
> > > > Hi...I have a client which I am using to access a web service  The
> > > > code I have is...
> > > >
> > > >
> > > >                 MyStub stub = new MyStub();
> > > >                 HelloWorldDocument reqDoc =
> > > HellWorldDocument.Factory.newInstance();
> > > >                 reqDoc.setName("bob");
> > > >
> > > >
> > > >                 HelloWorldResponseDocumnet resp = stub.SayHello
> (reqDoc);
> > > >
> > > >
> > > > The SOAP XML response is in the following form...
> > > >
> > > >
> > > >                 <soap12:Envelope ....>
> > > >                   <soap12:Header>
> > > >                     <ErrorResponse ....>
> > > >                     </ErrorResponse>
> > > >                     <UserInfo ...>
> > > >                       <Id>string</Id>
> > > >                       <DOB>string</DOB>
> > > >                     </UserInfo>
> > > >                   </soap12:Header>
> > > >                   <soap12:Body>
> > > >                     <HelloWorldResponse ....>
> > > >                       .....
> > > >                     </HelloWorldResponse>
> > > >                   </soap12:Body>
> > > >                 </soap12:Envelope>
> > > >
> > > >
> > > > My issue is I need to get stuff from the UserInfo header....how can
> I
> > > > get that?  Currently all I can get is the HelloWorldResponse from
> the
> > > > "body".
> > > >
> > > > Thanks!
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > >
> > >
> >
> >
> > --
> > Saludos.
> > José Antonio Sánchez
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> > For additional commands, e-mail: axis-user-help@ws.apache.org
> > ============================================================
> > The information contained in this message may be privileged
> > and confidential and protected from disclosure. If the reader
> > of this message is not the intended recipient, or an employee
> > or agent responsible for delivering this message to the
> > intended recipient, you are hereby notified that any reproduction,
> > dissemination or distribution of this communication is strictly
> > prohibited. If you have received this communication in error,
> > please notify us immediately by replying to the message and
> > deleting it from your computer. Thank you. Tellabs
> > ============================================================
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> > For additional commands, e-mail: axis-user-help@ws.apache.org
> >
> >
>
>
> --
> Davanum Srinivas :: http://wso2.org/ :: Oxygen for Web Services Developers
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>
>


-- 
Amila Suriarachchi,
WSO2 Inc.

Re: Apache Axis 2: how to get header? Options

Posted by Davanum Srinivas <da...@gmail.com>.
Kamaljeet,
Step #2 is a good enchancement request. we should be generating code
with that snippet. Can you please log a jira request?

Amila,
Can you please review this?

thanks,
dims

On 4/19/07, Kang, Kamaljeet K. <Ka...@tellabs.com> wrote:
> These are the changes I did to get Response SOAP header.
>
> 1) Save header in the message context in the skeleton implementation.
>        MessageContext inMsgContext = MessageContext.getCurrentMessageContext();
>         OperationContext operationContext =             inMsgContext.getOperationContext();
>         MessageContext outMessageContext = operationContext .getMessageContext(WSDLConstants.MESSAGE_LABEL_OUT_VALUE);
>         outMessageContext.setEnvelope(createSOAPEnvelope());
>         OMNode outHeaderNode = toOM(outHeader);
>
>         outMessageContext.getEnvelope().getHeader().addChild(outHeaderNode);
>
> 2)  Modified autogenerated *InOutReceiver classes to not create new Envelope if Envelope is already there in the context (modified whereever factory.getDefaultEnvelope() is called)
>
> 3) Modified Stub to save the return message context
>                org.apache.axis2.context.MessageContext _returnMessageContext = _operationClient.getMessageContext(
>                                            org.apache.axis2.wsdl.WSDLConstants.MESSAGE_LABEL_IN_VALUE);
>                 org.apache.axiom.soap.SOAPEnvelope _returnEnv = _returnMessageContext.getEnvelope();
>
> // Added this line
> _serviceClient.getServiceContext().setLastOperationContext(_operationClient.getOperationContext());
>
>
> 4) Finally you can get the Response Header from stub
>
>         OperationContext oprCtxt = stub._getServiceClient().getLastOperationContext();
>         MessageContext inMsgContext = oprCtxt.getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
>         SOAPHeader header = inMsgContext.getEnvelope().getHeader();
>
>         return Header_T.Factory.parse(header.getFirstElement().getXMLStreamReaderWithoutCaching());
>
> Not sure if there is any easier way but finally this worked for me.
>
> Let me know if you need more help with this.
>
>
> Kamal Kang
>
>
> -----Original Message-----
> From: José Antonio Sánchez [mailto:getaceres@gmail.com]
> Sent: Thursday, April 19, 2007 3:56 PM
> To: axis-user@ws.apache.org
> Subject: Re: Apache Axis 2: how to get header? Options
>
> AFAIK you have to modify the stub code and get headers from there. In
> Axis2 1.2 there is an operation in the generated stub to get the last
> operation context (and so the envelope object) but it didn't work for
> me.
>
> On 4/19/07, craig wickesser <co...@gmail.com> wrote:
> > anyone???
> >
> >
> > On 4/18/07, craig wickesser <co...@gmail.com> wrote:
> > > Hi...I have a client which I am using to access a web service  The
> > > code I have is...
> > >
> > >
> > >                 MyStub stub = new MyStub();
> > >                 HelloWorldDocument reqDoc =
> > HellWorldDocument.Factory.newInstance();
> > >                 reqDoc.setName("bob");
> > >
> > >
> > >                 HelloWorldResponseDocumnet resp = stub.SayHello(reqDoc);
> > >
> > >
> > > The SOAP XML response is in the following form...
> > >
> > >
> > >                 <soap12:Envelope ....>
> > >                   <soap12:Header>
> > >                     <ErrorResponse ....>
> > >                     </ErrorResponse>
> > >                     <UserInfo ...>
> > >                       <Id>string</Id>
> > >                       <DOB>string</DOB>
> > >                     </UserInfo>
> > >                   </soap12:Header>
> > >                   <soap12:Body>
> > >                     <HelloWorldResponse ....>
> > >                       .....
> > >                     </HelloWorldResponse>
> > >                   </soap12:Body>
> > >                 </soap12:Envelope>
> > >
> > >
> > > My issue is I need to get stuff from the UserInfo header....how can I
> > > get that?  Currently all I can get is the HelloWorldResponse from the
> > > "body".
> > >
> > > Thanks!
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> >
> >
>
>
> --
> Saludos.
> José Antonio Sánchez
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
> ============================================================
> The information contained in this message may be privileged
> and confidential and protected from disclosure. If the reader
> of this message is not the intended recipient, or an employee
> or agent responsible for delivering this message to the
> intended recipient, you are hereby notified that any reproduction,
> dissemination or distribution of this communication is strictly
> prohibited. If you have received this communication in error,
> please notify us immediately by replying to the message and
> deleting it from your computer. Thank you. Tellabs
> ============================================================
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>
>


-- 
Davanum Srinivas :: http://wso2.org/ :: Oxygen for Web Services Developers

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


Re: Apache Axis 2: how to get header? Options

Posted by Shaoguang Cong <sc...@yahoo.com>.
Yes. I was speaking on the client side. 
   
  -Shaoguang
   
  Martin Gainty <mg...@hotmail.com> wrote:
          I didnt see any ability to run any of the axis operations on the server asychronously.. I assume you're speaking on the client side???
  
M-
  This email message and any files transmitted with it contain confidential
information intended only for the person(s) to whom this email message is
addressed.  If you have received this email message in error, please notify
the sender immediately by telephone or email and destroy the original
message without making a copy.  Thank you.

    ----- Original Message ----- 
  From: Shaoguang Cong 
  To: axis-user@ws.apache.org 
  Sent: Sunday, April 22, 2007 7:20 PM
  Subject: Re: Apache Axis 2: how to get header? Options
  

  I observed the same thing: MessageContext.getCurrentMessageContext() returns null. 
  I don't know what's the designer's intention with "CurrentMessageContex", maybe that's for asynchronical calls. 
   
  To get headers from the response, try MessageContext.getSoapEnvelope().getHeader(). I only do blocked call and it works for me.
   
  Shaoguang
  
craig wickesser <co...@gmail.com> wrote:
  yea so far I am not finding how to get headers from the response, am I missing something ?

  On 4/20/07, craig wickesser <co...@gmail.com> wrote:     Here is what it says at that link:
   
  org.apache.axis2.transport.http.HTTPConstants.HTTP_HEADERS 
  You might sometimes want to send your own custom HTTP headers. You can set an ArrayList filled with 

org.apache.commons.httpclient.Header
  objects using the above property. You must not try to override the Headers the Axis2 engine is setting to the outgoing message
   
   
  It seems to me this in regards to settings headers, I need to somehow get the headers from the response.  Also, in my earlier post I mentioned that when I call MessageContext.getCurrentMessageContext() it returns null. 
   
  What do you think?

 
    On 4/20/07, robert lazarski <robertlazarski@gmail.com > wrote:   You'll need to work with MessageContext. Here's the reference for the properties you're looking for: 

http://wso2.org/library/230#HTTP_HEADERS

HTH,
Robert   

  On 4/20/07, craig wickesser <codecraig@gmail.com > wrote:   client side   

  On 4/20/07, robert lazarski < robertlazarski@gmail.com > wrote:   Client or server side ? 

  On 4/20/07, craig wickesser < codecraig@gmail.com > wrote:   any ideas?














    
---------------------------------
  Ahhh...imagining that irresistible "new car" smell?
Check out new cars at Yahoo! Autos. 

       
---------------------------------
Ahhh...imagining that irresistible "new car" smell?
 Check outnew cars at Yahoo! Autos.

Re: Apache Axis 2: how to get header? Options

Posted by Martin Gainty <mg...@hotmail.com>.
I didnt see any ability to run any of the axis operations on the server asychronously.. I assume you're speaking on the client side???

M-
This email message and any files transmitted with it contain confidential
information intended only for the person(s) to whom this email message is
addressed.  If you have received this email message in error, please notify
the sender immediately by telephone or email and destroy the original
message without making a copy.  Thank you.

  ----- Original Message ----- 
  From: Shaoguang Cong 
  To: axis-user@ws.apache.org 
  Sent: Sunday, April 22, 2007 7:20 PM
  Subject: Re: Apache Axis 2: how to get header? Options


  I observed the same thing: MessageContext.getCurrentMessageContext() returns null. 
  I don't know what's the designer's intention with "CurrentMessageContex", maybe that's for asynchronical calls. 

  To get headers from the response, try MessageContext.getSoapEnvelope().getHeader(). I only do blocked call and it works for me.

  Shaoguang

  craig wickesser <co...@gmail.com> wrote:
    yea so far I am not finding how to get headers from the response, am I missing something ?


    On 4/20/07, craig wickesser <co...@gmail.com> wrote: 
      Here is what it says at that link:

      org.apache.axis2.transport.http.HTTPConstants.HTTP_HEADERS 
      You might sometimes want to send your own custom HTTP headers. You can set an ArrayList filled with 
org.apache.commons.httpclient.Headerobjects using the above property. You must not try to override the Headers the Axis2 engine is setting to the outgoing message


      It seems to me this in regards to settings headers, I need to somehow get the headers from the response.  Also, in my earlier post I mentioned that when I call MessageContext.getCurrentMessageContext() it returns null. 

      What do you think?

       
      On 4/20/07, robert lazarski <robertlazarski@gmail.com > wrote: 
        You'll need to work with MessageContext. Here's the reference for the properties you're looking for: 

        http://wso2.org/library/230#HTTP_HEADERS

        HTH,
        Robert 



        On 4/20/07, craig wickesser <codecraig@gmail.com > wrote: 
          client side 



          On 4/20/07, robert lazarski < robertlazarski@gmail.com > wrote: 
            Client or server side ? 


            On 4/20/07, craig wickesser < codecraig@gmail.com > wrote: 
              any ideas?















------------------------------------------------------------------------------
  Ahhh...imagining that irresistible "new car" smell?
  Check out new cars at Yahoo! Autos. 

Re: Apache Axis 2: how to get header? Options

Posted by Shaoguang Cong <sc...@yahoo.com>.
I observed the same thing: MessageContext.getCurrentMessageContext() returns null. 
  I don't know what's the designer's intention with "CurrentMessageContex", maybe that's for asynchronical calls. 
   
  To get headers from the response, try MessageContext.getSoapEnvelope().getHeader(). I only do blocked call and it works for me.
   
  Shaoguang
  
craig wickesser <co...@gmail.com> wrote:
  yea so far I am not finding how to get headers from the response, am I missing something ?

  On 4/20/07, craig wickesser <co...@gmail.com> wrote:     Here is what it says at that link:
   
  org.apache.axis2.transport.http.HTTPConstants.HTTP_HEADERS 
  You might sometimes want to send your own custom HTTP headers. You can set an ArrayList filled with 

org.apache.commons.httpclient.Header
  objects using the above property. You must not try to override the Headers the Axis2 engine is setting to the outgoing message
   
   
  It seems to me this in regards to settings headers, I need to somehow get the headers from the response.  Also, in my earlier post I mentioned that when I call MessageContext.getCurrentMessageContext() it returns null. 
   
  What do you think?

 
    On 4/20/07, robert lazarski <robertlazarski@gmail.com > wrote:   You'll need to work with MessageContext. Here's the reference for the properties you're looking for: 

http://wso2.org/library/230#HTTP_HEADERS

HTH,
Robert   

  On 4/20/07, craig wickesser <codecraig@gmail.com > wrote:   client side   

  On 4/20/07, robert lazarski < robertlazarski@gmail.com > wrote:   Client or server side ? 

  On 4/20/07, craig wickesser < codecraig@gmail.com > wrote:   any ideas?















       
---------------------------------
Ahhh...imagining that irresistible "new car" smell?
 Check outnew cars at Yahoo! Autos.

Re: Apache Axis 2: how to get header? Options

Posted by craig wickesser <co...@gmail.com>.
yea so far I am not finding how to get headers from the response, am I
missing something ?

On 4/20/07, craig wickesser <co...@gmail.com> wrote:
>
> Here is what it says at that link:
>
> *org.apache.axis2.transport.http.HTTPConstants.HTTP_HEADERS*
>
> You might sometimes want to send your own custom HTTP headers. You can set
> an ArrayList filled with
>
> org.apache.commons.httpclient.Header
>
> objects using the above property. You must not try to override the Headers
> the Axis2 engine is setting to the outgoing message
>
>
> It seems to me this in regards to settings headers, I need to somehow get
> the headers from the response.  Also, in my earlier post I mentioned that
> when I call MessageContext.getCurrentMessageContext() it returns null.
>
> What do you think?
>
>
>  On 4/20/07, robert lazarski <ro...@gmail.com> wrote:
> >
> > You'll need to work with MessageContext. Here's the reference for the
> > properties you're looking for:
> >
> > http://wso2.org/library/230#HTTP_HEADERS
> >
> > HTH,
> > Robert
> >
> > On 4/20/07, craig wickesser <codecraig@gmail.com > wrote:
> > >
> > > client side
> > >
> > > On 4/20/07, robert lazarski < robertlazarski@gmail.com > wrote:
> > > >
> > > > Client or server side ?
> > > >
> > > > On 4/20/07, craig wickesser < codecraig@gmail.com > wrote:
> > > > >
> > > > > any ideas?
> > > > >
> > > >
> > > >
> > >
> >
>

Re: Apache Axis 2: how to get header? Options

Posted by craig wickesser <co...@gmail.com>.
Here is what it says at that link:

*org.apache.axis2.transport.http.HTTPConstants.HTTP_HEADERS*

You might sometimes want to send your own custom HTTP headers. You can set
an ArrayList filled with

org.apache.commons.httpclient.Header

objects using the above property. You must not try to override the Headers
the Axis2 engine is setting to the outgoing message


It seems to me this in regards to settings headers, I need to somehow get
the headers from the response.  Also, in my earlier post I mentioned that
when I call MessageContext.getCurrentMessageContext() it returns null.

What do you think?


On 4/20/07, robert lazarski <ro...@gmail.com> wrote:
>
> You'll need to work with MessageContext. Here's the reference for the
> properties you're looking for:
>
> http://wso2.org/library/230#HTTP_HEADERS
>
> HTH,
> Robert
>
> On 4/20/07, craig wickesser <co...@gmail.com> wrote:
> >
> > client side
> >
> > On 4/20/07, robert lazarski < robertlazarski@gmail.com> wrote:
> > >
> > > Client or server side ?
> > >
> > > On 4/20/07, craig wickesser < codecraig@gmail.com> wrote:
> > > >
> > > > any ideas?
> > > >
> > >
> > >
> >
>

Re: Apache Axis 2: how to get header? Options

Posted by robert lazarski <ro...@gmail.com>.
You'll need to work with MessageContext. Here's the reference for the
properties you're looking for:

http://wso2.org/library/230#HTTP_HEADERS

HTH,
Robert

On 4/20/07, craig wickesser <co...@gmail.com> wrote:
>
> client side
>
> On 4/20/07, robert lazarski <ro...@gmail.com> wrote:
> >
> > Client or server side ?
> >
> > On 4/20/07, craig wickesser < codecraig@gmail.com> wrote:
> > >
> > > any ideas?
> > >
> >
> >
>

Re: Apache Axis 2: how to get header? Options

Posted by craig wickesser <co...@gmail.com>.
client side

On 4/20/07, robert lazarski <ro...@gmail.com> wrote:
>
> Client or server side ?
>
> On 4/20/07, craig wickesser <co...@gmail.com> wrote:
> >
> > any ideas?
> >
>
>

Re: Apache Axis 2: how to get header? Options

Posted by robert lazarski <ro...@gmail.com>.
Client or server side ?

On 4/20/07, craig wickesser <co...@gmail.com> wrote:
>
> any ideas?
>

Re: Apache Axis 2: how to get header? Options

Posted by craig wickesser <co...@gmail.com>.
any ideas?

Re: Apache Axis 2: how to get header? Options

Posted by craig wickesser <co...@gmail.com>.
Starting with step one I tried to get the message context....

MyStub stub = new MyStub();
HelloWorldDocument reqDoc = HellWorldDocument.Factory.newInstance();
reqDoc.setName("bob");

HelloWorldResponseDocumnet resp = stub.SayHello(reqDoc);

MessageContext mc = MessageContext.getCurrentMessageContext();
System.out.println("mesasge context: " + mc);

This prints out: "message context: null"

any ideas?

RE: Apache Axis 2: how to get header? Options

Posted by "Kang, Kamaljeet K." <Ka...@tellabs.com>.
These are the changes I did to get Response SOAP header.

1) Save header in the message context in the skeleton implementation.
       MessageContext inMsgContext = MessageContext.getCurrentMessageContext();
        OperationContext operationContext = 		inMsgContext.getOperationContext();
        MessageContext outMessageContext = operationContext .getMessageContext(WSDLConstants.MESSAGE_LABEL_OUT_VALUE);
        outMessageContext.setEnvelope(createSOAPEnvelope());
        OMNode outHeaderNode = toOM(outHeader);
       
        outMessageContext.getEnvelope().getHeader().addChild(outHeaderNode);

2)  Modified autogenerated *InOutReceiver classes to not create new Envelope if Envelope is already there in the context (modified whereever factory.getDefaultEnvelope() is called)

3) Modified Stub to save the return message context
               org.apache.axis2.context.MessageContext _returnMessageContext = _operationClient.getMessageContext(
                                           org.apache.axis2.wsdl.WSDLConstants.MESSAGE_LABEL_IN_VALUE);
                org.apache.axiom.soap.SOAPEnvelope _returnEnv = _returnMessageContext.getEnvelope();

// Added this line
_serviceClient.getServiceContext().setLastOperationContext(_operationClient.getOperationContext());


4) Finally you can get the Response Header from stub

        OperationContext oprCtxt = stub._getServiceClient().getLastOperationContext();
        MessageContext inMsgContext = oprCtxt.getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
        SOAPHeader header = inMsgContext.getEnvelope().getHeader();
      
        return Header_T.Factory.parse(header.getFirstElement().getXMLStreamReaderWithoutCaching());

Not sure if there is any easier way but finally this worked for me.

Let me know if you need more help with this.


Kamal Kang


-----Original Message-----
From: José Antonio Sánchez [mailto:getaceres@gmail.com] 
Sent: Thursday, April 19, 2007 3:56 PM
To: axis-user@ws.apache.org
Subject: Re: Apache Axis 2: how to get header? Options

AFAIK you have to modify the stub code and get headers from there. In
Axis2 1.2 there is an operation in the generated stub to get the last
operation context (and so the envelope object) but it didn't work for
me.

On 4/19/07, craig wickesser <co...@gmail.com> wrote:
> anyone???
>
>
> On 4/18/07, craig wickesser <co...@gmail.com> wrote:
> > Hi...I have a client which I am using to access a web service  The
> > code I have is...
> >
> >
> >                 MyStub stub = new MyStub();
> >                 HelloWorldDocument reqDoc =
> HellWorldDocument.Factory.newInstance();
> >                 reqDoc.setName("bob");
> >
> >
> >                 HelloWorldResponseDocumnet resp = stub.SayHello(reqDoc);
> >
> >
> > The SOAP XML response is in the following form...
> >
> >
> >                 <soap12:Envelope ....>
> >                   <soap12:Header>
> >                     <ErrorResponse ....>
> >                     </ErrorResponse>
> >                     <UserInfo ...>
> >                       <Id>string</Id>
> >                       <DOB>string</DOB>
> >                     </UserInfo>
> >                   </soap12:Header>
> >                   <soap12:Body>
> >                     <HelloWorldResponse ....>
> >                       .....
> >                     </HelloWorldResponse>
> >                   </soap12:Body>
> >                 </soap12:Envelope>
> >
> >
> > My issue is I need to get stuff from the UserInfo header....how can I
> > get that?  Currently all I can get is the HelloWorldResponse from the
> > "body".
> >
> > Thanks!
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
>
>


-- 
Saludos.
José Antonio Sánchez

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org
============================================================
The information contained in this message may be privileged
and confidential and protected from disclosure. If the reader
of this message is not the intended recipient, or an employee
or agent responsible for delivering this message to the
intended recipient, you are hereby notified that any reproduction,
dissemination or distribution of this communication is strictly
prohibited. If you have received this communication in error,
please notify us immediately by replying to the message and
deleting it from your computer. Thank you. Tellabs
============================================================

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


REUSE_HTTP_CLIENT

Posted by "Kang, Kamaljeet K." <Ka...@tellabs.com>.
Hi,

I have set REUSE_HTTP_CLIENT to 'true' in my stub but I still see from
netstat that new HTTP Connections are being created. I see connections
being reused sometimes but after 2-3 requests it creates new
connections. Do we need to do something else for persistent HTTP
connection?


Thanks

Kamal
============================================================
The information contained in this message may be privileged
and confidential and protected from disclosure. If the reader
of this message is not the intended recipient, or an employee
or agent responsible for delivering this message to the
intended recipient, you are hereby notified that any reproduction,
dissemination or distribution of this communication is strictly
prohibited. If you have received this communication in error,
please notify us immediately by replying to the message and
deleting it from your computer. Thank you. Tellabs
============================================================

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


Re: Apache Axis 2: how to get header? Options

Posted by José Antonio Sánchez <ge...@gmail.com>.
AFAIK you have to modify the stub code and get headers from there. In
Axis2 1.2 there is an operation in the generated stub to get the last
operation context (and so the envelope object) but it didn't work for
me.

On 4/19/07, craig wickesser <co...@gmail.com> wrote:
> anyone???
>
>
> On 4/18/07, craig wickesser <co...@gmail.com> wrote:
> > Hi...I have a client which I am using to access a web service  The
> > code I have is...
> >
> >
> >                 MyStub stub = new MyStub();
> >                 HelloWorldDocument reqDoc =
> HellWorldDocument.Factory.newInstance();
> >                 reqDoc.setName("bob");
> >
> >
> >                 HelloWorldResponseDocumnet resp = stub.SayHello(reqDoc);
> >
> >
> > The SOAP XML response is in the following form...
> >
> >
> >                 <soap12:Envelope ....>
> >                   <soap12:Header>
> >                     <ErrorResponse ....>
> >                     </ErrorResponse>
> >                     <UserInfo ...>
> >                       <Id>string</Id>
> >                       <DOB>string</DOB>
> >                     </UserInfo>
> >                   </soap12:Header>
> >                   <soap12:Body>
> >                     <HelloWorldResponse ....>
> >                       .....
> >                     </HelloWorldResponse>
> >                   </soap12:Body>
> >                 </soap12:Envelope>
> >
> >
> > My issue is I need to get stuff from the UserInfo header....how can I
> > get that?  Currently all I can get is the HelloWorldResponse from the
> > "body".
> >
> > Thanks!
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
>
>


-- 
Saludos.
José Antonio Sánchez

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


Re: Apache Axis 2: how to get header? Options

Posted by craig wickesser <co...@gmail.com>.
anyone???

On 4/18/07, craig wickesser <co...@gmail.com> wrote:
>
> Hi...I have a client which I am using to access a web service  The
> code I have is...
>
>                 MyStub stub = new MyStub();
>                 HelloWorldDocument reqDoc =
> HellWorldDocument.Factory.newInstance();
>                 reqDoc.setName("bob");
>
>                 HelloWorldResponseDocumnet resp = stub.SayHello(reqDoc);
>
> The SOAP XML response is in the following form...
>
>                 <soap12:Envelope ....>
>                   <soap12:Header>
>                     <ErrorResponse ....>
>                     </ErrorResponse>
>                     <UserInfo ...>
>                       <Id>string</Id>
>                       <DOB>string</DOB>
>                     </UserInfo>
>                   </soap12:Header>
>                   <soap12:Body>
>                     <HelloWorldResponse ....>
>                       .....
>                     </HelloWorldResponse>
>                   </soap12:Body>
>                 </soap12:Envelope>
>
> My issue is I need to get stuff from the UserInfo header....how can I
> get that?  Currently all I can get is the HelloWorldResponse from the
> "body".
> Thanks!
>
>
>
>