Class SoapServiceUtils


  • public class SoapServiceUtils
    extends Object
    Class to execute methods on any remote WebService. Verify the test class SoapServiceUtilsTest for instructions on how to use it
    Author:
    José Fernández
    • Constructor Detail

      • SoapServiceUtils

        public SoapServiceUtils()
    • Method Detail

      • getPortName

        public String getPortName()
        Returns the Port name for the first service found in the WSDL file
        Returns:
        port name
      • getWsdlAddress

        public String getWsdlAddress()
        Gets the address of the remote wsdl
        Returns:
        wsdl address
      • getServiceName

        public String getServiceName()
        Returns name of the first service found in the WSDL description
        Returns:
        service name
      • getTargetNameSpace

        public String getTargetNameSpace()
        Returns Target Namespace
        Returns:
        target name space
      • parseWsdl

        public void parseWsdl​(String url)
        Parses the remote WSDL file and store its variables internally for easier access
        Parameters:
        url - Remote WSDL address
      • getAvailableSoapActions

        public Map<String,​String> getAvailableSoapActions()
        Returns a Map with all the posible SOAP operations for the the first service found in the WSDL file
        Returns:
        Map containing action name/corresponding soap action
      • executeMethodWithParams

        public String executeMethodWithParams​(String ActionName,
                                              String request,
                                              Map<String,​String> variables)
                                       throws Exception
        Alter the given XML request with the given values in the Map before executing the given method
        Parameters:
        ActionName - Action name. This name with be mapped to the corresponding SOAPAction
        request - XML message to send as string
        variables - Map describing the list of variables and the corresponding value
        Returns:
        a SOAPMessage object
        Throws:
        Exception - the exception
      • executeMethod

        public String executeMethod​(String ActionName,
                                    String request)
                             throws Exception
        Executes the given method in the remote webservice
        Parameters:
        ActionName - Action name. This name with be mapped to the corresponding SOAPAction
        request - XML message to send as string
        Returns:
        a SOAPMessage object
        Throws:
        Exception - the exception