我正在尝试对SSRSReporting SOAP服务进行SOAP调用,并以XML格式接收SOAP响应。我正在尝试使用go-wsdl来生成SSRS SOAP API,但它似乎在Go中“无效”。我想用go-wsdl列出孩子们。下面的代码返回一个空响应。
package main
import ssrs "ssrs/myservice"
import "fmt"
//curl http://172.16.1.249/ReportServer/ListChildren -n -v --ntlm -u viewpointops\\dustinf.7C49
func main() {
fmt.Print("gucci\n")
client := ssrs.NewSOAPClient("http://$HOST/ReportServer/ReportService2010.asmx", true, &ssrs.BasicAuth{Login: "$USER", Password: "$PASSWORD"})
resp := ssrs.ListChildrenResponse{}
err := client.Call("ListChildren", ssrs.ListChildren{ ItemPath: "/VCS/Custom/", Recursive: true }, resp)
fmt.Println(err)
fmt.Println("%v", resp)
}
我在想,也许我不理解SOAP及它是什么,但也知道当我尝试在curl中复制请求时,它没有返回我希望它返回的XML响应。
curl http://$HOST/ReportServer/ReportService2010.asmx -n -v --ntlm -u $USER -H "Content-Type: text/xml; charset=utf-8" -H "SOAPAaction: ListChildren" --data '<Envelope xmlns="http://schemas.xmlg/soap/envelope/"><Body xmlns="http://schemas.xmlsoap.org/soap/envelope/"><ListChildren xmlns="http://schemas.microsoft.com/sqlserver/reporting/2010/03/01/ReportServer"><ItemPath>/VCS/Custom/</ItemPath><Recursive>true</Recursive></ListChildren></Body></Envelope>' -H "Accept: text/xml; charset=utf-8" -H "User-Agent: PHP/SOAP"
我收到此回复:
<html>
<head>
<meta name="Generator" content="Microsoft SQL Server Reporting Services Version 11.0.6251.0">
<title>172.16.1.249/ReportServer - /</title>
</head>
<body><H1>172.16.1.249/ReportServer - /</H1><hr>
<pre> Thursday, December 12, 2013 4:04 PM <dir> <A HREF="?%2fVCS&rs:Command=ListChildren">VCS</A>
</pre><hr>
Microsoft SQL Server Reporting Services Version 11.0.6251.0
</body>
</html>
我真的希望以SOAP XML格式返回响应,因此我可以使用SOAP解析器。我尝试了Accept Header,但那不起作用。我主要是因为我不知道还有什么可以尝试的。如果没有,我想我可以解析HTML版本,但重点是使用wsdl生成的代码并使用SOAP接口。
谢谢!