RE: Apache Axis 2: how to get header? Options
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:[EMAIL PROTECTED] 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 <[EMAIL PROTECTED]> wrote: so far I haven't found the "parse" method. On 4/23/07, craig wickesser <[EMAIL PROTECTED]> wrote: which class should have parse method? On 4/23/07, Davanum Srinivas <[EMAIL PROTECTED] > 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 <[EMAIL PROTECTED]> wrote: > there is UserInfoImpl and UserInfoDocumentImpl. > > > > On 4/23/07, craig wickesser <[EMAIL PROTECTED]> wrote: > > yes > > > > > > > > On 4/23/07, Davanum Srinivas < [EMAIL PROTECTED] > wrote: > > > Was this UserInfo class generated by WSDL2Java/ADB? > > > > > > -- dims > > > > > > On 4/23/07, craig wickesser < [EMAIL PROTECTED]> 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... > > > > > > > > > > > > > > > > > > > > > > > > string > > > > string > > > > > > > > > > > > > > > > I have a UserInfo class which I would like to have populated with the > > > > information from the XMLis 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 > > > > > > >
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 <[EMAIL PROTECTED]> wrote: so far I haven't found the "parse" method. On 4/23/07, craig wickesser <[EMAIL PROTECTED]> wrote: which class should have parse method? On 4/23/07, Davanum Srinivas <[EMAIL PROTECTED] > 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 <[EMAIL PROTECTED]> wrote: > there is UserInfoImpl and UserInfoDocumentImpl. > > > > On 4/23/07, craig wickesser <[EMAIL PROTECTED]> wrote: > > yes > > > > > > > > On 4/23/07, Davanum Srinivas < [EMAIL PROTECTED] > wrote: > > > Was this UserInfo class generated by WSDL2Java/ADB? > > > > > > -- dims > > > > > > On 4/23/07, craig wickesser < [EMAIL PROTECTED]> 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... > > > > > > > > > > > > > > > > > > > > > > > > string > > > > string > > > > > > > > > > > > > > > > I have a UserInfo class which I would like to have populated with the > > > > information from the XMLis 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: > [EMAIL PROTECTED] > > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > > > > > > -- Davanum Srinivas :: http://wso2.org/ :: Oxygen for Web Services Developers - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - Ahhh...imagining that irresistible "new car" smell? Check outnew cars at Yahoo! Autos.
Re: Apache Axis 2: how to get header? Options
so far I haven't found the "parse" method. On 4/23/07, craig wickesser <[EMAIL PROTECTED]> wrote: which class should have parse method? On 4/23/07, Davanum Srinivas <[EMAIL PROTECTED]> 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 <[EMAIL PROTECTED]> wrote: > > there is UserInfoImpl and UserInfoDocumentImpl. > > > > > > > > On 4/23/07, craig wickesser <[EMAIL PROTECTED]> wrote: > > > yes > > > > > > > > > > > > On 4/23/07, Davanum Srinivas < [EMAIL PROTECTED] > wrote: > > > > Was this UserInfo class generated by WSDL2Java/ADB? > > > > > > > > -- dims > > > > > > > > On 4/23/07, craig wickesser < [EMAIL PROTECTED]> 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... > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > string > > > > > string > > > > > > > > > > > > > > > > > > > > I have a UserInfo class which I would like to have populated > with the > > > > > information from the XMLis 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: > > [EMAIL PROTECTED] > > > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > > > > > > > > > > > > > > > -- > Davanum Srinivas :: http://wso2.org/ :: Oxygen for Web Services > Developers > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > >
Re: Apache Axis 2: how to get header? Options
which class should have parse method? On 4/23/07, Davanum Srinivas <[EMAIL PROTECTED]> 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 <[EMAIL PROTECTED]> wrote: > there is UserInfoImpl and UserInfoDocumentImpl. > > > > On 4/23/07, craig wickesser <[EMAIL PROTECTED]> wrote: > > yes > > > > > > > > On 4/23/07, Davanum Srinivas <[EMAIL PROTECTED] > wrote: > > > Was this UserInfo class generated by WSDL2Java/ADB? > > > > > > -- dims > > > > > > On 4/23/07, craig wickesser < [EMAIL PROTECTED]> 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... > > > > > > > > > > > > > > > > > > > > > > > > string > > > > string > > > > > > > > > > > > > > > > I have a UserInfo class which I would like to have populated with the > > > > information from the XMLis 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: > [EMAIL PROTECTED] > > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > > > > > > -- Davanum Srinivas :: http://wso2.org/ :: Oxygen for Web Services Developers - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Apache Axis 2: how to get header? Options
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 <[EMAIL PROTECTED]> wrote: there is UserInfoImpl and UserInfoDocumentImpl. On 4/23/07, craig wickesser <[EMAIL PROTECTED]> wrote: > yes > > > > On 4/23/07, Davanum Srinivas <[EMAIL PROTECTED] > wrote: > > Was this UserInfo class generated by WSDL2Java/ADB? > > > > -- dims > > > > On 4/23/07, craig wickesser < [EMAIL PROTECTED]> 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... > > > > > > > > > > > > > > > > > > string > > > string > > > > > > > > > > > > I have a UserInfo class which I would like to have populated with the > > > information from the XMLis 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: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > -- Davanum Srinivas :: http://wso2.org/ :: Oxygen for Web Services Developers - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Apache Axis 2: how to get header? Options
there is UserInfoImpl and UserInfoDocumentImpl. On 4/23/07, craig wickesser <[EMAIL PROTECTED]> wrote: yes On 4/23/07, Davanum Srinivas <[EMAIL PROTECTED]> wrote: > > Was this UserInfo class generated by WSDL2Java/ADB? > > -- dims > > On 4/23/07, craig wickesser < [EMAIL PROTECTED]> 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... > > > > > > > > > > > > string > > string > > > > > > > > I have a UserInfo class which I would like to have populated with the > > information from the XMLis 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: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > >
Re: Apache Axis 2: how to get header? Options
yes On 4/23/07, Davanum Srinivas <[EMAIL PROTECTED]> wrote: Was this UserInfo class generated by WSDL2Java/ADB? -- dims On 4/23/07, craig wickesser <[EMAIL PROTECTED]> 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... > > > > > > string > string > > > > I have a UserInfo class which I would like to have populated with the > information from the XMLis 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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Apache Axis 2: how to get header? Options
Was this UserInfo class generated by WSDL2Java/ADB? -- dims On 4/23/07, craig wickesser <[EMAIL PROTECTED]> 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... string string I have a UserInfo class which I would like to have populated with the information from the XMLis 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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Apache Axis 2: how to get header? Options
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... string string I have a UserInfo class which I would like to have populated with the information from the XMLis 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
; > > > > > > > > > > > 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: [EMAIL PROTECTED] > > > > > > 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 headerhow > > 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
> > 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: [EMAIL PROTECTED] > > > > > > 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 headerhow > > 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
Yes. I was speaking on the client side. -Shaoguang Martin Gainty <[EMAIL PROTECTED]> 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 <[EMAIL PROTECTED]> 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 <[EMAIL PROTECTED]> 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 <[EMAIL PROTECTED] > 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 <[EMAIL PROTECTED] > wrote: client side On 4/20/07, robert lazarski < [EMAIL PROTECTED] > wrote: Client or server side ? On 4/20/07, craig wickesser < [EMAIL PROTECTED] > 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
I will try that out later, thanks for all the help! On 4/23/07, Thilina Gunarathne <[EMAIL PROTECTED]> 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 <[EMAIL PROTECTED]> 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 <[EMAIL PROTECTED]> 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 <[EMAIL PROTECTED]> 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. < [EMAIL PROTECTED]> 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(); > > > > > > MessageContex
Re: Apache Axis 2: how to get header? Options
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 <[EMAIL PROTECTED]> 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 <[EMAIL PROTECTED]> 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 <[EMAIL PROTECTED]> 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. < [EMAIL PROTECTED]> 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 mo
Re: Apache Axis 2: how to get header? Options
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 <[EMAIL PROTECTED]> 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 <[EMAIL PROTECTED]> 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. < [EMAIL PROTECTED]> 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: [EMAIL PROTECTED] > > > > 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
Re: Apache Axis 2: how to get header? Options
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* <[EMAIL PROTECTED] > <mailto:[EMAIL PROTECTED]>> 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. < [EMAIL PROTECTED] > <mailto:[EMAIL PROTECTED]>> 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: [EMAIL PROTECTED] > <mailto:[EMAIL PROTECTED]>] > > > > Sent: Thursday, April 19, 2007 3:56
Re: Apache Axis 2: how to get header? Options
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 <[EMAIL PROTECTED]> 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. < [EMAIL PROTECTED]> 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:[EMAIL PROTECTED] > > > 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 <[EMAIL PROTECTED]> wrote: > > > > anyone??? > > > > > > > > > > > > On 4/18/07, craig wickesser <[EMAIL PROTECTED]> 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.SayHell
Re: Apache Axis 2: how to get header? Options
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. < [EMAIL PROTECTED]> 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:[EMAIL PROTECTED] > > 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 <[EMAIL PROTECTED]> wrote: > > > anyone??? > > > > > > > > > On 4/18/07, craig wickesser <[EMAIL PROTECTED]> 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 headerhow can I > > > > get that? Currently all
Re: Apache Axis 2: how to get header? Options
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 <[EMAIL PROTECTED]> 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 <[EMAIL PROTECTED]> 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 <[EMAIL PROTECTED] > 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 <[EMAIL PROTECTED] > wrote: client side On 4/20/07, robert lazarski < [EMAIL PROTECTED] > wrote: Client or server side ? On 4/20/07, craig wickesser < [EMAIL PROTECTED] > 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
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 <[EMAIL PROTECTED]> 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 <[EMAIL PROTECTED]> 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 <[EMAIL PROTECTED] > 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 <[EMAIL PROTECTED] > wrote: client side On 4/20/07, robert lazarski < [EMAIL PROTECTED] > wrote: Client or server side ? On 4/20/07, craig wickesser < [EMAIL PROTECTED] > 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
yea so far I am not finding how to get headers from the response, am I missing something ? On 4/20/07, craig wickesser <[EMAIL PROTECTED]> 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 <[EMAIL PROTECTED]> 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 <[EMAIL PROTECTED] > wrote: > > > > client side > > > > On 4/20/07, robert lazarski < [EMAIL PROTECTED] > wrote: > > > > > > Client or server side ? > > > > > > On 4/20/07, craig wickesser < [EMAIL PROTECTED] > wrote: > > > > > > > > any ideas? > > > > > > > > > > > > >
Re: Apache Axis 2: how to get header? Options
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 <[EMAIL PROTECTED]> 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 <[EMAIL PROTECTED]> wrote: > > client side > > On 4/20/07, robert lazarski < [EMAIL PROTECTED]> wrote: > > > > Client or server side ? > > > > On 4/20/07, craig wickesser < [EMAIL PROTECTED]> wrote: > > > > > > any ideas? > > > > > > > >
Re: Apache Axis 2: how to get header? Options
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 <[EMAIL PROTECTED]> wrote: client side On 4/20/07, robert lazarski <[EMAIL PROTECTED]> wrote: > > Client or server side ? > > On 4/20/07, craig wickesser < [EMAIL PROTECTED]> wrote: > > > > any ideas? > > > >
Re: Apache Axis 2: how to get header? Options
client side On 4/20/07, robert lazarski <[EMAIL PROTECTED]> wrote: Client or server side ? On 4/20/07, craig wickesser <[EMAIL PROTECTED]> wrote: > > any ideas? >
Re: Apache Axis 2: how to get header? Options
Client or server side ? On 4/20/07, craig wickesser <[EMAIL PROTECTED]> wrote: any ideas?
Re: Apache Axis 2: how to get header? Options
any ideas?
Re: Apache Axis 2: how to get header? Options
On 4/20/07, Davanum Srinivas <[EMAIL PROTECTED]> 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. <[EMAIL PROTECTED]> 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:[EMAIL PROTECTED] > 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 <[EMAIL PROTECTED]> wrote: > > anyone??? > > > > > > On 4/18/07, craig wickesser <[EMAIL PROTECTED]> 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 headerhow 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
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
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. <[EMAIL PROTECTED]> 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:[EMAIL PROTECTED] 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 <[EMAIL PROTECTED]> wrote: > anyone??? > > > On 4/18/07, craig wickesser <[EMAIL PROTECTED]> 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 headerhow 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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] 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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Davanum Srinivas :: http://wso2.org/ :: Oxygen for Web Services Developers - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Apache Axis 2: how to get header? Options
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:[EMAIL PROTECTED] 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 <[EMAIL PROTECTED]> wrote: > anyone??? > > > On 4/18/07, craig wickesser <[EMAIL PROTECTED]> 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 headerhow 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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] 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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
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 <[EMAIL PROTECTED]> wrote: anyone??? On 4/18/07, craig wickesser <[EMAIL PROTECTED]> 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 headerhow 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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Apache Axis 2: how to get header? Options
anyone??? On 4/18/07, craig wickesser <[EMAIL PROTECTED]> 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 headerhow can I get that? Currently all I can get is the HelloWorldResponse from the "body". Thanks!
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... string string . My issue is I need to get stuff from the UserInfo headerhow can I get that? Currently all I can get is the HelloWorldResponse from the "body". Thanks!