You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by andreessen <an...@list.ru> on 2009/11/18 18:45:36 UTC
SOAP HEADERS with OpenEJB
Hi there,
Would you be so kind to help me with a problem I met.. I am currently using
Openejb to test my app during maven build and I need to send xml token in
SOAP Headers so I put it there in this way:
WSBindingProvider wsPort = (WSBindingProvider) provider;
wsPort.setOutboundHeaders(Headers.create(new
QName("http://my.service.com/", "token"),token));
Initially I tried to get it from WebServiceContext injected into my service
(@Resource WebServiceContext wctx:
String test =
wctx.getMessageContext().get(JAXWSProperties.INBOUND_HEADER_LIST_PROPERTY)
it did not help... then I created ejb handler: public class MyHandler
implements SOAPHandler<SOAPMessageContext> and I tried to extract headers
from envelope as described there:
http://www.docjar.com/html/api/org/apache/cxf/jaxws/handler/soap/SOAPMessageContextImpl.java.html
public boolean handleMessage(SOAPMessageContext context) {
SOAPHeader header = message.getSOAPPart().getEnvelope().getHeader();
LOG.log(Level.INFO, "Handler MessageContext SOAPHeader: " +
header.toString(), "");
}
..but it just empty.. - so does SOAP envelope...
Could you give me a hint what I am doing wrong and is it possible to do it
altogether?
Appreciate your help, thanks!
--
View this message in context: http://old.nabble.com/SOAP-HEADERS-with-OpenEJB-tp26412403p26412403.html
Sent from the OpenEJB User mailing list archive at Nabble.com.
Re: SOAP HEADERS with OpenEJB
Posted by Jean-Louis MONTEIRO <je...@atosorigin.com>.
Hi,
Actually, i've been upgrading to CXF 2.x.
After that, i'll have a look to your problem.
Jean-Louis
andreessen wrote:
>
> Hey, anybody here??
>
>
--
View this message in context: http://old.nabble.com/SOAP-HEADERS-with-OpenEJB-tp26412403p26891158.html
Sent from the OpenEJB User mailing list archive at Nabble.com.
Re: SOAP HEADERS with OpenEJB
Posted by andreessen <an...@list.ru>.
Hey, anybody here??
--
View this message in context: http://old.nabble.com/SOAP-HEADERS-with-OpenEJB-tp26412403p26887189.html
Sent from the OpenEJB User mailing list archive at Nabble.com.
Re: SOAP HEADERS with OpenEJB
Posted by andreessen <an...@list.ru>.
Hi people,
I would like to raise my problem cause I really need this functionality..
Thanks.
--
View this message in context: http://old.nabble.com/SOAP-HEADERS-with-OpenEJB-tp26412403p26510843.html
Sent from the OpenEJB User mailing list archive at Nabble.com.
Re: SOAP HEADERS with OpenEJB
Posted by andreessen <an...@list.ru>.
Hi Jean-Louis,
I just reworked slightly simple-webservice project do demonstrate what I
mean... Attached you could find it.
Thanks for your help.
http://old.nabble.com/file/p26436766/simple-webservice.zip
simple-webservice.zip
Jean-Louis MONTEIRO wrote:
>
> Hi,
>
> did you have a look to our simple-webservice sample?
> As far as i can remember, it contains SOAP headers.
>
> Otherwise, can you give us a bit more details or a simple test project?
>
> Jean-Louis
>
>
>
> andreessen wrote:
>>
>> Hi there,
>>
>> Would you be so kind to help me with a problem I met.. I am currently
>> using Openejb to test my app during maven build and I need to send xml
>> token in SOAP Headers so I put it there in this way:
>>
>> WSBindingProvider wsPort = (WSBindingProvider) provider;
>> wsPort.setOutboundHeaders(Headers.create(new
>> QName("http://my.service.com/", "token"),token));
>>
>> Initially I tried to get it from WebServiceContext injected into my
>> service (@Resource WebServiceContext wctx:
>>
>> String test =
>> wctx.getMessageContext().get(JAXWSProperties.INBOUND_HEADER_LIST_PROPERTY)
>>
>> it did not help... then I created ejb handler: public class MyHandler
>> implements SOAPHandler<SOAPMessageContext> and I tried to extract headers
>> from envelope as described there:
>> http://www.docjar.com/html/api/org/apache/cxf/jaxws/handler/soap/SOAPMessageContextImpl.java.html
>>
>> public boolean handleMessage(SOAPMessageContext context) {
>> SOAPHeader header = message.getSOAPPart().getEnvelope().getHeader();
>> LOG.log(Level.INFO, "Handler MessageContext SOAPHeader: " +
>> header.toString(), "");
>> }
>>
>> ..but it just empty.. - so does SOAP envelope...
>>
>> Could you give me a hint what I am doing wrong and is it possible to do
>> it altogether?
>>
>> Appreciate your help, thanks!
>>
>
>
--
View this message in context: http://old.nabble.com/SOAP-HEADERS-with-OpenEJB-tp26412403p26436766.html
Sent from the OpenEJB User mailing list archive at Nabble.com.
Re: SOAP HEADERS with OpenEJB
Posted by Jean-Louis MONTEIRO <je...@atosorigin.com>.
Hi,
did you have a look to our simple-webservice sample?
As far as i can remember, it contains SOAP headers.
Otherwise, can you give us a bit more details or a simple test project?
Jean-Louis
andreessen wrote:
>
> Hi there,
>
> Would you be so kind to help me with a problem I met.. I am currently
> using Openejb to test my app during maven build and I need to send xml
> token in SOAP Headers so I put it there in this way:
>
> WSBindingProvider wsPort = (WSBindingProvider) provider;
> wsPort.setOutboundHeaders(Headers.create(new
> QName("http://my.service.com/", "token"),token));
>
> Initially I tried to get it from WebServiceContext injected into my
> service (@Resource WebServiceContext wctx:
>
> String test =
> wctx.getMessageContext().get(JAXWSProperties.INBOUND_HEADER_LIST_PROPERTY)
>
> it did not help... then I created ejb handler: public class MyHandler
> implements SOAPHandler<SOAPMessageContext> and I tried to extract headers
> from envelope as described there:
> http://www.docjar.com/html/api/org/apache/cxf/jaxws/handler/soap/SOAPMessageContextImpl.java.html
>
> public boolean handleMessage(SOAPMessageContext context) {
> SOAPHeader header = message.getSOAPPart().getEnvelope().getHeader();
> LOG.log(Level.INFO, "Handler MessageContext SOAPHeader: " +
> header.toString(), "");
> }
>
> ..but it just empty.. - so does SOAP envelope...
>
> Could you give me a hint what I am doing wrong and is it possible to do it
> altogether?
>
> Appreciate your help, thanks!
>
--
View this message in context: http://old.nabble.com/SOAP-HEADERS-with-OpenEJB-tp26412403p26417916.html
Sent from the OpenEJB User mailing list archive at Nabble.com.
Re: SOAP HEADERS with OpenEJB
Posted by andreessen <an...@list.ru>.
Hi Jean-Louis,
Thanks a lot for your reply..
The thing is that I could not use token as a parameter for method
invocation.. I use it for SSO and it should be put into headers in the
manner I described early (something like this -
WSBindingProvider wsPort = (WSBindingProvider) provider;
wsPort.setOutboundHeaders(Headers.create(new
QName("http://my.service.com/", "token"),token));
)..
if you could add example about first way you suggested it would be great!
Appreciate your help and Merry Christmas, Happy New Year!!
Jean-Louis MONTEIRO wrote:
>
> Hi,
>
> i finally got enough time to dig into.
>
> It seems to me your are using a SUN API in the client side to add SOAP
> Headers.
> If you use a standalone client outside OpenEJB, you can definitely use
> another JAX-WS implementation (RI if you want).
>
> If you are in OpenEJB, i strongly advice to use our JAX-WS implementation
> (CXF).
>
> By the way, what is the real need?
> AFAIK, you want to add some SOAP Headers you want to recover in the server
> side.
> If i'm right, i see 2 ways to do such:
> - using a SOAP handler both in the client side and the server side. It's a
> standard way you can use with the SUN, CXF, ... API
> - using the JAX-WS annotation (@WebParam(header=true)) in the SEI. In the
> server side, you can directly access the value.
>
> In the simple-webservice sample, i used the second way (@WebParam
> annotation).
> If you need some inputs for the first one, i can definitely add it to the
> same sample.
>
> Hope it helps.
> Jean-Louis
>
>
>
>
>
> andreessen wrote:
>>
>> Hi there,
>>
>> Would you be so kind to help me with a problem I met.. I am currently
>> using Openejb to test my app during maven build and I need to send xml
>> token in SOAP Headers so I put it there in this way:
>>
>> WSBindingProvider wsPort = (WSBindingProvider) provider;
>> wsPort.setOutboundHeaders(Headers.create(new
>> QName("http://my.service.com/", "token"),token));
>>
>> Initially I tried to get it from WebServiceContext injected into my
>> service (@Resource WebServiceContext wctx:
>>
>> String test =
>> wctx.getMessageContext().get(JAXWSProperties.INBOUND_HEADER_LIST_PROPERTY)
>>
>> it did not help... then I created ejb handler: public class MyHandler
>> implements SOAPHandler<SOAPMessageContext> and I tried to extract headers
>> from envelope as described there:
>> http://www.docjar.com/html/api/org/apache/cxf/jaxws/handler/soap/SOAPMessageContextImpl.java.html
>>
>> public boolean handleMessage(SOAPMessageContext context) {
>> SOAPHeader header = message.getSOAPPart().getEnvelope().getHeader();
>> LOG.log(Level.INFO, "Handler MessageContext SOAPHeader: " +
>> header.toString(), "");
>> }
>>
>> ..but it just empty.. - so does SOAP envelope...
>>
>> Could you give me a hint what I am doing wrong and is it possible to do
>> it altogether?
>>
>> Appreciate your help, thanks!
>>
>
>
--
View this message in context: http://old.nabble.com/SOAP-HEADERS-with-OpenEJB-tp26412403p26920344.html
Sent from the OpenEJB User mailing list archive at Nabble.com.
Re: SOAP HEADERS with OpenEJB
Posted by Jean-Louis MONTEIRO <je...@atosorigin.com>.
Hi,
i finally got enough time to dig into.
It seems to me your are using a SUN API in the client side to add SOAP
Headers.
If you use a standalone client outside OpenEJB, you can definitely use
another JAX-WS implementation (RI if you want).
If you are in OpenEJB, i strongly advice to use our JAX-WS implementation
(CXF).
By the way, what is the real need?
AFAIK, you want to add some SOAP Headers you want to recover in the server
side.
If i'm right, i see 2 ways to do such:
- using a SOAP handler both in the client side and the server side. It's a
standard way you can use with the SUN, CXF, ... API
- using the JAX-WS annotation (@WebParam(header=true)) in the SEI. In the
server side, you can directly access the value.
In the simple-webservice sample, i used the second way (@WebParam
annotation).
If you need some inputs for the first one, i can definitely add it to the
same sample.
Hope it helps.
Jean-Louis
andreessen wrote:
>
> Hi there,
>
> Would you be so kind to help me with a problem I met.. I am currently
> using Openejb to test my app during maven build and I need to send xml
> token in SOAP Headers so I put it there in this way:
>
> WSBindingProvider wsPort = (WSBindingProvider) provider;
> wsPort.setOutboundHeaders(Headers.create(new
> QName("http://my.service.com/", "token"),token));
>
> Initially I tried to get it from WebServiceContext injected into my
> service (@Resource WebServiceContext wctx:
>
> String test =
> wctx.getMessageContext().get(JAXWSProperties.INBOUND_HEADER_LIST_PROPERTY)
>
> it did not help... then I created ejb handler: public class MyHandler
> implements SOAPHandler<SOAPMessageContext> and I tried to extract headers
> from envelope as described there:
> http://www.docjar.com/html/api/org/apache/cxf/jaxws/handler/soap/SOAPMessageContextImpl.java.html
>
> public boolean handleMessage(SOAPMessageContext context) {
> SOAPHeader header = message.getSOAPPart().getEnvelope().getHeader();
> LOG.log(Level.INFO, "Handler MessageContext SOAPHeader: " +
> header.toString(), "");
> }
>
> ..but it just empty.. - so does SOAP envelope...
>
> Could you give me a hint what I am doing wrong and is it possible to do it
> altogether?
>
> Appreciate your help, thanks!
>
--
View this message in context: http://old.nabble.com/SOAP-HEADERS-with-OpenEJB-tp26412403p26897659.html
Sent from the OpenEJB User mailing list archive at Nabble.com.