WCF WSDL don't create the same operation format as the class definition

Aldo Costa 1 Reputation point
2021-06-21T23:39:13.8+00:00

Hello Guys, i'm having a problem with a WCF that i need to create, i have this client that send me a XML with something like this.

       <otm:Bejeto xmlns:otm="http://xmlns.oracle.com/apps/otm/transmission/v6.4" xmlns:gtm="http://xmlns.oracle.com/apps/gtm/transmission/v6.4">
            <!--Optional:-->
            <otm:InnerProp>
               <!--Optional:-->
               <otm:A>?</otm:A>
               <!--Optional:-->
               <otm:B>?</otm:B>
            </otm:InnerProp>
         </otm:Bejeto>

The class that i'm writing is something like the sample bellow.

  [DataContract(Namespace = "http://xmlns.oracle.com/apps/otm")]
    public class Bejeto
    {
        [XmlAttribute(Namespace = "http://www.w3.org/2000/xmlns/", AttributeName = "otm")]
        public string otm { get; set; }

        [XmlAttribute(Namespace = "http://www.w3.org/2000/xmlns/", AttributeName = "gtm")]
        public string gtm { get; set; }

        [DataMember(Name = "InnerProp"),
            XmlElement(Namespace = "http://xmlns.oracle.com/apps/otm")]
        public InnerClass InnerProp { get; set; }
    }

    [DataContract(Namespace = "http://xmlns.oracle.com/apps/otm")]
    public class InnerClass
    {
        [DataMember(Name = "A")]
        public string A { get; set; }

        [DataMember(Name = "B")]
        public string B { get; set; }
    }

My operation is like this.

[OperationContract]
string AddXmlString(Bejeto Bejeto);

And i have this contract interface:

[ServiceContract(Namespace = "http://xmlns.oracle.com/apps/otm"), XmlSerializerFormat()]
    public interface INissanServices
    {

The issue is when we try its WSDL on SOAPUI, the operations looks like that:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:otm="http://xmlns.oracle.com/apps/otm">
   <soapenv:Header/>
   <soapenv:Body>
      <otm:AddXmlString>
         <!--Optional:-->
         <otm1:Bejeto xmlns:otm="?" xmlns:gtm="?" xmlns:otm1="http://xmlns.oracle.com/apps/otm">
            <!--Optional:-->
            <otm1:InnerProp>
               <!--Optional:-->
               <otm1:A>?</otm1:A>
               <!--Optional:-->
               <otm1:B>?</otm1:B>
            </otm1:InnerProp>
         </otm1:Bejeto>
      </otm:AddXmlString>
   </soapenv:Body>
</soapenv:Envelope>

It creates a prefix "otm1", also creates an extra attribute " xmlns:otm1", so the client can't use that.
I just figure it was the problem with compatibility or something...
Oh, i forgot, i can't use string to receive XML, it's a problem with the client tool (OTM), at least they told me that.

I hope someone have a solution for that, anyway,

Thanks a lot people \o/

.NET
.NET
Microsoft Technologies based on the .NET software framework.
3,346 questions
{count} votes