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

  • Home
  • SEARCH
  • 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 643101
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T21:14:46+00:00 2026-05-13T21:14:46+00:00

I have a webservice programmed in coldfusion which I’m attempting to consume using c#.net.

  • 0

I have a webservice programmed in coldfusion which I’m attempting to consume using c#.net.

The particular webservices returns a coldfusion structure (a collection of items with a key and a value) which is exposed by the webservice as a complex object of type apachesoap:Map

<wsdl:message name="getDetailResponse">
    <wsdl:part name="getDetailReturn" type="apachesoap:Map"/>
</wsdl:message>

The complex type is correctly declared in the WSDL file automatically generated by coldfusion

<schema targetNamespace="http://xml.apache.org/xml-soap">
    <import namespace="http://webservice.templates"/>
    <import namespace="http://rpc.xml.coldfusion"/>
    <import namespace="http://schemas.xmlsoap.org/soap/encoding/"/>
    <complexType name="mapItem">
        <sequence>
            <element name="key" nillable="true" type="xsd:anyType"/>
            <element name="value" nillable="true" type="xsd:anyType"/>
        </sequence>
    </complexType>

    <complexType name="Map">

        <sequence>
            <element maxOccurs="unbounded" minOccurs="0" name="item" type="apachesoap:mapItem"/>
        </sequence>
    </complexType>
</schema>

When attempting to consume this using the following c# code:

theWebservice.theWebservice myWS = new theWebservice.theWebservice();
theWebservice.Map myMap = myWS.searchForRecord("some record data");

if (myMap.item == null) {
    Response.Write("myMap.item is null");
}

The code compiles fine but displays the “myMap.item is null” rather than being an object with a key and value pair.

Inspection with the debugger shows myMap has two children item and itemField both of type theWebservice.mapItem[] and both of value null.

I’ve seen other forum posts with a similar issue but no replies, does anyone know how I can consume the service correctly without having to alter the webservice to use just simple types?

Edited to provide more information

As per John Saunders’ questions, I’m using .NET Framework 3.5 in Visual Web Developer 2008. the webservice was included as a web reference and the response SOAP code is provided below (from soapUI):

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <soapenv:Body>
        <ns1:getDetailResponse soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns1="http://DefaultNamespace">
            <getDetailReturn xsi:type="ns2:Map" xmlns:ns2="http://xml.apache.org/xml-soap">
                <item xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
                    <key xsi:type="soapenc:string">a</key>
                    <value xsi:type="soapenc:string">1</value>
                </item>
                <item>
                    <key xsi:type="soapenc:string" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">b</key>
                    <value xsi:type="soapenc:string" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">2</value>
                </item>
            </getDetailReturn>
        </ns1:getDetailResponse>
    </soapenv:Body>
</soapenv:Envelope>
  • 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-13T21:14:47+00:00Added an answer on May 13, 2026 at 9:14 pm

    You can always consume the coldfusion web service without using .NETs built in services. This would require that you manually parse the response, but hey, It’s XML so it’s not that bad.

    Lets say you have this web service:

    <cfcomponent>
      <cffunction name="GetStruct" access="remote" returntype="struct" output="no">
            <cfscript>
               var struct = StructNew();
               struct.foo = "bar";
               struct.baz = 2;
               struct.Stooges = StructNew();
               struct.Stooges.Larry = 1;
               struct.Stooges.Moe = "Hi Mom";
               struct.Stooges.Curley = "Not Shemp"; 
            </cfscript>
    
        <cfreturn struct>
      </cffunction>
    </cfcomponent>
    

    set up your request in .Net like this:

    var request = WebRequest.Create("http://localhost/test.cfc?method=GetStruct");
    var response = request.GetResponse();
    String content;
    using (var reader = new StreamReader(response.GetResponseStream()))
    {
      content = reader.ReadToEnd();
    }
    

    The content you get back will be a wddx packet like this:

    <wddxPacket version="1.0">
        <header /> 
        <data>
            <struct>
                <var name="BAZ">
                    <string>2</string> 
                </var>
                <var name="STOOGES">
                    <struct>
                        <var name="MOE">
                          <string>Hi Mom</string> 
                        </var>
                        <var name="CURLEY">
                          <string>Not Shemp</string> 
                        </var>
                        <var name="LARRY">
                          <string>1</string> 
                        </var>
                    </struct>
              </var>
              <var name="FOO">
                <string>bar</string> 
              </var>
            </struct>
        </data>
    </wddxPacket>
    

    of course the even better solution might be to just return XML to begin with

    P.S. You can also force coldfusion to serialize the struct as JSON with returnformat=”json” on the cffunction tag.

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

Sidebar

Related Questions

I have got a web service programmed in c# / asp.net. [WebService(Namespace = http://example.com/)]
i have webservice that is using .net 2.0 server 2003 32 bit when i
I have a WebService in Java (Using Apache Axis) that get's the id of
I have a webservice using Hibernate as DAL - using MySql with InnoDB. Since
We have implemented webservice which generates xml response. I am facing issue while invoking
I have a WebService published on a server. I want to consume(invoke) this WS
I have a webservice in .NET and I need to call that webservice with
I'm trying to consume a webservice from camel using the cxf component, like this:
I have a webservice method which takes an Id and then will kick off
I have a webservice and client in c#/dotnet and I am using EnableDecompression to

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.