Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 950581
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T23:35:24+00:00 2026-05-15T23:35:24+00:00

I’m trying to create a WCF client to send XML messages to a CGI

  • 0

I’m trying to create a WCF client to send XML messages to a CGI script. The script functions in a request-response pattern, where the contents of the XML message will determine the action to invoke.

I’ve starting by creating a service contract to represent the defined set of documents the CGI script will accept:

[ServiceContract]
public interface ICgiService
{
    [OperationContract(Name="request1")]
    [WebInvoke(BodyStyle = WebMessageBodyStyle.Bare)]
    ServiceResponse SubmitRequest(Request1 request);

    [OperationContract(Name="request2")]
    [WebInvoke(BodyStyle = WebMessageBodyStyle.Bare)]
    ServiceResponse SubmitRequest(Request2 request);

    [OperationContract(Name="request3")]
    [WebInvoke(BodyStyle = WebMessageBodyStyle.Bare)]
    ServiceResponse SubmitRequest(Request3 request);
}

I have generated a proxy client from this interface and configured the endpoint with the address to the CGI script and to use HTTP Transport.

When a request is made, the default behaviour of the WCF runtime is to append the operation name to the endpoint address to make the URI http://server/script.cgi/request1.

How do I modify this behaviour so all requests are sent to the endpoint address without any changes to the URI (e.g http://server/script.cgi)?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T23:35:25+00:00Added an answer on May 15, 2026 at 11:35 pm

    In the end, what I wanted to achieve doesn’t seem simple through out-of-the-box WCF at this time.

    To achieve direct control over the addressing, you can implement an IClientMessageFormatter and set the To header value directly, but this is a very heavy interface to be implementing, potentially causing other problems.

    To solve my problem I refactored the service contract into:

    [ServiceContract]
    public interface ICgiService
    {
        [OperationContract(Name="script.cgi")]
        [WebInvoke(BodyStyle = WebMessageBodyStyle.Bare)]
        ServiceResponse SubmitRequest(ServiceRequest request);
    }
    

    It doesn’t allow me to specify the CGI script URL as the full endpoint address, being treated as REST service where the script is a resource.

    Additionally, the ServiceRequest class now has to represent all the possible XML structure for each type of request, making the service contracts much harder to understand.

    Arguably, this is much closer to the real-world situation: posting various XML documents to a single CGI script that provides a single operation “Do Stuff”.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 468k
  • Answers 468k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Try using $0. May 16, 2026 at 2:15 am
  • Editorial Team
    Editorial Team added an answer If you're looking to verify that the user hasn't made… May 16, 2026 at 2:14 am
  • Editorial Team
    Editorial Team added an answer I believe you would have to use libxml-ruby for that.… May 16, 2026 at 2:14 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.