This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Web Services and the fly likes JAX-WS HTTP Binding Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "JAX-WS HTTP Binding" Watch "JAX-WS HTTP Binding" New topic
Author

JAX-WS HTTP Binding

Hany Shafik
Ranch Hand

Joined: Jun 21, 2008
Posts: 80
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

Joined: Oct 04, 2006
Posts: 2198
    
    1
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

Joined: Jun 21, 2008
Posts: 80
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

Joined: Oct 04, 2006
Posts: 2198
    
    1
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

Joined: Jun 21, 2008
Posts: 80
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

Joined: Oct 04, 2006
Posts: 2198
    
    1
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!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JAX-WS HTTP Binding
 
Similar Threads
PATH_INFO in messagecontext getting retrieved as null
SOAP binding mismatch Glassfish 2.1/JAX-WS
Can't generate java classes from WSDL file
RESTful Architecture vs. servlet Framework
Binding Endpoint to HTTPS problem