3
오징어 프록시에서 WSDL을 사용하여 프로그래밍 방식으로 WebService를 사용하는 데 문제가 있습니다. 내 응용 프로그램은 C# .net으로 작성됩니다. 내가 방법 호출 (OBJ, 인수)를 호출 할 때프로그래밍 방식으로 웹 서비스 프록시 클래스의 프록시 자격 증명
// a namespace and compile unit are needed by importer
CodeNamespace codeNamespace = new CodeNamespace();
CodeCompileUnit codeUnit = new CodeCompileUnit();
codeUnit.Namespaces.Add(codeNamespace);
ServiceDescriptionImportWarnings importWarnings = descriptionImporter.Import(codeNamespace, codeUnit);
if (importWarnings == 0) // no warnings
{
// create a c# compiler
CodeDomProvider compiler = CodeDomProvider.CreateProvider("CSharp");
// include the assembly references needed to compile
string[] references = new string[2] { "System.Web.Services.dll", "System.Xml.dll" };
CompilerParameters parameters = new CompilerParameters(references);
// compile into assembly
CompilerResults results = compiler.CompileAssemblyFromDom(parameters, codeUnit);
foreach (CompilerError oops in results.Errors)
{
// trap these errors and make them available to exception object
throw new Exception("Compilation Error Creating Assembly");
}
// all done....
return results.CompiledAssembly;
}
else
{
// warnings issued from importers, something wrong with WSDL
throw new Exception("Invalid WSDL");
}
문제는 : 나는 수입 후 XML에서이를 사용하여 서비스 descripton를 어셈블리를 컴파일합니다. 프록시는 외부 주소를 사용하여 WSDL을 호출하는 경우 연결을 끊습니다 (예 : http://My_external_ip/my_webService.asmx). 내부 주소를 사용하여 전화하면 정상적으로 작동합니다. 나는 webReference를 추가 할 때
수동, 내가 좋아하는 몇 가지 일을하는 데 사용 :
WebService WS = new WebService();
WS.Proxy = Proxy.credentials;
그것을 작업,하지만 난 곳 총회를 사용할 때 프록시 자격 증명을 제공하는 찾을 수 없습니다.
감사합니다.
I는이 질문의 DUP이라고 생각 : http://stackoverflow.com/questions/289601/connecting-to-an-asmx-webservice-with-wcf-through-a-proxy – ryber
CustomBinding을 app.config에 추가하려고 시도했지만 작동하지 않았습니다. 해당 게시물에서 필요한 인증은 웹 서비스 또는 SQUID 프록시로 인증하는 것입니까? – Varois