Home Page › Forums › BizTalk 2004 – BizTalk 2010 › Passing username/password to published asmx orchestration › Re: Passing username/password to published asmx orchestration
So is message(SOAP.Username) only used to set the username when calling a SOAP service, or can it be used to receive a username?
I’m trying this type of code in C# to pass the SOAP username, but haven’t got it yet.
The following looks like it is setting WSE username, not SOAP username.
I added the “exists” to check if SOAP.Username is coming to orchestration, and it’s not.
System.Net.HttpWebRequest request =
(System.Net.HttpWebRequest)System.Net.WebRequest.Create(
“http://localhost/MyOrchestrations_Proxy/ImagingInterfaceLoanDataPull.asmx“);
string strSOAPRequestBody =
“<soap:Envelope xmlns:xsi=\”http://www.w3.org/2001/XMLSchema-instance\” xmlns:xsd=\”http://www.w3.org/2001/XMLSchema\” xmlns:soap=\”http://schemas.xmlsoap.org/soap/envelope/\“>” +
“<soap:Header>” +
“<wsse:Security xmlns:wsse=\”http://schemas.xmlsoap.org/ws/2002/07/secext\“>” +
” <wsse:UsernameToken>” +
” <wsse:Username>AUSER</wsse:Username>” +
” <wsse:Password Type=\”wsse:PasswordText\”>APassword</wsse:Password>” +
” </wsse:UsernameToken>” +
“</wsse:Security>” +
“</soap:Header>” +
“<soap:Body>” +
“<PortLoanDataPull xmlns=\”http://thornburgmortgage.com/mortgagecadence/webservice/\“>” +
” <LoanDataPull>” +
” <LoanID>” + strCenlarLoanId + “</LoanID>” +
” </LoanDataPull>” +
“</PortLoanDataPull>” +
“</soap:Body>” +
“</soap:Envelope>”;
request.Method = “POST”;
//request.ContentType = “application/soap+xml; charset=utf-8”;
request.ContentType = “text/xml; charset=utf-8”;
request.ContentLength = strSOAPRequestBody.Length;
System.IO.StreamWriter streamWriter = new System.IO.StreamWriter( request.GetRequestStream() );
streamWriter.Write( strSOAPRequestBody );
streamWriter.Close();
System.IO.StreamReader streamReader = new System.IO.StreamReader(
request.GetResponse().GetResponseStream() );
string strResponse = “”;
while (!streamReader.EndOfStream)
{
strResponse += streamReader.ReadLine();
}
streamReader.Close();