10 Replies Latest reply on Aug 28, 2013 1:56 AM by aupres

    [org.apache.cxf.ws.rm.RMInInterceptor] (default task-57) WS-ReliableMessaging is required by this endpoint.

    aupres

      With WildFly Alpha 4, I try to implement Java Web Service.

      This is my Web Services Interface,

       

      import javax.jws.WebMethod;
      import javax.jws.WebParam;
      import javax.jws.WebResult;
      import javax.jws.WebService;
      import javax.jws.soap.SOAPBinding;
      import javax.jws.soap.SOAPBinding.ParameterStyle;
      import javax.jws.soap.SOAPBinding.Style;
      import javax.jws.soap.SOAPBinding.Use;
      import javax.xml.ws.soap.Addressing;

      import org.jboss.ws.api.annotation.PolicySets;

      @WebService(
      name="HelloWorldPort",
      portName="com.aaa.ws.IHelloWorld",
      serviceName="HelloWorldService",
      targetNamespace="http://www.aaa.com")
      @SOAPBinding(style=Style.DOCUMENT, use=Use.LITERAL, parameterStyle=ParameterStyle.BARE)
      @Addressing(enabled=true, required=false)
      @PolicySets({"WS-RM_Policy_spec_example", "WS-SP-EX223_WSS11_Anonymous_X509_Sign_Encrypt"})
      public interface IHelloWorld {

      @WebMethod(operationName="callNameMethod")
      @WebResult(name="helloEcho")
      public String sayHello(@WebParam(name="helloName", mode=WebParam.Mode.IN) String name);
      }

       

      Deployment is successful, But When calling ws interface, Exception is thrown

       

      [org.apache.cxf.ws.rm.RMInInterceptor] (default task-57) WS-ReliableMessaging is required by this endpoint.

       

      Pls, I need your advice!

        • 1. Re: [org.apache.cxf.ws.rm.RMInInterceptor] (default task-57) WS-ReliableMessaging is required by this endpoint.
          aupres

          @PolicySets annotation generate WS-POLICY wsdl files successfully. But Invoking endpoint interface throws exception  without @Address annotation(WS-ADDRESS) and even with @Address annotation I can't call endpoint interface because of "WS-ReliableMessaging is required by this endpoint" exception.

          I think WS-ReliableMessaging related annotation is to be developeded to invoke endpoint interface of web service with @PolicySets successfully like @Addressing(enabled=true, required=false) annotation.

          • 2. Re: [org.apache.cxf.ws.rm.RMInInterceptor] (default task-57) WS-ReliableMessaging is required by this endpoint.
            aupres

            In the https://docs.jboss.org/author/display/JBWS/WS-Policy doc, jbossws-cxf-client.jar file have to be included into my project. But I can't find the file in the <wildfly-8.0.0.Alpha4_HOME>\modules\system\layers\base\org\jboss\ws\cxf\jbossws-cxf-client\main folder.

            Where can I get jar file?

            • 3. Re: [org.apache.cxf.ws.rm.RMInInterceptor] (default task-57) WS-ReliableMessaging is required by this endpoint.
              asoldano

              You can find that jar in modules/system/layers/base/org/jboss/ws/jaxws-client/main

              • 4. Re: [org.apache.cxf.ws.rm.RMInInterceptor] (default task-57) WS-ReliableMessaging is required by this endpoint.
                aupres

                Thank you for your reply, Alessio.

                I use Eclipse IDE to deploy above web service endpoint interface. SEI is successfully deployed and wsdl file with <wsp:Policy> element is generated well.

                 

                The problem is that I have no idea what to do with jbossws-cxf-client-4.2.0.Final.jar in Eclipse IDE.

                Up to now I follow this ref. site, http://docs.jboss.org/tools/archive/3.1.0.GA/en/ws_ref_guide/html/client.html to generate ws client code.

                It had worked well until now, but wsdl with <ws-polocy> does not seem to be applied to ws-client codes. The client-code throws many types of exception.

                How can I generate correct client-codes from the wsdl with ws-policy element? I need any ref site or sample codes.

                 

                Pls, help! Thanks in advance.

                • 5. Re: [org.apache.cxf.ws.rm.RMInInterceptor] (default task-57) WS-ReliableMessaging is required by this endpoint.
                  asoldano

                  Hi Joseph,

                  can you clarify the situation a bit, so that I better understand? So, you have your endpoint (annotated with @PolicySets) properly published? Does the published wsdl contain the ws policies you'd expect?

                  • 6. Re: [org.apache.cxf.ws.rm.RMInInterceptor] (default task-57) WS-ReliableMessaging is required by this endpoint.
                    aupres

                    First I make Service Endpoint Interface like below,

                     

                    package com.aaa.ws;

                     

                    import javax.jws.WebMethod;
                    import javax.jws.WebParam;
                    import javax.jws.WebResult;
                    import javax.jws.WebService;
                    //import javax.xml.ws.soap.Addressing;

                     

                    import org.jboss.ws.api.annotation.PolicySets;

                     

                    @WebService
                    //@Addressing(enabled=true, required=false)
                    @PolicySets({"WS-RM_Policy_spec_example", "WS-SP-EX223_WSS11_Anonymous_X509_Sign_Encrypt", "WS-Addressing"})
                    public interface IHelloWorld {

                    @WebMethod
                    @WebResult
                    public String sayHello(@WebParam String name);
                    }

                     

                    ,and deploy it on eclipse IDE

                    policy_1.jpg

                    policy_2.jpg

                     

                    Deployment is successful. The wsdl is generated successfully. The console shows the messages :

                     

                    19:49:11,763 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-2) JBAS015876: Starting deployment of "WSHelloWorldEAR.ear" (runtime-name: "WSHelloWorldEAR.ear")
                    19:49:11,904 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-7) JBAS015876: Starting deployment of "null" (runtime-name: "WSHelloWorld.war")
                    19:49:13,635 INFO  [org.jboss.ws.cxf.metadata] (MSC service thread 1-1) JBWS024061: Adding service endpoint metadata: id=HelloWorld
                    address=http://localhost:8080/WSHelloWorld/HelloWorld
                    implementor=com.aaa.ws.HelloWorld
                    serviceName={http://ws.aaa.com/}HelloWorldService
                    portName={http://ws.aaa.com/}HelloWorldPort
                    annotationWsdlLocation=null
                    wsdlLocationOverride=null
                    mtomEnabled=false
                    19:49:13,886 INFO  [org.apache.cxf.service.factory.ReflectionServiceFactoryBean] (MSC service thread 1-1) Creating Service {http://ws.aaa.com/}HelloWorldService from class com.aaa.ws.IHelloWorld
                    19:49:14,369 INFO  [org.jboss.ws.cxf] (MSC service thread 1-1) JBWS024092: Adding BINDING policy attachment with id='WS-RM_Policy_spec_example_binding_policy' to honor requirement from interface com.aaa.ws.IHelloWorld.
                    19:49:14,369 INFO  [org.jboss.ws.cxf] (MSC service thread 1-1) JBWS024092: Adding BINDING policy attachment with id='WS-SP-EX223_binding_policy' to honor requirement from interface com.aaa.ws.IHelloWorld.
                    19:49:14,369 INFO  [org.jboss.ws.cxf] (MSC service thread 1-1) JBWS024092: Adding BINDING policy attachment with id='WS-Addressing_binding_policy' to honor requirement from interface com.aaa.ws.IHelloWorld.
                    19:49:14,369 INFO  [org.jboss.ws.cxf] (MSC service thread 1-1) JBWS024092: Adding BINDING_OPERATION_INPUT policy attachment with id='WS-SP-EX223_Binding_Operation_Input_Policy' to honor requirement from interface com.aaa.ws.IHelloWorld.
                    19:49:14,369 INFO  [org.jboss.ws.cxf] (MSC service thread 1-1) JBWS024092: Adding BINDING_OPERATION_OUTPUT policy attachment with id='WS-SP-EX223_Binding_Operation_Output_Policy' to honor requirement from interface com.aaa.ws.IHelloWorld.
                    19:49:14,697 INFO  [org.apache.cxf.endpoint.ServerImpl] (MSC service thread 1-1) Setting the server's publish address to be http://localhost:8080/WSHelloWorld/HelloWorld
                    19:49:14,823 INFO  [org.jboss.ws.cxf.deployment] (MSC service thread 1-1) JBWS024074: WSDL published to: file:/C:/wildfly-8.0.0.Alpha4/standalone/data/wsdl/WSHelloWorldEAR.ear/WSHelloWorld.war/HelloWorldService.wsdl
                    19:49:14,870 INFO  [org.jboss.as.webservices] (MSC service thread 1-3) JBAS015539: Starting service jboss.ws.endpoint."WSHelloWorldEAR.ear"."WSHelloWorld.war".HelloWorld
                    19:49:15,197 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-8) JBAS018210: Register web context: /WSHelloWorld
                    19:49:15,291 INFO  [org.jboss.as.server] (DeploymentScanner-threads - 1) JBAS018559: Deployed "WSHelloWorldEAR.ear" (runtime-name : "WSHelloWorldEAR.ear")

                     

                    But the problem is generating web service client codes from the wsdl which contains WS-Policy. I try to generate the client codes with Web Service Client Wizard of eclipse ide.

                    policy_3.jpg

                    policy_4.jpg

                    policy_5.jpg

                    The client codes from the Web Service Client Wizard seems not to be applied by WS-Policy annotation.

                    The below client code throws many types of exceptions.

                     

                    HelloWorldService service = new HelloWorldService();
                    IHelloWorld port = service.getHelloWorldPort();
                    out.println(port.sayHello("Joseph"));

                     

                    Is there any option which make the WS client wizard generate correct client codes with WS-Policy?

                     

                    I need your help!

                    • 7. Re: [org.apache.cxf.ws.rm.RMInInterceptor] (default task-57) WS-ReliableMessaging is required by this endpoint.
                      aupres

                      Hi, Alessio!

                      I used SoapUI to check the soap message generated from the wsdl file. But soap message was not affected by the WS-Policy annotation.

                      And it throws the same exceptions.

                      • 8. Re: [org.apache.cxf.ws.rm.RMInInterceptor] (default task-57) WS-ReliableMessaging is required by this endpoint.
                        asoldano

                        Joseph, that's (unfortunately) the expected behaviour. The @PolicySets stuff is a replacement for the need of manually setting policies on server side. The tooling will generate a basic jaxws client for you. So once you have that client you need to configure it properly; that would mean e.g. providing the ws-security props, there's no way the tool can guess where you have that on client side, which usernames to use, etc. Below is a partial example:

                        ((BindingProvider)proxy).getRequestContext().put(SecurityConstants.CALLBACK_HANDLER, new KeystorePasswordCallback());
                        ((BindingProvider)proxy).getRequestContext().put(SecurityConstants.SIGNATURE_PROPERTIES, Thread.currentThread().getContextClassLoader().getResource("META-INF/alice.properties"));
                        ((BindingProvider)proxy).getRequestContext().put(SecurityConstants.ENCRYPT_PROPERTIES, Thread.currentThread().getContextClassLoader().getResource("META-INF/alice.properties"));
                        ((BindingProvider)proxy).getRequestContext().put(SecurityConstants.SIGNATURE_USERNAME, "alice");
                        ((BindingProvider)proxy).getRequestContext().put(SecurityConstants.ENCRYPT_USERNAME, "bob");
                        

                         

                        Consider having a look at e.g. org.jboss.test.ws.jaxws.samples.wsse.policy.oasis.WSSecurityPolicyExamples22xTestCase which has a client of endpoint using the same policy you get with "WS-SP-EX223_WSS11_Anonymous_X509_Sign_Encrypt",

                        and/or reference the documentation at https://docs.jboss.org/author/display/JBWS/JBoss+Web+Services+Documentation (e.g. https://docs.jboss.org/author/display/JBWS/WS-Security for ws-security stuff).

                        • 9. Re: [org.apache.cxf.ws.rm.RMInInterceptor] (default task-57) WS-ReliableMessaging is required by this endpoint.
                          aupres

                          Thank you, Alessio

                          • 10. Re: [org.apache.cxf.ws.rm.RMInInterceptor] (default task-57) WS-ReliableMessaging is required by this endpoint.
                            aupres

                            Hi, Alessio !

                            According to your advice, I generate client codes and it works well.

                            How about the server-side signature and encryption? Does org.jboss.ws.api.annotation.EndpointConfig annotation take a part in encryption?

                            I added org.jboss.ws.api.annotation.EndpointConfig annotation like below, but it seemed not to work.

                             

                            @WebService
                            @EndpointConfig(configFile = "WEB-INF/jaxws-endpoint-config.xml", configName = "Custom WS-Security Endpoint")
                            public class HelloWorld implements IHelloWorld {

                            ....

                             

                            It threw the following exception,

                             

                            Context Path:  /WSSHelloWorld

                            Servlet Path: /index.jsp

                            Path Info: null

                            Query String: null

                            Stack Trace

                            org.apache.jasper.JasperException: javax.xml.ws.soap.SOAPFaultException: Cannot encrypt data

                            org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:409)

                            org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:321)


                            Pls, check https://community.jboss.org/thread/231901.

                            I also need your advice this time.