File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JAX-WS HTTP Binding

 
Hany Shafik
Ranch Hand
Posts: 80
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a question related to JAX-WS and their support for HTTP Binding. I think you can specify the Binding type (either SOAP or HTTP binding ) by annotating your SEI
with BindingType.
So in order to declare HTTP Binding I will use @BindingType(HTTPBinding.HTTP_BINDING). However this annotation only works when I have my class implements Provider interface instead.
I guess it is tedious to work with such low level API. I would like to see it working similar to SOAP Binding.
So my question is it legal to annotate my Web Service class with @BindingType(HTTPBinding.HTTP_BINDING) when it doesn't implement provider interface.
I checked the JAX-WS specification I couldn't find any rules that mandate such behavior.
Any ideas.
 
Ivan Krizsan
Ranch Hand
Posts: 2198
1
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi!
The @BindingType annotation is usually used in conjunction with the @ServiceMode annotation, like in the following example:


The @ServiceMode annotation in the example above is used to indicate that your endpoint implementation class wants to process the entire message. When using SOAP, you are not usually interested in the entire message, but just the payload (the contents of the SOAP body).
In section 5.1.2 of the JAX-WS specification, one can read the following:
The ServiceMode annotation is used to configure the messaging mode of a Provider instance.


However, I cannot either find anything that explicitly prohibits you from annotating an endpoint implementation class annotated with the @WebService annotation with the @BindingType(HTTPBinding.HTTP_BINDING) annotation.
Have you tried to implement an endpoint implementation class annotated with the @WebService and @BindingType(HTTPBinding.HTTP_BINDING) annotations?
Best wishes!
 
Hany Shafik
Ranch Hand
Posts: 80
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes I have already tried it, I deployed it on Glassfish v2.1 and I got the following error

I also tried deploying it on Jboss 4.2.3 and I got the following strange error

I guess may be many application server doesn't support HTTP Binding.
 
Ivan Krizsan
Ranch Hand
Posts: 2198
1
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi!
Well, as indicated in the JAX-WS specifications that I wrote about in the previous answer, I guess it is only possible to use the HTTP binding in connection to a endpoint implementation class that implements the Provider interface and that is annotated with the @WebServiceProvider annotation.
The application server does support HTTP binding, since I have developed such a web service in my SCDJWS 5 study notes in section 9.4 and deployed it to GlassFish v2.1. However, as before, only in combination with the Provider interface and the @WebServiceProvider interface.
Best wishes!
 
Hany Shafik
Ranch Hand
Posts: 80
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Ivan.
Just to recap it is only permissible to have HTTP Binding when you have an implementation class that implements Provider interface. However the specification didn't mandate such behavior explicitly. Am I correct ?
 
Ivan Krizsan
Ranch Hand
Posts: 2198
1
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi!
Hany Shafik wrote:Thanks Ivan.
Just to recap it is only permissible to have HTTP Binding when you have an implementation class that implements Provider interface. However the specification didn't mandate such behavior explicitly. Am I correct ?

Yes, given your research, it does seem that you are correct.
...and no, I do not find anything explicit in the JAX-WS specification that disallows using HTTP binding with an endpoint implementation class annotated with @WebService.
In this case, I have also learned something new, as I have never tried this particular setup.
Best wishes!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic