EAP7.0.0_DevelopingWebServicesApplications.pdf

Createwsdlurl servicename actasserviceiface proxy

This preview shows page 165 - 168 out of 178 pages.

Service service = Service.create(wsdlURL, serviceName); ActAsServiceIface proxy = (ActAsServiceIface) service.getPort(ActAsServiceIface.class); Bus bus = BusFactory.newInstance().createBus(); try { BusFactory.setThreadDefaultBus(bus); Map<String, Object> ctx = proxy.getRequestContext(); ctx.put(SecurityConstants.CALLBACK_HANDLER, new ClientCallbackHandler()); ctx.put(SecurityConstants.ENCRYPT_PROPERTIES, Thread.currentThread().getContextClassLoader().getResource( "META-INF/clientKeystore.properties" )); ctx.put(SecurityConstants.ENCRYPT_USERNAME, "myactaskey" ); ctx.put(SecurityConstants.SIGNATURE_PROPERTIES, Thread.currentThread().getContextClassLoader().getResource( "META-INF/clientKeystore.properties" )); ctx.put(SecurityConstants.SIGNATURE_USERNAME, "myclientkey" ); // Generate the ActAs element contents and pass to the STSClient as a string UsernameTokenCallbackHandler ch = new UsernameTokenCallbackHandler(); String str = ch.getUsernameTokenString( "alice" , "clarinet" ); ctx.put(SecurityConstants.STS_TOKEN_ACT_AS, str); STSClient stsClient = new STSClient(bus); Map<String, Object> props = stsClient.getProperties(); props.put(SecurityConstants.USERNAME, "bob" ); props.put(SecurityConstants.CALLBACK_HANDLER, new ClientCallbackHandler()); props.put(SecurityConstants.ENCRYPT_PROPERTIES, Thread.currentThread().getContextClassLoader().getResource( "META-INF/clientKeystore.properties" )); props.put(SecurityConstants.ENCRYPT_USERNAME, "mystskey" ); props.put(SecurityConstants.STS_TOKEN_USERNAME, "myclientkey" ); props.put(SecurityConstants.STS_TOKEN_PROPERTIES, Thread.currentThread().getContextClassLoader().getResource( "META-INF/clientKeystore.properties" )); props.put(SecurityConstants.STS_TOKEN_USE_CERT_FOR_KEYINFO, "true" ); ctx.put(SecurityConstants.STS_CLIENT, stsClient); } finally { bus.shutdown( true ); } proxy.sayHello(); CHAPTER 3. DEVELOPING JAX-WS WEB SERVICES 161
Image of page 165

Subscribe to view the full document.

APPENDIX A. REFERENCE MATERIAL A.1. JAX-RS/RESTEASY ANNOTATIONS Table A.1. JAX-RS/RESTEasy Annotations Annotation Usage ContentEncoding Meta annotation that specifies a Content- Encoding to be applied via the annotated annotation. DecorateTypes Must be placed on a DecoratorProcessor class to specify the supported types. Decorator Meta-annotation to be placed on another annotation that triggers decoration. Form This can be used as a value object for incoming/outgoing request/responses. StringParameterUnmarshallerBinder Meta-annotation to be placed on another annotation that triggers a StringParameterUnmarshaller to be applied to a string based annotation injector. Cache Set response Cache-Control header automatically. NoCache Set Cache-Control response header of nocache . ClientInterceptor Identifies an interceptor as a client-side interceptor. ServerInterceptor Identifies an interceptor as a server-side interceptor. Red Hat JBoss Enterprise Application Platform 7.0 Developing Web Services Applications 162
Image of page 166
NoJackson Placed on class, parameter, field or method when you don’t want the Jackson provider to be triggered.
Image of page 167

Subscribe to view the full document.

Image of page 168
  • Spring '17
  • azmat fatma
  • mime, Resteasy, Red Hat JBoss, Enterprise Application Platform

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern