You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by kr...@dossier.no on 2009/06/18 11:51:57 UTC

howto read properties on server side

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()).getRequestContext()
;
    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

Re: howto read properties on server side

Posted by Daniel Kulp <dk...@apache.org>.

Hmm........   That's a very good question.  :-)     

I think the easiest might be to do:
@Resource WebServiceContext ctx;

((WrappedMessageContext)ctx.getMessageContext()).getWrappedMessage().getContextualProperty("userId");


I THINK that would do it, but I'm not 100% sure.  


Dan


On Thu June 18 2009 5:51:57 am kr@dossier.no 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()).getRequestContext()
> ;
>     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
dkulp@apache.org
http://www.dankulp.com/blog