Missing xmlns definitions in complex types

Missing xmlns definitions in complex types

  
Hello all,

Consider this excerpt from a web service request, generated by the platform, based on a consumed webreference:

               <versionToken>
                  <userId xmlns="http://myschema.com/common/v2/">aUser</userId>
                  <recordVersion xmlns="http://myschema.com/common/v2/">1</recordVersion>
               </versionToken>

The structure fields, "userId" and "recordVersion" have the xmlns attribute defined, but the structure "versionToken" hasn't. This poses a problem if I'm consuming a webservice that, somewhere on its default namespace (for instance: "http://myschema.com/common/v3/") has a structure with the same name than the one that I'm using (from the "http://myschema.com/common/v2/" namespace).

Is there someway to force the web service requests to define the xmlns attribute on the structure level and not just on the structure fields?

Thanks in advance
Hi Tiago,

I'm having problems trying to imagine a case that will actually cause problems, becase if a structure from v2 appears, even with the same name, it will have to have the correct namespaced attached to it.

Can you produce a wsdl that will actually cause a problem?

Regards,
João Rosado
Hello João,

Thank you for joining this discussion. I've been struggling with this particular wsdl for a while, and already had to customize it a bit in order to correct some issues (eg. changing choice elements to sequence). I can't post it here, but I can post a few bits and try to explain what I think is causing the problem.

Like I previously mentioned, this wsdl works over a few different namespaces, namely "v2" and "v3".

These namespaces are defined over a few xsd files. And there is a lot of inheritance going on, I tried to simplify a bit of the structure used:
V3 Namespace:
   <xs:element name="myRequest">
       <xs:complexType>
            <xs:sequence>
                <xs:element name="myToken" type="v2:myToken"/>          
                <xs:element name="myElement" type="myElement" nillable="true"/>
            </xs:sequence>
        </xs:complexType>
    </xs:element>

<xs:complexType name="myElement">
        <xs:complexContent>
            <xs:extension base="myAbstract">
                <xs:sequence>
                    <xs:element name="title" type="v2:title" nillable="true" minOccurs="0"/>
                    <xs:element name="forename" type="v2:string" nillable="true" minOccurs="0"/>
                </xs:sequence>
            </xs:extension>
        </xs:complexContent>
    </xs:complexType>

<xs:complexType name="myAbstract" abstract="true">
        <xs:complexContent>
            <xs:extension base="v2:myObject">
                <xs:sequence>
                    <xs:element name="idNo" type="v2:seqNo" nillable="true" minOccurs="0"/>
                    <xs:element name="surname" type="v2:string" nillable="true" minOccurs="0"/>
                </xs:sequence>
            </xs:extension>
        </xs:complexContent>
    </xs:complexType>

V2 Namespace:
   <xs:complexType name="myObject" abstract="true">
        <xs:sequence>
            <xs:element name="versionToken" type="VersionToken" minOccurs="0" nillable="true"/>
            <xs:element name="externalId" type="xs:string" nillable="true" minOccurs="0"/>
        </xs:sequence>
    </xs:complexType>
    <xs:complexType name="VersionToken">
        <xs:sequence>
            <xs:element name="userId" type="userId" nillable="true"/>
            <xs:element name="recordVersion" type="recordVersion" nillable="true"/>
        </xs:sequence>
    </xs:complexType>
When this is imported into Service Studio, all structures are assigned their correct namespaces. And, when the request is formed, since it has been defined in the v3 namespace, the xmlns attribute tag is defined:

<myRequest xmlns="http://mywebservice/v3/">

But on the children structures, we are not specifying to which namespace they belong. And this leads us to:
           <myElement>
               <versionToken>
                  <userId xmlns="http://mywebservice/v2/">aUser</userId>
                  <recordVersion xmlns="http://mywebservice/v2/">1</recordVersion>
               </versionToken>
           </myElement>
This message eventually leads to this response from the webservice:

Expected elements 'versionToken@http://mywebservice/v2/
instead of 'versionToken@http://mywebservice/v3/' 
here in element myElement@http://mywebservice/v3/

 
If I change the original request and add to the versionToken element:
       <versionToken xmlns="http://mywebservice/v2/">

The request runs smoothly, and I get a successfull response from the webservice.

Best regards,
   Tiago Martins
Hi Tiago,

I see... Ok I agree that with those type definitions the versionToken element should have a v2 namespace.

I'll try to see if I can replicate it.
What platform server version are you using? And what type (.net, jboss, weblogic)?

Also would save me a lot of time if you could get me the eSpace with the webreference. A submit feedback from service studio including the oml or an email to outsystems support saying that I asked for it would be very usefull :)

Regards,
João Rosado
Hi João,

We're using "Platform Version 7.0.1.13" over .net.

I was trying to figure out if I was missing something or if this could be achieved easily in Service Studio or via some workaround. I will submit this question to Outsystems Support.

Thank you for your quick replies.

Best regards,
Tiago Martins