0

I am creating a WCF service from a given WSDL file. Here as per the WSDL, I want to set urn address in EndpointReference address as shown below

Example of WSDL:

<wsdl:service name="MyCustomService">
    <wsdl:port name="SecurePort" binding="tns:Secure">
        <soap12:address location="https://localhost:8453/MyService/Service.svc" />
        <wsa10:EndpointReference>
            **<wsa10:Address>urn:aaa.cc:abc:names:pqr:ddd</wsa10:Address>**
        </wsa10:EndpointReference>
    </wsdl:port>
    <wsdl:port name="UnSecurePort" binding="tns:Unsecure">
        <soap12:address location="http://localhost:8080/MyService/Service.svc" />
        <wsa10:EndpointReference>
            **<wsa10:Address>urn:aaa.cc:abc:names:pqr:ddd</wsa10:Address>**
        </wsa10:EndpointReference>
    </wsdl:port>

I have seen something called IWsdlExportExtension. But still checking how to access endpoint metadata and set the urn address.

Any help would be appropriated...

Thank You

  • 1
    Welcome to SO! When you place a question try to add a minimum content: input sample, expected output sample, what did you try, research and where are you stuck. What did you try? – David García Bodego Oct 29 '19 at 07:46

1 Answers1

0

Here is the solution:

public void ExportEndpoint(WsdlExporter exporter, WsdlEndpointConversionContext context){
EndpointAddress address = context.Endpoint.Address;

var newAbsoluteUri = new Uri("urn:aaa.cc:abc:names:pqr:ddd");

context.Endpoint.Address = new EndpointAddress(newAbsoluteUri,
    address.Identity, address.Headers, address.GetReaderAtMetadata(),
    address.GetReaderAtExtensions());}

Using IWsdlExportExtension interface, we can update the Endpoint address.

Thank You