locked
Client using WCF service SOAp, WSsecurity RRS feed

  • Question

  • User-1906053058 posted

    I am trying to connect to a service at some URL. The available documentation tells us to use WS-Security
    I have a service URl, wsdl.
    So now to create a service reference, it gives the following error

          There was an error downloading 'https://service100.emedny.org:9047/MHService/_vti_bin/ListData.svc/$metadata'.
        The request failed with the error message:
        --
        <?xml version='1.0' ?>
        <env:Envelope xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'>
        <env:Body>
        <env:Fault>
        <faultcode>env:Client</faultcode>
        <faultstring>Internal Error</faultstring>
        </env:Fault>
        </env:Body>
        </env:Envelope>
        
        --.
        Metadata contains a reference that cannot be resolved: 'https://service100.emedny.org:9047/MHService'.
        Metadata contains a reference that cannot be resolved: 'https://service100.emedny.org:9047/MHService'.
        If the service is defined in the current solution, try building the solution and adding the service reference again.

    Tried navigating to the service and this is the error:

     
           <env:Envelope>
               <env:Body>
                 <env:Fault>
                   <faultcode>env:Client</faultcode>
                   <faultstring>Internal Error</faultstring>
                 </env:Fault>
               </env:Body>
            </env:Envelope>

    Then tried to get their wsdl and xsd.
    Added a service reference. This worked well although it didn't create any new classes. As per this
    [http://stackoverflow.com/questions/1302525/how-to-use-a-wsdl][1]

    it creates a Reference.cs class or YourServiceClientname class..
    Here is a little of wsdl

        <wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:soap11="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:wsp="http://www.w3.org/ns/ws-policy" xmlns:wsp200409="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsp200607="http://www.w3.org/2006/07/ws-policy" xmlns:ns0="http://org/emedny/mhs/" targetNamespace="http://org/emedny/mhs/">
        <wsdl:types xmlns:xsd="http://www.w3.org/2001/XMLSchema">
        <xsd:schema>
        <xsd:import schemaLocation="MHService.xsd1.xsd" namespace="http://org/emedny/mhs/"/></xsd:schema></wsdl:types>
        <wsdl:message name="getCCDResponse">
        <wsdl:part name="parameters" element="xsns:getCCDResponse" xmlns:xsns="http://org/emedny/mhs/"/></wsdl:message>
        <wsdl:message name="getEligibilityRequest">
        <wsdl:part name="parameters" element="xsns:getEligibility" xmlns:xsns="http://org/emedny/mhs/"/></wsdl:message>
        <wsdl:message name="getEligibilityResponse">
        <wsdl:part name="parameters" element="xsns:getEligibilityResponse" xmlns:xsns="http://org/emedny/mhs/"/></wsdl:message>
        <wsdl:message name="getNCPDPHistoryRequest">
        <wsdl:part name="parameters" element="xsns:getNCPDPHistory" xmlns:xsns="http://org/emedny/mhs/"/></wsdl:message>
        <wsdl:message name="getNCPDPHistoryResponse">


    I don't know if this is a problem on my side. I have a username, pwd, certificate and all that kinda authentication details. I am trying to connect to their service. So I will be using their Operations and all the other good stuff in their Contract like a client


      [1]: http://stackoverflow.com/questions/1302525/how-to-use-a-wsdl

    I also tried svcUtil.exe.. It gave  me an error that it can't find part, binding...and targetnamespace

    Thank you

    Tuesday, April 30, 2013 3:50 PM

Answers

  • User-1000095884 posted

    Hi,

    am trying to connect to a service at some URL. The available documentation tells us to use WS-Security
    I have a service URl, wsdl.
    So now to create a service reference, it gives the following error

    Please make sure the service expose the metadate properly( using MEX Metadata Endpoints or HTTP GET Metadata Endpoints), if use MEX Metadata Endpoints , you can generate proxy class using Svcutil.exe( the commands similar to svcutil.exe  http://localhost:1645/TestService/mex); if HTTP GET Metadata Endpoints, you can generate the proxy class using "Add service reference".

    #ServiceModel Metadata Utility Tool (Svcutil.exe)

    http://msdn.microsoft.com/en-us/library/aa347733.aspx

    #Publishing Metadata

    http://msdn.microsoft.com/en-us/library/aa751951.aspx

    Then tried to get their wsdl and xsd.
    Added a service reference. This worked well although it didn't create any new classes. As per this
    [http://stackoverflow.com/questions/1302525/how-to-use-a-wsdl][1]

    It seems that you can reference the service properly through the service wsdl. So what is your issue here?

    Best Regards.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, May 1, 2013 4:39 AM

All replies

  • User-1000095884 posted

    Hi,

    am trying to connect to a service at some URL. The available documentation tells us to use WS-Security
    I have a service URl, wsdl.
    So now to create a service reference, it gives the following error

    Please make sure the service expose the metadate properly( using MEX Metadata Endpoints or HTTP GET Metadata Endpoints), if use MEX Metadata Endpoints , you can generate proxy class using Svcutil.exe( the commands similar to svcutil.exe  http://localhost:1645/TestService/mex); if HTTP GET Metadata Endpoints, you can generate the proxy class using "Add service reference".

    #ServiceModel Metadata Utility Tool (Svcutil.exe)

    http://msdn.microsoft.com/en-us/library/aa347733.aspx

    #Publishing Metadata

    http://msdn.microsoft.com/en-us/library/aa751951.aspx

    Then tried to get their wsdl and xsd.
    Added a service reference. This worked well although it didn't create any new classes. As per this
    [http://stackoverflow.com/questions/1302525/how-to-use-a-wsdl][1]

    It seems that you can reference the service properly through the service wsdl. So what is your issue here?

    Best Regards.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, May 1, 2013 4:39 AM
  • User-1906053058 posted

    @Haixia Xie -...

    I got the wsdl to generate a proxy class. But then any hints on how to generate a soap using wsdl

    Thank u

    Wednesday, May 1, 2013 11:25 AM
  • User-1000095884 posted

    Hi,

    schalla123

    But then any hints on how to generate a soap using wsdl

    I am not sure what do you mean with "generate a soap using wsdl", if you mean utilize the proxy class to send a request, you can just create a client instance use the class (end with 'Client'). Something like:

    ServiceReference2.Service1Client client = new ServiceReference2.Service1Client();
     client.GetData(5);//call GetData method

    Best Regards.

    Thursday, May 2, 2013 5:15 AM
  • User-1906053058 posted

    @Haixia Xie : Could you please look at my other question same topic..

    http://forums.asp.net/t/1903405.aspx/1?soap+using+wsdl+generated+class

    Friday, May 3, 2013 10:53 PM