1

I'm developing a WCF Service to be consumed by InfoPath 2007 forms. After adding the Service as a secondary Datasource, InfoPath itself will autogenerate a certain Structure. for example:

Secondary data source structure in infopath

my Problem with this are the generated xpaths. displayname's xpath for example:

/dfs:myFields/dfs:dataFields/ns3:whoamiResponse/ns3:whoamiResult/q1:displayname

Since my Webservice has to replace an older one which is implemented in many forms with logic refferencing exactly a certain xpath i have to get the exact same xpath generated in my new Webservice.

How can i influence these generated prefixes like ns3:whoamiResult/q1:displayname ?

I noticed that q1 appeared after i changed the return type of my Operation from DataSet to a custom Class. And tns/ns1/ns2/ns3 .. is depending on Namespaces i changed in the [ServiceContract], [ServiceBehaviour] and some other Attributes.

[ServiceContract(Name="Webservice", Namespace = "BestNamespaceToBeEnteredHere")]
public interface IWebservice
{

    [OperationContract]
    //...
}

Could someone point me into the right direction? Can i somehow pass a cusstom Schema with the Webservice Response where i can define how the structure should look like?

cheers! phil

Community
  • 1
  • 1
philx_x
  • 1,708
  • 16
  • 23

1 Answers1

1

The Namespace property on your ServiceContract and DataContracts effect the namespaces used in the SOAP response. The prefixes are typically arbitrary, and I think it is rather queer that InfoPath displays them, but there are a great many articles on how to influence them.

While I don't typically support link only answers, I list them below as I could not explain it as well as they already have:

Duplicates:

Community
  • 1
  • 1
Mitch
  • 21,223
  • 6
  • 63
  • 86