2016-10-24 2 views
0

Autodesk Revit addin 만들기. SOAP 웹 서비스와 통화 할 수 있기를 원합니다.Revit Addin Visual Studio 호출 SOAP 웹 서비스

addin은 클래스 라이브러리로 생성됩니다. SOAP 클라이언트 코드는 Visual Studio Service Reference를 사용하고 wsdl url을 가리켜 생성됩니다. 내가 REVIT에서 추가 기능을 실행하면

나는

REVIT가 System.InvalidOperationException 발생 다음과 같은 오류를 얻을 : 이름의 엔드 포인트 요소를 찾을 수 없습니다 '{XXX}'계약 '{YYY}'는 ServiceModel은 서비스 클라이언트에서 구성 섹션.

Note1 Visual Studio Project를 명령 줄 프로젝트로 만들고이를 직접 실행하면 SOAP 호출이 올바르게 작동합니다.

Note2 addin 매니페스트에서 가리키는 빌드 폴더에는 .config 파일이 있습니다.

<?xml version="1.0" encoding="utf-8" standalone="no"?> 
<RevitAddIns> 
    <AddIn Type="Command"> 
<Name>AIMRevitTestTwo</Name> 
<Assembly> 
    C:\Users\greg.bluntzer\Documents\Visual Studio 2015\Projects\AIMRevitTestTwo\AIMRevitTestTwo\bin\Debug\AIMRevitTestTwo.dll 
</Assembly> 
<AddInId>604b1052-f742-4951-8576-c261d1993109</AddInId> 
<FullClassName>App</FullClassName> 
<VendorId>xxx</VendorId> 
<VendorDescription>yyy</VendorDescription> 

내가는 .config 파일에서 볼 수 있도록 내 비주얼 스튜디오 프로젝트 또는 REVIT 매니페스트에 구성해야 할 다른 뭔가입니다.

업데이트 : 찾았습니다. link revit.exe.config 파일을 만들거나 업데이트하고 바인딩을 추가하려고합니다. 그것은 로컬로 내 문제를 해결합니다. 나는이 addin을 배포하고자하므로 좋은 해결책이 아닙니다. 그래서 나는 여전히 클래스 라이브러리와 함께 제공되는 설정 파일을 읽을 수 있도록 addin을 만드는 방법을 알고 싶다.

해결 방법 : 내가 코드에서 설정 정보를 구축 제안

  <binding name="findAePReqEByDocumentSoapBinding" allowCookies="true"> 
       <security mode="TransportCredentialOnly"> 
       <transport clientCredentialType="Basic" proxyCredentialType="Basic" realm="fmax" /> 
       <message clientCredentialType="UserName" algorithmSuite="Default" /> 
       </security> 
      </binding> 

내 경험에서 가장 좋은 대답은보다 오히려 프로그래밍 방식 바인딩을 만드는 것입니다, 일반적으로

BasicHttpBinding binding = new BasicHttpBinding(); 
     binding.Security.Mode = BasicHttpSecurityMode.TransportCredentialOnly; 
     binding.AllowCookies = true; 
     binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Basic; 
     binding.Security.Transport.ProxyCredentialType = HttpProxyCredentialType.Basic; 
     binding.Security.Transport.Realm = "fmax"; 
     binding.Security.Message.ClientCredentialType = BasicHttpMessageCredentialType.UserName; 
     binding.Security.Message.AlgorithmSuite = SecurityAlgorithmSuite.Default; 
     binding.MaxReceivedMessageSize = int.MaxValue; 
     binding.MaxBufferSize = int.MaxValue; 

     EndpointAddress endPointAddress = new EndpointAddress(DataAccess.END_POINT); 

답변

1

로 변신 설정 파일.

자동 생성 SOAP 클라이언트 클래스의 생성자를 살펴보면 아마도 사용하고있는 (구성에서 읽는) 인수가없는 생성자가 있지만 주소를 지정하는 다른 곳이있을 것입니다 및 코드의 바인딩. 그 길로가. BasicHttpBinding 클래스를 확인하십시오. config에 지정된 모든 것을 코드의 해당 클래스에 추가 할 수 있습니다.

+0

감사합니다. –

관련 문제