C#-wcf Web服务需要使用soap头传递用户名/密码令牌来连接SOA Web服务。如何改变肥皂头?

时间:2012-11-08 07:36:03

标签: c# wcf soap soa

我有一个WCF网络服务。在那里我需要利用SOA Web服务。我用WSDL文件创建了Reference.cs。一切似乎都很好,但SOA服务期望自定义标头与令牌包括用户名\密码。 SOA团队只提供了用户名\密码来传入标题。现在如何更改SOAP标头以在c#wcf中传递身份验证令牌?

这是SOA期望SOAP内容

<message>
<properties>
<property  name="tracking.compositeInstanceId"  value="160008"/>
<property  name="tracking.ecid"  value="ef41c1acc87d807b:47c8a7e5:13aba83ab3c:-8000-000000000006d79c"/>
<property  name="transport.http.remoteAddress"  value="10.100.21.228"/>
</properties>
<headers>
<header>
<wsse:Security  soap:mustUnderstand="1">
<wsse:UsernameToken  wsu:Id="UsernameToken-njZlxs5jA9tMZ9zdXhHIaw212">
<wsse:Username>meuser</wsse:Username>
<wsse:Password  Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">welcome123</wsse:Password>
</wsse:UsernameToken>
</wsse:Security>
</header>
</headers>
<parts>
<part  name="request">
<ns1:DoT_GIS_Inbound_Input>
<ns1:InterfaceID>DOT_CRM_GIS_SBL_003</ns1:InterfaceID>
<ns1:ContactFirstName>Fname</ns1:ContactFirstName>
<ns1:ContactLastName>LName</ns1:ContactLastName>
<ns1:ComplaintType>Parking</ns1:ComplaintType>
<ns1:RequestType>Complaint Request</ns1:RequestType>
<ns1:Phone>5555555</ns1:Phone>
<ns1:ReportedDate>12\12\2012</ns1:ReportedDate>
<ns1:UniqueID>ddffketto7878998</ns1:UniqueID>
<ns1:Email>anji@yahoo.com</ns1:Email>
<ns1:Description>description text</ns1:Description>
</ns1:DoT_GIS_Inbound_Input>
</part>
</parts>
</message>

我的WCF服务方法如下

public string CreateComplaintInCRM(string TYPE, string DESCRIPTION, string DATE_REPORTED, string EMAIL, string Phone, string Contact_Name, string UNIQUE_ID, string Contact_SName)
     {

                CRMCreateComplaint.DoT_GIS_Inbound_Input crmCreateObj = new CRMCreateComplaint.DoT_GIS_Inbound_Input();
                CRMCreateComplaint.execute_pttClient exeRec = new CRMCreateComplaint.execute_pttClient();

                crmCreateObj.InterfaceID = "DOT_CRM_GIS_SBL_003"; // CRM setting 
                crmCreateObj.RequestType = "Complaint Request"; //// CRM setting 
                crmCreateObj.ComplaintType = TYPE;//compalint type
                crmCreateObj.ContactFirstName = Contact_Name;
                crmCreateObj.ContactLastName = Contact_SName;
                crmCreateObj.Description = DESCRIPTION;
                crmCreateObj.Email = EMAIL;
                crmCreateObj.UniqueID = UNIQUE_ID;
                crmCreateObj.Phone = Phone;
                crmCreateObj.ReportedDate = DATE_REPORTED;

                //string COMPLAINTREFID = exe.execute(crmCreateObj);

                exeRec.execute(crmCreateObj);
                return "Referece ID:";
            }

我在处理WS-Security安全标头时遇到InvalidSecurity:错误。

C#中的任何SOA开发人员都有同样的问题吗? 非常感谢您的帮助和指导。

我已经删除了很多文档和文章而没有正确的帮助

0 个答案:

没有答案