I managed to get a Provider-Dispatch example working in Axis, and I think I 
found the issue - Axis does not like the @wsdlLocation attribute on the 
Provider web service. 

In order to facilitate dispatching a request to a Provider web service, Axis 
adds a dummy operation to a Provider service : 

/**
     * The name of a special operation added to EndpointInterfaceDescriptions 
for provider 
     * endpoints that do not specify WSDL, and therefore do not have specific 
WSDL operations
     * created. Note that this is currently only supported for HTTP bindings, 
not for SOAP bindings.
     */
    public static String JAXWS_NOWSDL_PROVIDER_OPERATION_NAME     = 
"jaxwsNoWSDLProviderOperation";

However, as stated in the comments, if you provide the @wsdlLocation attribute 
to the Web Service, this operation does not get added to the Provider service. 
Therefore incoming requests are not dispatched properly to the service (see 
GenericProviderDispatcher).

I managed to fix this in the source code,and also fixed 2 issues related to 
displaying the WSDL for a Provider-type service (see email below).

I'm no expert on the JAX-WS spec, but my understanding is that the user should 
be allowed to specify a WSDL for a Provider-type web service. By doing so, the 
user indicates the structure of the XML messages the web service can process. 
It is the client's responsibility to ensure the incoming request is compliant 
with the WSDL. 

By making a few small changes, we can make this work in Axis too. Pls. let me 
know what you think.  













--- On Thu, 2/26/09, sharath reddy <[email protected]> wrote:

> From: sharath reddy <[email protected]>
> Subject: Issue with Provider-based Jax-ws service and Wsdl
> To: [email protected]
> Date: Thursday, February 26, 2009, 5:24 AM
> Hi, 
> 
> I'm having trouble trying to deploy a Provider-based
> web service: 
> 
> @WebServiceProvider(
>               portName="SamplePort",
>               serviceName="SampleProvider",
>               targetNamespace="http://sample.org";,
>               wsdlLocation="META-INF/provider.wsdl"
> )
> @BindingType(value=SOAPBinding.SOAP11HTTP_BINDING)
> @ServiceMode(value=javax.xml.ws.Service.Mode.PAYLOAD)
> 
> public class SampleProvider implements
> Provider<Source>{ ... 
> 
> I have provided a WSDL file at the location indicated above
> (WsdlLocation).
> 
> When I query the service with the '?wsdl'
> parameter, I want to see the WSDL above, and NOT generate
> the WSDL from the annotated class. In any case, we can't
> generate a WSDL from a Provider class since the class does
> not contain port type and operation information. 
> 
> In order to do so, I had to make the following 2 changes:
> 1. In order to display the user-provided WSLD, I had to
> hack this method in AxisService to always return TRUE, since
> I am not using services.xml file, need to come up with a way
> to handle this for JAX-WS services.
> 
>    /**
>      * User can set a parameter in services.xml saying he
> want to show the
>      * original wsdl that he put into META-INF once someone
> ask for ?wsdl so if
>      * you want to use your own wsdl then add following
> parameter into
>      * services.xml <parameter
> name="useOriginalwsdl">true</parameter>
>      */
>        public boolean isUseUserWSDL() {
>               
>               System.out.println("isUseUserWSDL: returning
> true");
>               return true;
>               
>               /*Parameter parameter =
> getParameter("useOriginalwsdl");
>               if (parameter != null) {
>                       String value = (String) parameter.getValue();
>                       if ("true".equals(value)) {
>                               return true;
>                       }
>               }
>               return false;*/
>       }
> 
> 
> 2. If accessing user-defined WSDL, the run-time tries to
> retrieve the WSDL from an Axis parameter called 
> WSDLConstants.WSDL_4_J_DEFINITION. Since this parameter is
> not being populated for JAx-WS services, I had to modify 
> the code to stuff it in there. Currently, its a bit of a
> hack:
> 
> In DescriptionFactory.createAxisService() :
> 
>     ServiceDescriptionImpl serviceDescriptionImpl = 
>               (ServiceDescriptionImpl) serviceDescription;
>             
>    Definition definition =
> serviceDescriptionImpl.getWSDLDefinition();
>    if (definition != null)
>      
> axisService.addParameter(WSDLConstants.WSDL_4_J_DEFINITION,
> definition);
> 
> 
> Is there anything I am doing wrong? Are there any working
> examples of using Provider-type web services in Axis2? 
> 
> Regards,
> Sharath


      

Reply via email to