Thursday 22 October 2015

What different files are generated by wsimport Command in Soap Web Service


wsimport -keep -verbose  <WSDL>  -Xnocompile

-keep -  > keep java files............
-verbose -> display the files on the console
-Xnocompile -> we do not need classes 

1. ALL JAXB classes(POJO,ObjectFactory,package-info) against your XSD.
  JAXB- Java API for XML Binding

   XML Binding - means conversion of java object into xml and xml into java object

2. Service Endpoint Interface (SEI)
    Interface against PortType define inside WSDL.
    This will  be used to expose the web service to the consumer and consumer can access       the web service using this interface.
    
    This service end point interface will  be used to define/implement the provider in case
    of top down web service.
    


 @WebService(name = "ConsultantWebService", targetNamespace = "http://www.consultants.com/it")
@SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
@XmlSeeAlso({
    ObjectFactory.class
})
public interface ConsultantWebService {


    /**
     * 
     * @param pconsultant
     * @return
     *     returns java.lang.String
     * @throws ConsultantFaultMessageException
     */
    @WebMethod
    @WebResult(name = "sresponse", targetNamespace = "http://www.consultants.com/it", partName = "presponse")
    public String uploadConsultant(
        @WebParam(name = "consultantRequest", targetNamespace = "http://www.consultants.com/it", partName = "pconsultant")
        Consultant pconsultant)
        throws ConsultantFaultMessageException
    ;

}
    

3.  a class with  service name define inside the WSDL

see below WSDL content

<wsdl:service name="ConsultantWebServiceService">
      <wsdl:port name="ConsultantWebServicePort" binding="tns:ConsultantWebServiceBinding">
<soap:address location="http://localhost:5050/soap-mobile-app/consultantProvider"/>            
      </wsdl:port>

</wsdl:service>


ConsultantWebServiceService.class

@WebServiceClient(name = "ConsultantWebServiceService", targetNamespace = "http://www.consultants.com/it", 
wsdlLocation = "file:/D:/NEW_WORKSPACE/workspace_java/soap-mobile-app/src/main/webapp/WEB-INF/wsdl/synergisticit-consultants.wsdl")
public class ConsultantWebServiceService
    extends Service

{

}

This is used by  consumer to consume the web service.....

ConsultantWebServiceService consultantWebServiceService
=new ConsultantWebServiceService();

ConsultantWebService consultantWebService=consultantWebServiceService.getConsultantWebServicePort();




    

No comments:

Post a Comment