c# - WSE3 Destination vs URL -


i have vendor telling me soap header should not have https in it, can still communicate via ssl. our concern want communicate via ssl , sample code causing not happen.

in sample program, provide code:

    if (valservice.url.startswith("https"))     {         valservice.destination = new microsoft.web.services3.addressing.endpointreference(             new uri(valservice.url.replace("https:", "http:")));     }  

from breaking down smaller steps, , adding debug, seems when change destination, url automatically changes.

if (valservice.url.startswith("https")) {     // fix endpoint in case (usually not necessary)     //original code 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); } 

output:

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 

question: possible have different url in destination url? if how?

also, if reset url after update destination, destination gets changed. seems 2 somehow linked each other , cannot different?

thanks,

neal walters

update 1: research indicates vendor might able add soapactor attribute site.

when have https in url, give error:

the header must match actor uri value of web service. actor uri value can explicitly specified using soapactorattribute on asmx class. in absence of attribute, actor uri assumed equal http request url of incoming message. header received contained "https://somesite.net/orgid/someapp/someservice.asmx" while receiver expecting "http://somesite.net/orgid/someapp/someservice.asmx".

the vendor's sample indeed wrong , not using ssl. solution add "via" parameter constructor of endpoint:

 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


Comments

Popular posts from this blog

unicode - Are email addresses allowed to contain non-alphanumeric characters? -

C#: Application without a window or taskbar item (background app) that can still use Console.WriteLine() -

c++ - Convert big endian to little endian when reading from a binary file -