Hi,
I am constructing a Web Service client to interact with a service
provided by a partner organisation, but without any success so far.
The SOAP message expected by the server is (with the username and
password blanked out, of course):
<soap:Envelop e xmlns:soap="htt p://schemas.xmlsoap .org/soap/envelope/"
xmlns:wsu="http ://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
<soap:Header>
<wsse:Securit y soap:mustUnders tand="1"
xmlns:wsse="htt p://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"
xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"
xmlns:env="http ://schemas.xmlsoap .org/soap/envelope/">
<wsse:UsernameT oken>
<wsse:Username> ******</wsse:Username>
<wsse:Passwor d
Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0
#PasswordText"> ******</wsse:Password>
</wsse:UsernameTo ken>
</wsse:Security>
</soap:Header>
<soap:Body xmlns:ns1="http ://www.slc.co.uk/course/schema/1.0">
<ns1:qualificat ionsListRequest >
<schemaVersion> 1.0</schemaVersion>
</ns1:qualificati onsListRequest>
</soap:Body>
</soap:Envelope>
I'm using Visual Studio 2005 with WSE, and have created a policy file
(wse3policyCach e.config) as follows, again with the username and
password blanked out:
<policies xmlns="http://schemas.microso ft.com/wse/2005/06/policy">
<extensions>
<extension name="usernameO verTransportSec urity"
type="Microsoft .Web.Services3. Design.Username OverTransportAs sertion,
Microsoft.Web.S ervices3, Version=3.0.0.0 , Culture=neutral ,
PublicKeyToken= 31bf3856ad364e3 5" />
<extension name="username"
type="Microsoft .Web.Services3. Design.Username TokenProvider,
Microsoft.Web.S ervices3, Version=3.0.0.0 , Culture=neutral ,
PublicKeyToken= 31bf3856ad364e3 5" />
<extension name="requireAc tionHeader"
type="Microsoft .Web.Services3. Design.RequireA ctionHeaderAsse rtion,
Microsoft.Web.S ervices3, Version=3.0.0.0 , Culture=neutral ,
PublicKeyToken= 31bf3856ad364e3 5" />
</extensions>
<policy name="credentia ls">
<usernameOverTr ansportSecurity >
<clientToken>
<username username="***** *" password="***** *" />
</clientToken>
</usernameOverTra nsportSecurity>
<requireActionH eader />
</policy>
</policies>
The proxy, generated using wsdl.exe because the partner site will not
allow access to the wsdl file directly, contains the following:
public partial class qualificationsL istRequest {
private decimal schemaVersionFi eld;
public qualificationsL istRequest() {
this.schemaVers ionField = ((decimal)(1.0m ));
}
/// <remarks/>
[System.Xml.Seri alization.XmlEl ementAttribute( Form=System.Xml .Schema.XmlSche maForm.Unqualif ied)]
public decimal schemaVersion {
get {
return this.schemaVers ionField;
}
set {
this.schemaVers ionField = value;
}
}
}
I then attempt to call the Web service method from my code as follows:
private void SlcHeiDbWSTest_ Load(object sender, EventArgs e)
{
CourseServices service = new CourseServices( );
try
{
qualificationsL istResponse quals =
service.getQual ificationsList( new qualificationsL istRequest());
}
catch (Exception ex)
{
MessageBox.Show ("There was an unexplained exception: " +
ex.Message);
}
finally
{
service = null;
}
}
The server replies with an error (contents of the Exception message):
"WSDoAllReceive r: security processing failed (actions mismatch)"
I don't know whether that implies that I've authorised correctly or not,
so I'm waiting for that info from our partner organisation. Either way,
I feel a bit short of knowledge because I can't actually see the SOAP
message that VS is constructing and sending.
Is it possible to inspect the SOAP message sent from a .NET Web Service
client? If so, how is it done?
And, on the other hand, can anyone see any mistakes in what I'm doing?
Thanks
Peter