Consume Webservice that returns an OBJECT

Consume Webservice that returns an OBJECT


i'm consuming a webservice that is returning an object.
When i add the web reference, service studio buil the output structurs with datatype Record or RecordList.

when i get the response from the webservice i'am having this error:

There is an error in XML document (1, 367).
at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events)
at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle)
at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall)
at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)
at sstest.WebClient6.Registo.PesquisaEntidadeOutSystems(String tipoPesquisa, String codigo, WORCEntidaeRecord& PesquisaUmaEntidadeOutSystemsResult)

Any sugests ?

Bruno Rebelo
Hi Bruno,

I would suggest that you would send your eSpace to so that can take a look.

Tiago Simões
Hi Bruno

Can you use a HTTP sniffer/tracer to grab the request-response HTTP protocol and WS xml data?

If you don't have one you can use YATT (

Then check out the data being returned from the Web Service.


I found the problem…. the Object that i was using in the webservice have enumerations

and outsystems doesnt like enum.......


We have the same problem in platform

Unfortunately we are being delivered a .NET webservice which we cannot alter yet want to consume within Outsystem platform....

I attach a test OML that has imported the WSDL as given by http://...../xxx.asmx@WSDL - it is very rough but if you press OK (no need to enter anything) then you'll see the problem with one of the exports...

<s:complexType name="TestWebSvrExport">
          <s:element minOccurs="0" maxOccurs="1" default="false" name="TrustClients" type="s:boolean" />
          <s:element minOccurs="0" maxOccurs="1" default="" name="Command" type="s:string" />
          <s:element minOccurs="0" maxOccurs="1" default="Unknown" name="ExitStateType" type="tns:ExitStateTypeEnum" />
          <s:element minOccurs="0" maxOccurs="1" default="0" name="ExitState" type="s:int" />
          <s:element minOccurs="0" maxOccurs="1" default="" name="ExitStateMessage" type="s:string" />
          <s:element minOccurs="0" maxOccurs="1" name="OutTestEntityType" type="tns:OutTestEntityType" />
      <s:simpleType name="ExitStateTypeEnum">
        <s:restriction base="s:string">
          <s:enumeration value="Informational" />
          <s:enumeration value="Warning" />
          <s:enumeration value="Error" />
          <s:enumeration value="Unknown" />



The error in Service studio after digging down is:

[5] Enum underlying type and the object must be same type or object. Type passed in was 'System.String'; the enum underlying type was 'System.Int32'.
Stack: (Inner Exception of 82bf9313-a623-4703-8286-4cd04c0de930)
at System.Enum.Format(Type enumType, Object value, String format)
at System.Xml.Serialization.XmlReflectionImporter.GetDefaultValue(TypeDesc fieldTypeDesc, Type t, XmlAttributes a)

The Webservice is delivered with their own test harness that has some code in it to translate this which looks like it is required within the Outsystems platform webservice consumption wrapper:
switch (exportView.ExitStateType)
          case TestWebSvrExport.ExitStateTypeEnum.Informational:
          writer.WriteAttributeString( "exitStateType",
           "Informational" );
          case TestWebSvrExport.ExitStateTypeEnum.Warning:
          writer.WriteAttributeString( "exitStateType",
           "Warning" );
          case TestWebSvrExport.ExitStateTypeEnum.Error:
          writer.WriteAttributeString( "exitStateType",
           "Error" );
          case TestWebSvrExport.ExitStateTypeEnum.Unknown:
          writer.WriteAttributeString( "exitStateType",
           "OK" );

Is there any way to either
(a) Ask the platform to pass through the enum value directly instead or
(b) Have the translation done so we can call these webservices!
or ??


You can alter the wsdl if you want.
after all, the enum will be a string, so make it a string :)

Hi Paul,

Your problem is that the platform is not behaving as expected with the default value for the enum, so the workaround is to change the wsdl with a text editor and remove the default attribute for the enum. You should end up with something like this:

<s:element minOccurs="0" maxOccurs="1" name="ExitStateType" type="tns:ExitStateTypeEnum" />

Then refresh your Web Reference in Service Studio but now choose your file (just type the path in the refresh dialog).
This should work fine. In the meanwhile we will fix this soon.
Thanks Joost and João!

I have done this and it has got me round the immediate problem (and will do for me in the short term)

- BUT I am advising the import of LOTS of these webservices by a Client - and there will be quite a few versions needing to come through = repetitive manual work - so it would be very good to have a fix for this so they don't have to know this workaround at all - they are new to Outsystems and I don't want any reason for them to lose their first impression that it is wonderful (because it is - and this sort of small thing shouldn't taint that !)

Can I ask for a support reference so I can track this fix?

Paul the problem has been fixed and it will be available in one of the next revisions of the Agile Platform 5.1.

TOP NEWS - I love agile and the short sprints.