Integrations and APIs for Service

Get Involved. Join the Conversation.

Topic

    Yoshi Got
    [C #] How to call API via proxyAnswered
    Topic posted March 21, 2018 by Yoshi Got, last edited March 21, 2018 
    140 Views, 4 Comments
    Title:
    [C #] How to call API via proxy
    Content:

    Hello everyone.

    I am implementing sample source code according to the contents of "Getting Started. NET".(http://documentation.custhelp.com/euf/assets/devdocs/cloud18a/Connect_Web_Services_for_SOAP/Default.htm)

    I'd like to call the API using "RightNowSyncPortClient", but I need to pass through the proxy.
    What kind of implementation is necessary when passing through a proxy?

    Thanks!

    Yoshi.

    Version:
    Oracle Service Cloud 2017 August, Visual C# 2013

    Best Comment

    Gursimran Singh Saini

    Hello Yoshi,

    If the proxy is configured on Workstation/Server which executes your Application, then you don't need to make any special changes.

    If, however, you wish to configure a special Proxy just for your Application, then edit the "app.config" file and make following changes in it:
    - Under RightNowSyncBinding you will find a <httpsTransport> tag. If this tag is missing, then add it manually.
    - The httpsTransport tag should look like this:
    <httpsTransport proxyAddress="123.123.123.123" useDefaultWebProxy="false" />
    Enter your Proxy Address in proxyAddress Attribute.

    All in all, the <customBinding> should look like this:

    <customBinding>
        <binding name="RightNowSyncBinding">
            ...
            ...
            ...
            <httpsTransport proxyAddress="123.123.123.123" useDefaultWebProxy="false" />
    </customBinding>

    Comment

     

    • Gursimran Singh Saini

      Hello Yoshi,

      If the proxy is configured on Workstation/Server which executes your Application, then you don't need to make any special changes.

      If, however, you wish to configure a special Proxy just for your Application, then edit the "app.config" file and make following changes in it:
      - Under RightNowSyncBinding you will find a <httpsTransport> tag. If this tag is missing, then add it manually.
      - The httpsTransport tag should look like this:
      <httpsTransport proxyAddress="123.123.123.123" useDefaultWebProxy="false" />
      Enter your Proxy Address in proxyAddress Attribute.

      All in all, the <customBinding> should look like this:

      <customBinding>
          <binding name="RightNowSyncBinding">
              ...
              ...
              ...
              <httpsTransport proxyAddress="123.123.123.123" useDefaultWebProxy="false" />
      </customBinding>

    • Yoshi Got

      Hello Gursimran.

      Thanks for the advice.
      I set the <customBinding> setting.
      Then, the error message changed as follows.

      'System.InvalidOperationException: This operation is not supported for relative URI'.

      Is this due to the setting of app.config?

      Thanks.

    • Gursimran Singh Saini

      It means the Proxy address you entered in app.config is not in acceptable format.

      Try adding proxyAddress in below format:

      http://gateway:8080
      
    • Yoshi Got

      Hello Gursimran.

      Thanks for the advice.

      There was an error in what I had set in app.config.
      Deleting the service reference and resetting it again solved it.
      Thank you very much.

      Yoshi.