문제

비누 헤더에 HTTP가 없어야한다고 말하는 공급 업체가 있지만 SSL을 통해 여전히 통신 할 수 있다고 말합니다. 우리의 관심사는 우리가 SSL을 통해 의사 소통하고 그들의 샘플 코드로 인해 발생하지 않는다는 것입니다.

샘플 프로그램에서 그들은 다음 코드를 제공합니다.

    if (valservice.Url.StartsWith("https"))
    {
        valservice.Destination = new Microsoft.Web.Services3.Addressing.EndpointReference(
            new Uri(valservice.Url.Replace("https:", "http:")));
    } 

더 작은 단계로 나누고 일부 디버그를 추가하는 것부터 대상을 변경하면 URL이 자동으로 변경되는 것 같습니다.

if (valservice.Url.StartsWith("https"))
{
    // fix the endpoint just in case (usually not necessary)
    //original code is just this next line 
    //valservice.Destination = new Microsoft.Web.Services3.Addressing.EndpointReference(
    //    new Uri(valservice.Url.Replace("https:", "http:")));


    //test code 
    string holdOriginalURL = valservice.Url;

    Response.WriteLine("1 URL=" + valservice.Url);
    Response.WriteLine("1 Destination=" + valservice.Destination);
    Response.WriteLine("1 Destination.Address.Value=" + valservice.Destination.Address.Value);
    Response.WriteLine("1 Destination.TransportAddress=" + valservice.Destination.TransportAddress);

    //test 
    string newURL = valservice.Url;
    newURL = newURL.Replace("https:", "http:"); 
    //valservice.Destination = new Microsoft.Web.Services3.Addressing.EndpointReference(
    //    new Uri(newURL));
    Microsoft.Web.Services3.Addressing.EndpointReference tempEndPoint = new Uri(newURL);
    valservice.Destination = tempEndPoint; 
    //valservice.Url = holdOriginalURL; 
    Response.WriteLine("2 URL=" + valservice.Url);
    Response.WriteLine("2 Destination=" + valservice.Destination);
    Response.WriteLine("2 Destination.Address.Value =" + valservice.Destination.Address.Value);
    Response.WriteLine("2 Destination.TransportAddress=" + valservice.Destination.TransportAddress);
}

산출:

1 URL=https://someaddress.net/orgid/SomeApplication/SomeService.asmx
1 Destination.Address.Value=https://someaddress.net/orgid/SomeApplication/SomeService.asmx
1 Destination.TransportAddress=https://someaddress.net/orgid/SomeApplication/SomeService.asmx

2 URL=http://someaddress.net/orgid/SomeApplication/SomeService.asmx
2 Destination.Address.Value=http://someaddress.net/orgid/SomeApplication/SomeService.asmx
2 Destination.TransportAddress=http://someaddress.net/orgid/SomeApplication/SomeService.asmx

의문: 대상과 다른 URL을 가질 수 있습니까? 그렇다면 어떻게?

또한 대상을 업데이트 한 후 URL을 재설정하면 대상도 변경됩니다. 두 사람이 어떻게 든 서로 연결되어 있고 다를 수없는 것 같습니다.

감사,

닐 월터스

업데이트 1 : 일부 연구에 따르면 공급 업체가 공급 업체가 추가 할 수 있습니다. soapactor 속성 그들의 사이트에.

URL에 HTTPS가 있으면이 오류가 발생합니다.

헤더는 웹 서비스의 액터 URI 값과 일치해야합니다. 액터 URI 값은 ASMX 클래스에서 soapactorattribute를 사용하여 명시 적으로 지정할 수 있습니다. 속성이 없으면 배우 URI는 들어오는 메시지의 HTTP 요청 URL과 동일하다고 가정합니다. 수신 된 헤더 "https://somesite.net/orgid/someapp/someservice.asmx"수신기가 기대하는 동안"http://somesite.net/orgid/someapp/someservice.asmx".

도움이 되었습니까?

해결책

공급 업체의 샘플은 실제로 잘못되었고 SSL을 사용하지 않았습니다. 솔루션은 엔드 포인트의 생성자에 "Via"매개 변수를 추가하는 것이 었습니다.

 valservice.Destination =
            new Microsoft.Web.Services3.Addressing.EndpointReference(
                new Uri(valservice.Url.Replace("https:", "http:")), 
                new Uri(valservice.Url));

http://msdn.microsoft.com/en-us/library/microsoft.web.services3.addressing.endpointreference.via.aspx

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top