项目作者: kylewolfe

项目描述 :
soaptrip is an HTTP Transport wrapper for parsing SOAP Faults
高级语言: Go
项目地址: git://github.com/kylewolfe/soaptrip.git
创建时间: 2015-05-20T20:26:26Z
项目社区:https://github.com/kylewolfe/soaptrip

开源协议:

下载


soaptrip Build Status Coverage Status GoDoc

soaptrip is an HTTP Transport wrapper for parsing SOAP Faults

Usage

  1. // create a client
  2. c := &http.Client{Transport: soaptrip.DefaultSoapTrip}
  3. // make a call that can respond with a SOAP Fault
  4. resp, err := c.Post("http://localhost/soap/login", "text/xml", soapEnvelopeReader)
  5. if err != nil {
  6. log.Println(err.Error()) // Post http://localhost/soap/login: FaultCode: 'faultcode' FaultString: 'fault string'
  7. // resp will always == nil if err != nil, however, you can retrieve the original resp
  8. urlError := err.(*url.Error)
  9. switch urlError.Err.(type) {
  10. case *soaptrip.SoapFault:
  11. resp = urlError.Err.Response
  12. default:
  13. // this is not a soap fault error
  14. }
  15. }