Web Service end point address
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: Web Service end point address

  1. #1
    Join Date
    Jun 2006
    Posts
    143

    Web Service end point address

    As we know a web service can return data in any format like pox, json, soap etc. I suppose returning data in different formats is implemented by specifying endpoints for these formats somewhat like below in the config file of the service. This is an example only.


    Code:
    <services>
          <service name="WcfService.TestService" behaviorConfiguration="defaultBehavior">
            <host>
              <baseAddresses>
                <!-- note, choose an available port-->
                <add baseAddress="http://localhost:81/TestService" />
              </baseAddresses>
            </host>
            <endpoint address="soap" 
                      binding="basicHttpBinding" 
                      bindingConfiguration="soapBinding" 
                      contract="WcfService.ITestService" />
            <endpoint address="pox"  
                      binding="webHttpBinding" 
                      bindingConfiguration="webBinding"  
                      behaviorConfiguration="poxBehavior"
                      contract="WcfService.ITestService" />
            <endpoint address="json" 
                      binding="webHttpBinding" 
                      bindingConfiguration="webBinding"  
                      behaviorConfiguration="jsonBehavior" 
                      contract="WcfService.ITestService" />
          </service>
        </services>
    In this case, I know that, if we need to get data in pox we can call the web service like below:
    Code:
    http://localhost:81/TestService/pox/....
    where pox is the end point address for pox( xml )..

    But if we do not know what all endpoint addresses a web service has configured, is there any way we can get the end point addresses from client so that we can request data from a native c++ client in the format we desire?

    Thanks in advance..

  2. #2
    Join Date
    Nov 2000
    Location
    Voronezh, Russia
    Posts
    6,051

    Re: Web Service end point address

    I believe this is what IMetadataExchange contract based endpoint mex is for. You should know, nevertheless, that it is up to service publisher to publish these details or not. I can imagine an absolutely opaque service when client code is generated strictly by service creator (and distributed privately) while service itself exposes main call contract interface only.
    Best regards,
    Igor

  3. #3
    Join Date
    Jun 2006
    Posts
    143

    Re: Web Service end point address

    Thank you , Igor. I was actually trying to call a web service from a c++ clint. All I know about the service is the url and the end points. ie. full urls of each method exposed by the server. I am able to call the web service. The thing was the service returned data in both json and xml. As we know a web service can choose to return data in any format and this varies acording to implementation.

    1. Either we can provide separate end points for xml, json, soap etc. in app.config or,

    2. we can have a method whose return is explicitly json or xml or

    3. We can have the client to request the data in json/xml in the request header..

    In my case it was the last thing that worked...ie, I needed to get data in json format from a web service and in order to get it, i had to request in json fomat.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center