Page is a not externally linkable
- Microsoft
-- Microsoft IIS Web Server and ASP.NET
---- Complex data types not recognized by ASP.NET SOAP clients


leahco - 6:44 pm on Aug 21, 2007 (gmt 0)


Hello,

I have been working on a SOAP server that returns some complex data types. Here is how I have defined the data types:

require 'nusoap/nusoap.php';

$server = new soap_server();
$NAMESPACE = 'http://www.example.com/services/EorthoContent';
$server->configureWSDL('EorthoContent', $NAMESPACE);
$server->wsdl->schemaTargetNamespace = $NAMESPACE;

// Begin complex type definitions
$server->wsdl->addComplexType(
'ArrayOf_xsd_string',
'complexType',
'array',
'',
'SOAP-ENC:Array',
array(),
array(
array('ref'=>'SOAP-ENC:arrayType',
'wsdl:arrayType'=>'xsd:string[]'))
);

// ---- ArrayOf_xsd_string[] (ArrayOfArrayOf_xsd_string) -------------------------------
$server->wsdl->addComplexType(
'ArrayOfArrayOf_xsd_string',
'complexType',
'array',
'',
'SOAP-ENC:Array',
array(),
array(
array('ref'=>'SOAP-ENC:arrayType','wsdl:arrayType'=>'tns:ArrayOf_xsd_string[]')
),
'tns:ArrayOf_xsd_string'
);

Now, the complex types seem to be received fine when called by a PHP based SOAP client (nusoap or built-in SOAP in php5), but when trying to interpret the complex types in ASP.NET, I get the following error:

[InvalidOperationException: The specified type was not recognized: name='ArrayOf_xsd_string', namespace='http://www.example.com/services/EorthoContent', at <return xmlns=''>.]
System.Xml.Serialization.XmlSerializationReader.GetPrimitiveType(XmlQualifiedName typeName, Boolean throwOnUnknown) +695111
System.Xml.Serialization.XmlSerializationReader.ReadArray(String typeName, String typeNs) +459
System.Xml.Serialization.XmlSerializationReader.ReadReferencingElement(String name, String ns, Boolean elementCanBeType, String& fixupReference) +371
System.Xml.Serialization.XmlSerializationReader.ReadReferencingElement(String name, String ns, String& fixupReference) +14
Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderEorthoContentService.Read3_getProvidersResponse() +478
Microsoft.Xml.Serialization.GeneratedAssembly.ArrayOfObjectSerializer5.Deserialize(XmlSerializationReader reader) +40
System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events) +161

[InvalidOperationException: There is an error in XML document (1, 489).]
System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events) +637
System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle) +32
System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall) +1143
System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters) +204
EorthoContentService.getProviders(String clinicGUID) +47
patient_edu.BindProviders() +118
patient_edu.Page_Load(Object sender, EventArgs e) +30
System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +15
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +34
System.Web.UI.Control.OnLoad(EventArgs e) +99
System.Web.UI.Control.LoadRecursive() +47
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1061

Here is what the WSDL file looks like:

<?xml version="1.0" encoding="ISO-8859-1"?>
<definitions xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns="http://http://www.example.com/services/EorthoContent" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://www.example.com/services/EorthoContent">
<types><xsd:schema targetNamespace="http://www.example.com/services/EorthoContent"
>
<xsd:import namespace="http://schemas.xmlsoap.org/soap/encoding/" />
<xsd:import namespace="http://schemas.xmlsoap.org/wsdl/" />
<xsd:complexType name="ArrayOf_xsd_string">
<xsd:complexContent>
<xsd:restriction base="SOAP-ENC:Array">
<xsd:attribute ref="SOAP-ENC:arrayType" wsdl:arrayType="xsd:string[]"/>
</xsd:restriction>
</xsd:complexContent>
</xsd:complexType>
<xsd:complexType name="ArrayOfArrayOf_xsd_string">
<xsd:complexContent>
<xsd:restriction base="SOAP-ENC:Array">
<xsd:attribute ref="SOAP-ENC:arrayType" wsdl:arrayType="tns:ArrayOf_xsd_string[]"/>
</xsd:restriction>
</xsd:complexContent>
</xsd:complexType>
</xsd:schema>
</types>

...and then the function stuff starts.

Can anyone help me figure out why ASP.NET can't recognize the complex type ArrayOf_xsd_string?

Any help would be much appreciated.

Thanks,
Matt

[edited by: dreamcatcher at 7:03 pm (utc) on Aug. 21, 2007]
[edit reason] Use example.com, thanks. [/edit]


Thread source:: http://www.webmasterworld.com/microsoft_asp_net/3429534.htm
Brought to you by WebmasterWorld: http://www.webmasterworld.com