2012-11-06 4 views
0

C# 클라이언트를 사용하여 Delphi로 작성된 RemObjects SDK SOAP 서버에 연결하고 있습니다. 나는 초기 로그인을 할 수 있지만, 후속 요청은 다음과 같습니다 사용자 정의 SOAP 헤더 필요합니다C#을 사용하여 SOAP 요청에 사용자 지정 헤더를 추가하려면 어떻게해야합니까?

<SOAP-ENV:Header SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:NS1="urn:MyAPI"> 
    <NS1:ROClientIDHeader xsi:type="NS1:ROClientIDHeader"> 
     <ID xsi:type="xsd:string">{3EC5A9DF-C6DC-4BFB-8134-37DDCF07910D}</ID> 
    </NS1:ROClientIDHeader> 
    </SOAP-ENV:Header> 

내 기존의 코드는 다음과 같습니다 : 나는에 사용자 정의 헤더를 추가하려면 어떻게

using System.Data; 
using System.Drawing; 
using System.Linq; 
using System.Text; 
using System.Windows.Forms; 

namespace WindowsFormsApplication1 
{ 
    public partial class MainForm : Form 
    { 
     public MainForm() 
     { 
      InitializeComponent(); 
     } 

     private void button1_Click(object sender, EventArgs e) 
     { 
      // Create a new instance of the login service 
      MyLibrary.LoginServiceClient LoginClient = new MyLibrary.LoginServiceClient(); 

      // Call the Login method on the server 
      MyLibrary.TLoginInfo LoginInfo = LoginClient.Login("Administrator", "master", 0, 0, MyLibrary.TClientType.ctWindowsClient); 

      // Set the Session ID 
      var SessionID = LoginInfo.SessionId; 

      // Create a new instance of the Utils service 
      MyLibrary.UtilsClient UtilsClient = new MyLibrary.UtilsClient(); 

      // Set the SOAP header // 
      // <SOAP-ENV:Header SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:NS1="urn:EasyIPv6API"> 
      // <NS1:ROClientIDHeader xsi:type="NS1:ROClientIDHeader"> 
      //  <ID xsi:type="xsd:string">{3EC5A9DF-C6DC-4BFB-8134-37DDCF07910D}</ID> 
      // </NS1:ROClientIDHeader> 
      // </SOAP-ENV:Header> 

      // Make the call 
      var AddResult = UtilsClient.AddValues(1, 1); 
     } 
    } 
} 

을 의뢰? 저는 현재 C#을 전혀 모르고 있습니다.

+0

비슷한 질문 여기 - http://stackoverflow.com/a/1246829/1045728 –

답변

0

이후 요청에 Soap Header가 필요하면 UtilsClient는 사용자가 설정할 수있는 SoapHeaderValue처럼 공개 된 속성을 가져야합니다.

+0

그게 내가 기대했던 것입니다,하지만 그것은 – norgepaul

관련 문제