:
using System.Configuration;
using System.Web.Services.Description;
namespace Thinktecture.Tools.Web.Services.Metadata
{
public class SoapAddressReflector : SoapExtensionReflector
{
public override void ReflectMethod()
{
ServiceDescription sd = ReflectionContext.ServiceDescription;
foreach (Service service in sd.Services)
{
foreach (Port port in service.Ports)
{
foreach (ServiceDescriptionFormatExtension extension in port.Extensions)
{
if (extension is SoapAddressBinding)
{
SoapAddressBinding address = (SoapAddressBinding)extension;
// Set the address here:
address.Location = ConfigurationManager.AppSettings["SoapAddress"];
}
}
}
}
}
}
}
을 : 여기
Manually setting soap:address in ASMX
을 링크가 죽으면 단지의 경우 코드 조각이있어 여기에이 과정을 도시 한 도면이다
구성 :
는
<configuration>
<appSettings>
<add key="SoapAddress" value="http://www.thinktecture.com/Test/"/>
</appSettings>
<system.web>
<webServices>
<soapExtensionReflectorTypes>
<add type="Thinktecture.Tools.Web.Services.Metadata.SoapAddressReflector, SoapAddressReflector"/>
</soapExtensionReflectorTypes>
</webServices>
</system.web>
</configuration>
업데이트 :
기술은 위의 잘 작동하는 것 같다하지만 당신은 하나 개 이상의 서비스를 사용하면 몇 가지 제한 사항이 있습니다. 전체 신뢰로 실행해야하므로 부분 신뢰 환경에서이 작업을 수행하지 않을 수도 있습니다.
SoapExtensionReflector
을 사용하는 것 외의 다른 마법 설정 스위치 나 속성이 있는지 잘 모르겠습니다. 좋은 구글 주위에, 모든 결과를 SoapExtensionReflector 방법을 가리킨 후.
하지만 어때? 웹 서비스가 생성 된 WDSL의 복사본을 가져올 수있는 모든 것을 자주 변경하지 않으면 SOAP/HTTP 바인딩을 편집 한 다음 정적 XML 파일로 자체 게시하십시오.
출처
2009-03-12 23:12:33
Kev
WCF 서비스 또는 .net 웹 서비스에 연결을 시도하고 있습니까? – lomaxx
.net 웹 서비스 –
@Ian - 다이어그램이 렌더링되지 않고 사이트가 시간 초과됩니다. – Kev