Hm.,
This does not help either,
Message wrappedMessage = ((WrappedMessageContext)ctx.getMessageContext
()).getWrappedMessage();
EndpointInfo endpointInfo = wrappedMessage.getExchange().get
(EndpointInfo.class);
-> endpointInfo is NULL, maybe its why getContextutalPropery() returns
null.,
On client side:
OrganisationService ss = new OrganisationService();
OrganisationServicePortType port = ss.getOrganisationServicePort();
Map<String, Object> requestContext = (
(BindingProvider)ss.getOrganisationServicePort()).getRequestContext();
requestContext.put("userId","2325");
requestContext.put("ownerId","2325");
After putting thease values, i get:
requestContext.defaultScope: APPLICATION
requestContext.exchange: null // how do i set exchange on client side?
requestContext.message:
{userId=2325,
org.apache.cxf.message.Message.ENDPOINT_ADDRESS=http://localhost:
9090/integration-web/organisationService, ownerId=2325,
org.apache.cxf.jaxws.context.WrappedMessageContext.SCOPES=
{org.apache.cxf.message.Message.ENDPOINT_ADDRESS=APPLICATION,
userId=APPLICATION, ownerId=APPLICATION}}
requestContext.scopes:
{org.apache.cxf.message.Message.ENDPOINT_ADDRESS=APPLICATION,
userId=APPLICATION, ownerId=APPLICATION}
On server side:
@Resource WebServiceContext ctx;
Message wrappedMessage = ((WrappedMessageContext)ctx.getMessageContext
()).getWrappedMessage();
EndpointInfo endpointInfo = wrappedMessage.getExchange().get
(EndpointInfo.class);
endpointInfo --> is null, and i cant get
get also null on wrappedMessage.getContextualProperty("userId");
----- Opprinnelig melding -----
Fra: Daniel Kulp <[email protected]>
Til: [email protected]
Kopi: [email protected]
Dato: Tue, 23 Jun 2009 09:49:41 -0400
Emne: Re: howto read properties on server side
> On Tue June 23 2009 3:59:19 am [email protected] wrote:
> > Thank you for replay Dan,
> >
> > This seems to not work, i get Null after this line:
> > > ((WrappedMessageContext)ctx.getMessageContext()).getWrappedMessage().getC
> > >on textualProperty("userId");
> >
> > After debugging, there are no Map on class WrappedMessageContext that
> > contains the key userId
>
> That is why the call to getContextualProperty instead of just get. The
> getContextualProperty search through a hiearchy of places to find the
> value.
> In this case,
> getWrappedMessage().getExchange().get(EndpointInfo.class).get("user-
id")
> MAY
> do it, but getContextutalPropery() should accomplish it.
>
> Dan
>
> > any other sugestions will be aprissiated..
> >
> > - Karan
> >
> >
> > ----- Opprinnelig melding -----
> > Fra: Daniel Kulp <[email protected]>
> > Til: [email protected]
> > Dato: Fri, 19 Jun 2009 10:54:47 -0400
> > Emne: Re: howto read properties on server side
> >
> > > Hmm........ That's a very good question. :-)
> > >
> > > I think the easiest might be to do:
> > > @Resource WebServiceContext ctx;
> > >
> > > ((WrappedMessageContext)ctx.getMessageContext()).getWrappedMessage().getC
> > >on textualProperty("userId");
> > >
> > >
> > > I THINK that would do it, but I'm not 100% sure.
> > >
> > >
> > > Dan
> > >
> > > On Thu June 18 2009 5:51:57 am [email protected] wrote:
> > > > Hello,
> > > >
> > > > On each request i want some properties to be sent by client, (I dont
> > > > want to include thease on operations as parameter)
> > > > How do i handle this on server side?
> > > >
> > > > I have following on beans.xml:
> > > >
> > > > <jaxws:endpoint id="userService"
> > > > implementor="UserServiceImpl"
> > > > address="/userService">
> > > >
> > > > <jaxws:properties >
> > > > <entry key="userId" value="1234" />
> > > > <entry key="ownerId" value="1234"/>
> > > > </jaxws:properties>
> > > >
> > > > </jaxws:endpoint>
> > > >
> > > > <!-- not sure if i need this -->
> > > > <jaxws:client id="userClient" createdFromAPI="true"
> > > >
> > > >
serviceClass="no.dossier.ws.integration.service.user.UserService">
> > > > <jaxws:properties >
> > > > <entry key="userId" value="1234" />
> > > > <entry key="ownerId" value="1234"/>
> > > > </jaxws:properties>
> > > >
> > > > </jaxws:client>
> > > >
> > > >
> > > > client.java:
> > > >
> > > > service = new userService();
> > > > port = service.userServicePort();
> > > > Map<String, Object> requestContext =
> > > > ((BindingProvider)service.getOrganisationServicePort()).getRequestConte
> > > >xt() ;
> > > > requestContext.put("userId","2325");
> > > > requestContext.put("ownerId","2325");
> > > >
> > > > How do i read thease properties on server side`? do i have to implement
> > > > some interceptors ?
> > > >
> > > > Thanx,
> > > >
> > > > Regards,
> > > > Karan
> > >
> > > --
> > > Daniel Kulp
> > > [email protected]
> > > http://www.dankulp.com/blog
>
> --
> Daniel Kulp
> [email protected]
> http://www.dankulp.com/blog