我是SOAP webservices的新手,我得到了一个由WSDL,.xsd文件组成的文件夹。并要求使用终点网址。 “https://abc-bus-dev.xyz.org/service/admin/Update/v”,从WSDL我能够为身体部分创建代理类,但是从信封到身体我在wsdl中看不到任何东西。当我与他们核实时,他们要求创建一个自定义标题。我不知道如何使用名称空间创建客户标头。您也可以告诉我如何将标题添加到正文并形成XML并发送请求和接收响应。任何人都可以指导我,这样我就可以相应地工作并继续前进。我真的处境艰难,我正在vb.net中编写代码 肥皂请求如下所示:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ser="http://testing.testing.ws.testing.com/">
<soapenv:Header>
<wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
<wsse:UsernameToken wsu:Id="UsernameToken-1" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
<wsse:Username>Testing</wsse:Username>
<wsse:Password>123456</wsse:Password>
</wsse:UsernameToken>
</wsse:Security>
</soapenv:Header>
<soapenv:Body>
<trans:Method1>
<!--Optional:-->
<com:UserinfoId>123456</com:UserinfoId>
<sub:params>
<!--Optional:-->
<name>Testing</name>
<!--Optional:-->
<value>98765-45678</value>
</sub:params>
</trans: Method1 >
答案 0 :(得分:0)
右键单击vb.net项目并选择add - &gt;服务参考。它将生成调用Web服务所需的类。
然后你像这样调用webservice。将ServiceReference1替换为您为服务命名的内容。将SoapClient替换为名称服务客户端
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles ButtonOK.Click
Close()
End Sub
Private Sub CheckBox1_CheckedChanged(sender As Object, e As EventArgs) Handles CheckBox1.CheckedChanged
ButtonOK.Enabled = CheckBox1.Checked
End Sub
Private Sub Form1_KeyDown(sender As Object, e As KeyEventArgs) Handles MyBase.KeyDown
If e.Alt AndAlso e.KeyCode = Keys.X Then
CheckBox1.Checked = True
ButtonOK.PerformClick()
End If
End Sub
Private Sub Form1_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
e.Cancel = Not CheckBox1.Checked
End Sub
您发布的网址无法公开访问,因此我无法向其添加服务参考