0

내가 헤더를 통과하려면 어떻게 동적으로dynamicserviceproxy

string[] assemblyReferences = new string[3] { "System.Web.Services.dll", "System.Xml.dll", "Microsoft.Web.Services3.dll" }; 
     CompilerParameters parms = new CompilerParameters(assemblyReferences); 
     CompilerResults results = provider1.CompileAssemblyFromDom(parms, unit1); 

     if (results.Errors.Count > 0) 
     { 
      foreach (CompilerError oops in results.Errors) 
      { 
       Console.WriteLine("========Compiler error============"); 
       Console.WriteLine(oops.ErrorText); 
      } 
      return; 
     }   


     //Invoke the web service method 
     object o = results.CompiledAssembly.CreateInstance("DynamicServiceProxy.servicename"); 
     //object o = results.CompiledAssembly.CreateInstance("DynamicServiceProxy.WebService"); 

     Type t = o.GetType(); 
     BindingFlags bf = BindingFlags.Public | BindingFlags.InvokeMethod | BindingFlags.Instance | BindingFlags.DeclaredOnly; 

     MethodInfo m = t.GetMethod("Methodname", bf); 
    stroutput = (string) m.Invoke(o, new object[]..... 

<soapenv:Header> 
    <wsse:Security soapenv:actor="AppID" soapenv:mustUnderstand="1" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"> 
    <wsse:UsernameToken> 
     <wsse:Username>domain1\UNM1</wsse:Username> 
     <wsse:Password wsse:Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">PWD1</wsse:Password> 
    </wsse:UsernameToken> 
    </wsse:Security> 

내가 프록시를 만드는 오전 같은 WSSE 헤더를 필요로이 서비스를 사용하려고로 WSSE 보안 헤더 전달 이에. 몇 가지 조사를 수행하고 WSE 3.0을 설치하고 service3에 대한 참조를 추가했습니다. 그러나 나는 RequestSoapContext 또는 t에서 clientcredential 메서드를 얻을 수 없습니다. 클라이언트 (o)는 WebServicesClientProtocol이 아닌 soaphttpclientprotocol에서 생성되며 모든 문제점의 원인이되어야합니다. 도와주세요.

 MessageServiceWse client = new MessageServiceWse() 

이 또한 내가 WSSE 유형에 대한 확실하지 않다처럼

또한 동적 프록시를 생성하기 때문에, 확실하지 내가 할 수 있습니다. 이것을 정의하는 방법. 방금 ​​VS 2010을 사용하고 있음을 유의하십시오.

이것은 첫 번째 서비스 경험이므로 제게 실수를해서 실례합니다. 전문가의 도움이 필요합니다.

답변

0

요청에 따라 일반적으로 헤더가 포함되도록 엔드 포인트를 변경했습니다.

<endpoint address="https://wsext.test.com/gfr/ext/test1/" 
    binding="basicHttpBinding" bindingConfiguration="GLEditServiceSOAP" 
    contract="test1.GLEditServicePort" name="GLEditServicePort"> 

    <headers > 
     <wsse:Security s:actor="AppID" s:mustUnderstand="1" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"> 
     <wsse:UsernameToken> 
      <wsse:Username>test1\testuserid</wsse:Username> 
      <wsse:Password wsse:Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">password</wsse:Password> 
     </wsse:UsernameToken> 
     </wsse:Security> 
    </headers> 
    </endpoint> 
+0

동적 프록시가 없습니다. 웹 참조로 추가하고 헤더를 포함하도록 web.config를 변경했습니다. – Purvin