2 Replies Latest reply on Jul 14, 2009 9:35 AM by oberiko

    Streamlined tutorial on JBossWS w/ policies (WS-RM)?

    oberiko

      Hello,

      I'm relatively new to Web Services (only done very simple clients) and I've been struggling to get a WS-RM service/client up for a few days now. Part of the problem is that I'm seeing many, many different ways on how this is done, to the point that I'm not sure what the "correct" way is.

      The service part is, thanks to the @Policy annotations, seemingly very simple for me to set up:
      Service

      package com.webService;
      
      import javax.jws.WebService;
      
      import org.jboss.ws.extensions.policy.PolicyScopeLevel;
      import org.jboss.ws.extensions.policy.annotation.Policy;
      import org.jboss.ws.extensions.policy.annotation.PolicyAttachment;
      
      @PolicyAttachment
      (
       @Policy
       (
       policyFileLocation = "WEB-INF/wsrm-exactly-once-in-order-policy.xml",
       scope = PolicyScopeLevel.WSDL_BINDING
       )
      )
      @WebService
      public class Reliable {
       public String echo(String parameter){
       return "You reliably passed the string '"+parameter+"'";
       }
      }
      


      configuration XML file
      <?xml version="1.0" encoding="UTF-8"?>
      <wsp:Policy
       wsu:Id="exactly_one_in_order_rm_delivery"
       xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy"
       xmlns:wsrmp="http://docs.oasis-open.org/ws-rx/wsrmp/200702"
       xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
       <wsrmp:DeliveryAssurance>
       <wsp:Policy>
       <wsrmp:ExactlyOnce/>
       <wsrmp:InOrder/>
       </wsp:Policy>
       </wsrmp:DeliveryAssurance>
      </wsp:Policy>
      


      Now, I'm stuck. I gather that I need to somehow configure my client to use RM ("The RM Destination requires the use of WSRM" is the message I'm getting), but I am uncertain how to optimally do this.

      Client
      public void testReliable(){
       Reliable port = new ReliableService().getReliablePort();
      
       //I need some stuff here it seems
      
       port.echo("a test message");
      }
      

      Could someone provide me with the simplest guidelines I need to follow that would work? I should mention that one of my goals is keep the XML configuration to an absolute minimum, centralizing as much as possible within the application itself.

      Thanks to anyone who can help me out.