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