Can I load WS-Policy files in Java instead of XML?

View: New views
6 Messages — Rating Filter:   Alert me  

Can I load WS-Policy files in Java instead of XML?

by metro-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello.

I'm just starting to get into Web Services and have hit a roadblock when using WS-Policy files.  I am able to start a service with them, but I can't figure out how to configure my client to use them.

For my service, I have created a policy file ("myPolicy.xml") and loaded it into my WebService via the @PolicyAttachment and @Policy annotations.  So far so good, everything loads and deploys to my app. server properly.

I then go through the steps of building my client via wsimport.  When I try to connect to the service though, I get a fault due my client not using the policies.

How can I configure my client to use the policies specified in myPolicy.xml?  I'd like to avoid any additional XML files if possible, so I'm hoping for a way to do it by using something like the BindingProvider.

Thanks.
[Message sent by forum member 'oberiko' (oberiko)]

http://forums.java.net/jive/thread.jspa?messageID=353763

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...


Re: Can I load WS-Policy files in Java instead of XML?

by metro-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

In Metro, Client-side policies can be specified int he WSDL served by the Web Service or WSIT configuration file. In most cases, the policy defined in the wsdl should be enough.
You could use Netbeans to create WSIT configuration file which is basically a WSDL with embedded policies. You could edit it manually if needed. See http://docs.sun.com/app/docs/doc/820-1072/6ncp48v6d?a=view for details.
[Message sent by forum member 'ramapulavarthi' (ramapulavarthi)]

http://forums.java.net/jive/thread.jspa?messageID=353810

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...


Re: Can I load WS-Policy files in Java instead of XML?

by metro-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello ramapulavarthi,

The problem I'm having is that my client is not automatically picking up the policy information from the WSDL, even though they are there.  The fault I'm getting is "[b]org.jboss.ws.extensions.wsrm.RMFault: The RM Destination requires the use of WSRM[/b]".  (I built the service in JBossWS).

I'm assuming that I need to provide some kind of configuration on the client since it's not configuring itself automatically based on the WSDL.  I've seen reference to creating WSIT configuration files, but I really want to avoid having any hand-coded XML files with the exception of my policy file.

Thus, I'd like to to know if I can configure my client via the BindingProvider, or any other way that does not involve creating another XML file.  

The IDE I'm using is Eclipse.
[Message sent by forum member 'oberiko' (oberiko)]

http://forums.java.net/jive/thread.jspa?messageID=353913

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...


Re: Can I load WS-Policy files in Java instead of XML?

by metro-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

More searching, but still haven't found anything, though examples of configuring clients with policy files via code seem to exist for JBossWS, Axis 2 and Oracle (the last of which even seems to support it via annotations).  

Is this a limitation of Metro, or am I just overlooking something?
[Message sent by forum member 'oberiko' (oberiko)]

http://forums.java.net/jive/thread.jspa?messageID=354099

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...


Re: Can I load WS-Policy files in Java instead of XML?

by Harold Carr :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Metro supports policy:

On the server side by either embedding it in the WSDL (if your web service
starts from WSDL), or by a config file containing the policy (if your web
service starts from Java).  Generally, when using NetBeans, you don't even see
the policy---you just click on what you need (e.g., RM, Security) and NetBeans
generates the policy.

Likewise, on the client side, the client stack uses the policy embedded in the
WSDL.  In some cases it might be also necessary to specify some client settings
(e.g., location of keystores, RM timeouts).  In that case, NetBeans can also
generate the config files that contain the policy.

What Metro does not support at this time is a way to handle policy programmatically.

Regards,
H

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...


Re: Can I load WS-Policy files in Java instead of XML?

by Glen Mazza :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Just in case you might have missed something, take a look at the client-side configuration for Metro I've given for UsernameToken and X509 profiles:
(Item #7 in the article list here:)  http://www.jroller.com/gmazza/entry/creating_a_wsdl_first_web1#WFsitemap

If nothing, including what I did above, is working for you on JBoss, the CXF client-side configuration (same link above) does not rely on WS-Policy files, so perhaps that framework might work for you.

Glen  

metro-3 wrote:
More searching, but still haven't found anything, though examples of configuring clients with policy files via code seem to exist for JBossWS, Axis 2 and Oracle (the last of which even seems to support it via annotations).  

Is this a limitation of Metro, or am I just overlooking something?