Class SOAPTool


  • public class SOAPTool
    extends java.lang.Object
    SOAP toolbox
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String SOAP_NS  
      static java.lang.String WSSE_NS  
      static java.lang.String WSU_NS  
    • Method Summary

      Modifier and Type Method Description
      static java.lang.String getSoapRequest​(java.lang.String namespacePrefix, java.lang.String namespace, java.lang.String method, java.lang.String header, java.lang.String request)
      Builds SOAP request
      static org.w3c.dom.NodeList getSoapResponse​(java.lang.String soapResponse, java.lang.String encoding)
      Extract response as DOM node from raw SOAP response.
      static org.json.JSONObject getSoapResponseAsJSONObject​(java.lang.String soapResponse)
      Extract response as a JSONObject from raw SOAP response.
      static java.lang.String objectSoapRequest​(ObjectDB obj, java.lang.String method, java.lang.String request, java.lang.String username, java.lang.String password)
      Execute object SOAP request.
      static java.lang.String simpleSoapRequest​(java.lang.String namespacePrefix, java.lang.String namespace, java.lang.String method, java.lang.String header, java.lang.String request, java.lang.String endpointURL, java.lang.String username, java.lang.String password, int timeout)
      Execute simple generic SOAP request.
      static java.lang.String soapFault​(java.lang.String message, java.lang.String url)  
      static java.lang.String soapFooter()  
      static java.lang.String soapHeader()  
      static java.lang.String soapHeader​(java.lang.String[] namespacePrefixes, java.lang.String[] namespaces, java.lang.String header, boolean wsse)  
      static java.lang.String soapHeader​(java.lang.String namespacePrefix, java.lang.String namespace)  
      static java.lang.String soapHeader​(java.lang.String securityTokenId, java.lang.String certificateType, java.lang.String certificate)  
      static java.lang.String soapHeader​(java.lang.String securityTokenId, java.lang.String user, java.lang.String password, boolean hashedPassword)  
      static java.lang.String soapWSSEHeader​(java.lang.String securityTokenId, java.lang.String user, java.lang.String password, boolean hashedPassword, java.lang.String certificateType, java.lang.String certificate)  
      static java.lang.String wsdlFooter()  
      static java.lang.String wsdlHeader​(java.lang.String tns, java.lang.String xmlns)  
      static java.lang.String wsdlMessages​(java.lang.String method)  
      static java.lang.String wsdlOperation​(java.lang.String method)  
      static java.lang.String wsdlOperationBinding​(java.lang.String method)  
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • soapWSSEHeader

        public static java.lang.String soapWSSEHeader​(java.lang.String securityTokenId,
                                                      java.lang.String user,
                                                      java.lang.String password,
                                                      boolean hashedPassword,
                                                      java.lang.String certificateType,
                                                      java.lang.String certificate)
      • soapHeader

        public static java.lang.String soapHeader()
      • soapHeader

        public static java.lang.String soapHeader​(java.lang.String namespacePrefix,
                                                  java.lang.String namespace)
      • soapHeader

        public static java.lang.String soapHeader​(java.lang.String securityTokenId,
                                                  java.lang.String user,
                                                  java.lang.String password,
                                                  boolean hashedPassword)
      • soapHeader

        public static java.lang.String soapHeader​(java.lang.String securityTokenId,
                                                  java.lang.String certificateType,
                                                  java.lang.String certificate)
      • soapHeader

        public static java.lang.String soapHeader​(java.lang.String[] namespacePrefixes,
                                                  java.lang.String[] namespaces,
                                                  java.lang.String header,
                                                  boolean wsse)
      • soapFooter

        public static java.lang.String soapFooter()
      • wsdlHeader

        public static java.lang.String wsdlHeader​(java.lang.String tns,
                                                  java.lang.String xmlns)
      • wsdlFooter

        public static java.lang.String wsdlFooter()
      • wsdlMessages

        public static java.lang.String wsdlMessages​(java.lang.String method)
      • wsdlOperation

        public static java.lang.String wsdlOperation​(java.lang.String method)
      • wsdlOperationBinding

        public static java.lang.String wsdlOperationBinding​(java.lang.String method)
      • soapFault

        public static java.lang.String soapFault​(java.lang.String message,
                                                 java.lang.String url)
      • getSoapRequest

        public static java.lang.String getSoapRequest​(java.lang.String namespacePrefix,
                                                      java.lang.String namespace,
                                                      java.lang.String method,
                                                      java.lang.String header,
                                                      java.lang.String request)
                                               throws java.lang.Exception

        Builds SOAP request

        Parameters:
        namespacePrefix - Name space prefix (e.g. "q0")
        namespace - Name space (e.g. "http://localhost/vptws/User")
        method - SOAP method to call
        header - raw XML custom header
        request - raw XML body request
        Returns:
        SOAP XML request
        Throws:
        java.lang.Exception
      • simpleSoapRequest

        public static java.lang.String simpleSoapRequest​(java.lang.String namespacePrefix,
                                                         java.lang.String namespace,
                                                         java.lang.String method,
                                                         java.lang.String header,
                                                         java.lang.String request,
                                                         java.lang.String endpointURL,
                                                         java.lang.String username,
                                                         java.lang.String password,
                                                         int timeout)
                                                  throws java.lang.Exception
        Execute simple generic SOAP request.
        Parameters:
        namespacePrefix - Name space prefix (e.g. "q0")
        namespace - Name space (e.g. "http://localhost/simplicitews/User")
        method - SOAP method to call
        header - SOAP header (optional, put null if no header required)
        request - SOAP body (main request)
        endpointURL - User name for BASIC HTTP authentication (optional, put null if no authentication required)
        username - User name for BASIC HTTP authentication (optional, put null if no authentication required)
        password - Password for BASIC HTTP authentication (optional, put null if no authentication required)
        timeout - Timeout in seconds (<=0 means no timeout)
        Returns:
        SOAP XML response
        Throws:
        java.lang.Exception
      • getSoapResponse

        public static org.w3c.dom.NodeList getSoapResponse​(java.lang.String soapResponse,
                                                           java.lang.String encoding)
                                                    throws java.lang.Exception
        Extract response as DOM node from raw SOAP response.
        Parameters:
        soapResponse - Raw SOAP response
        encoding - Response encoding
        Returns:
        response DOM node list
        Throws:
        java.lang.Exception - if SOAP fault encountered in response
      • getSoapResponseAsJSONObject

        public static org.json.JSONObject getSoapResponseAsJSONObject​(java.lang.String soapResponse)
        Extract response as a JSONObject from raw SOAP response.
        Parameters:
        soapResponse - Raw SOAP response
      • objectSoapRequest

        public static java.lang.String objectSoapRequest​(ObjectDB obj,
                                                         java.lang.String method,
                                                         java.lang.String request,
                                                         java.lang.String username,
                                                         java.lang.String password)
                                                  throws java.lang.Exception
        Execute object SOAP request.
        Parameters:
        obj - Object
        method - SOAP object method to call
        request - SOAP XML request
        username - User name for BASIC HTTP authentication (required)
        password - Password for BASIC HTTP authentication (required)
        Returns:
        SOAP XML response
        Throws:
        java.lang.Exception