axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Deepal Jayasinghe <dee...@opensource.lk>
Subject Re: Apache Axis 2: how to get header? Options
Date Mon, 23 Apr 2007 11:30:51 GMT
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
> <mailto:csethil@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
>     <mailto: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
>     <mailto:getaceres@gmail.com>]
>     > > > Sent: Thursday, April 19, 2007 3:56 PM
>     > > > To: axis-user@ws.apache.org <mailto: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 <codecraig@gmail.com
>     <mailto:codecraig@gmail.com>> wrote:
>     > > > > anyone???
>     > > > >
>     > > > >
>     > > > > On 4/18/07, craig wickesser <codecraig@gmail.com
>     <mailto:codecraig@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
>     <mailto:axis-user-unsubscribe@ws.apache.org>
>     > > > For additional commands, e-mail:
>     axis-user-help@ws.apache.org <mailto: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
>     <mailto:axis-user-unsubscribe@ws.apache.org>
>     > > > For additional commands, e-mail:
>     axis-user-help@ws.apache.org <mailto: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
>     <mailto:axis-user-unsubscribe@ws.apache.org>
>     > > For additional commands, e-mail: axis-user-help@ws.apache.org
>     <mailto: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
>     <mailto:axis-user-unsubscribe@ws.apache.org>
>     For additional commands, e-mail: axis-user-help@ws.apache.org
>     <mailto:axis-user-help@ws.apache.org>
>
>


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


Mime
View raw message