このように C# で定義されている AuthenticateUser() という SOAP メソッドがあります。
[WebMethod(Description = "Returns a token string given a username and password.")]
[System.Web.Services.Protocols.SoapHeader(nameof(AuthenticationHeader))]
public AuthenticationResponse AuthenticateUser()
{
...
}
ここで、AuthenticationHeader はタイプです
public SecuredAuthenticationSoapHeader AuthenticationHeader;
このメソッドを呼び出してトークンを取得しようとしているので、トークンを使用して Web サービスの他のメソッドを呼び出すことができます。
SOAP-UI でこの呼び出しを行うと、XML は次のようになります
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:web="https://www.example.com/webservices">
<soap:Header>
<web:SecuredAuthenticationSoapHeader>
<web:UserName>myusername</web:UserName>
<web:Password>mypassword</web:Password>
</web:SecuredAuthenticationSoapHeader>
</soap:Header>
<soap:Body>
<web:AuthenticateUser/>
</soap:Body>
</soap:Envelope>
ただし、またはを使用してPowerSHellでこれを行うにはどうすればよいですInvoke-WebRequest
かNew-WebServiceProxy
? SOAP-UI と同じように XML を渡す方法はありますか?