
scalut.xml.soap.SoapClient.scala Maven / Gradle / Ivy
The newest version!
package scalut
package xml.soap
import javax.xml.soap.{SOAPConnectionFactory, SOAPConstants, SOAPMessage}
import com.thoughtworks.xstream.io.HierarchicalStreamDriver
import scalut.xml.soap.Implicits._
import scalut.xml.soap.SoapHelper._
import scala.xml.NamespaceBinding
/**
* Created by vladimir on 29.11.16.
*/
object SoapClient {
def call(soapMessage: SOAPMessage, endpoint: String): SOAPMessage = {
SOAPConnectionFactory.newInstance().createConnection() using { connection =>
connection.call(soapMessage, endpoint)
}
}
def call[T](body: T, endpoint: String, soapAction: String, soapProtocol: String = SOAPConstants.DEFAULT_SOAP_PROTOCOL,
envelopeNS: collection.Seq[NamespaceBinding] = DEFAULT_BINDINGS,
driver: HierarchicalStreamDriver = null): SOAPMessage = {
SOAPConnectionFactory.newInstance().createConnection() using { connection =>
connection.call(body.toSoapMessage(soapAction, soapProtocol, envelopeNS, driver), endpoint)
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy